[tbb-commits] [Git][tpo/applications/android-components][android-components-57.0.6-10.0-2] 2 commits: Bug 40002: Ensure system download manager is not used

Matthew Finkel gitlab at torproject.org
Wed Sep 30 12:54:14 UTC 2020



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/288e6a1e81890ba3e2def9bb4863782bc8bba953...266410c638d5ae9b6643b153631fd1aa8ad48bad

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/android-components/-/compare/288e6a1e81890ba3e2def9bb4863782bc8bba953...266410c638d5ae9b6643b153631fd1aa8ad48bad
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20200930/b70f0d8f/attachment-0001.htm>


More information about the tbb-commits mailing list