Matthew Finkel pushed to branch android-components-57.0.6-10.0-2 at The Tor Project / Applications / android-components
Commits:
-
8c794786
by Alex Catarineu at 2020-09-29T17:38:13+02:00
-
266410c6
by Matthew Finkel at 2020-09-30T12:53:55+00:00
3 changed files:
- components/feature/downloads/build.gradle
- components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt
- components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadsFeature.kt
Changes:
... | ... | @@ -20,6 +20,8 @@ android { |
20 | 20 |
arg("room.schemaLocation", "$projectDir/schemas".toString())
|
21 | 21 |
}
|
22 | 22 |
}
|
23 |
+ |
|
24 |
+ buildConfigField("boolean", "ANDROID_DOWNLOADS_INTEGRATION", "false")
|
|
23 | 25 |
}
|
24 | 26 |
|
25 | 27 |
buildTypes {
|
... | ... | @@ -326,7 +326,9 @@ abstract class AbstractFetchDownloadService : Service() { |
326 | 326 |
PAUSED -> DownloadNotification.createPausedDownloadNotification(context, download)
|
327 | 327 |
FAILED -> DownloadNotification.createDownloadFailedNotification(context, download)
|
328 | 328 |
COMPLETED -> {
|
329 |
- addToDownloadSystemDatabaseCompat(download.state)
|
|
329 |
+ if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION) {
|
|
330 |
+ addToDownloadSystemDatabaseCompat(download.state)
|
|
331 |
+ }
|
|
330 | 332 |
DownloadNotification.createDownloadCompletedNotification(context, download)
|
331 | 333 |
}
|
332 | 334 |
CANCELLED -> {
|
... | ... | @@ -688,7 +690,7 @@ abstract class AbstractFetchDownloadService : Service() { |
688 | 690 |
val downloadWithUniqueFileName = makeUniqueFileNameIfNecessary(download, append)
|
689 | 691 |
updateDownloadState(downloadWithUniqueFileName)
|
690 | 692 |
|
691 |
- if (getSdkVersion() >= Build.VERSION_CODES.Q && !isExternalStorageLegacy()) {
|
|
693 |
+ if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION && getSdkVersion() >= Build.VERSION_CODES.Q && !isExternalStorageLegacy()) {
|
|
692 | 694 |
useFileStreamScopedStorage(downloadWithUniqueFileName, block)
|
693 | 695 |
} else {
|
694 | 696 |
useFileStreamLegacy(downloadWithUniqueFileName, append, block)
|
... | ... | @@ -25,7 +25,6 @@ import mozilla.components.browser.state.state.SessionState |
25 | 25 |
import mozilla.components.browser.state.state.content.DownloadState
|
26 | 26 |
import mozilla.components.browser.state.store.BrowserStore
|
27 | 27 |
import mozilla.components.feature.downloads.DownloadDialogFragment.Companion.FRAGMENT_TAG
|
28 |
-import mozilla.components.feature.downloads.manager.AndroidDownloadManager
|
|
29 | 28 |
import mozilla.components.feature.downloads.manager.DownloadManager
|
30 | 29 |
import mozilla.components.feature.downloads.manager.noop
|
31 | 30 |
import mozilla.components.feature.downloads.manager.onDownloadStopped
|
... | ... | @@ -69,7 +68,7 @@ class DownloadsFeature( |
69 | 68 |
internal val useCases: DownloadsUseCases,
|
70 | 69 |
override var onNeedToRequestPermissions: OnNeedToRequestPermissions = { },
|
71 | 70 |
onDownloadStopped: onDownloadStopped = noop,
|
72 |
- private val downloadManager: DownloadManager = AndroidDownloadManager(applicationContext, store),
|
|
71 |
+ private val downloadManager: DownloadManager,
|
|
73 | 72 |
private val tabId: String? = null,
|
74 | 73 |
private val fragmentManager: FragmentManager? = null,
|
75 | 74 |
private val promptsStyling: PromptsStyling? = null,
|