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 Bug 40002: Ensure system download manager is not used
- - - - - 266410c6 by Matthew Finkel at 2020-09-30T12:53:55+00:00 Merge remote-tracking branch 'acatgl/40002' into android-components-57.0.6-10.0-2
- - - - -
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:
===================================== components/feature/downloads/build.gradle ===================================== @@ -20,6 +20,8 @@ android { arg("room.schemaLocation", "$projectDir/schemas".toString()) } } + + buildConfigField("boolean", "ANDROID_DOWNLOADS_INTEGRATION", "false") }
buildTypes {
===================================== components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt ===================================== @@ -326,7 +326,9 @@ abstract class AbstractFetchDownloadService : Service() { PAUSED -> DownloadNotification.createPausedDownloadNotification(context, download) FAILED -> DownloadNotification.createDownloadFailedNotification(context, download) COMPLETED -> { - addToDownloadSystemDatabaseCompat(download.state) + if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION) { + addToDownloadSystemDatabaseCompat(download.state) + } DownloadNotification.createDownloadCompletedNotification(context, download) } CANCELLED -> { @@ -688,7 +690,7 @@ abstract class AbstractFetchDownloadService : Service() { val downloadWithUniqueFileName = makeUniqueFileNameIfNecessary(download, append) updateDownloadState(downloadWithUniqueFileName)
- if (getSdkVersion() >= Build.VERSION_CODES.Q && !isExternalStorageLegacy()) { + if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION && getSdkVersion() >= Build.VERSION_CODES.Q && !isExternalStorageLegacy()) { useFileStreamScopedStorage(downloadWithUniqueFileName, block) } else { useFileStreamLegacy(downloadWithUniqueFileName, append, block)
===================================== components/feature/downloads/src/main/java/mozilla/components/feature/downloads/DownloadsFeature.kt ===================================== @@ -25,7 +25,6 @@ import mozilla.components.browser.state.state.SessionState import mozilla.components.browser.state.state.content.DownloadState import mozilla.components.browser.state.store.BrowserStore import mozilla.components.feature.downloads.DownloadDialogFragment.Companion.FRAGMENT_TAG -import mozilla.components.feature.downloads.manager.AndroidDownloadManager import mozilla.components.feature.downloads.manager.DownloadManager import mozilla.components.feature.downloads.manager.noop import mozilla.components.feature.downloads.manager.onDownloadStopped @@ -69,7 +68,7 @@ class DownloadsFeature( internal val useCases: DownloadsUseCases, override var onNeedToRequestPermissions: OnNeedToRequestPermissions = { }, onDownloadStopped: onDownloadStopped = noop, - private val downloadManager: DownloadManager = AndroidDownloadManager(applicationContext, store), + private val downloadManager: DownloadManager, private val tabId: String? = null, private val fragmentManager: FragmentManager? = null, private val promptsStyling: PromptsStyling? = null,
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare/...