Commit 0d362798 authored by Alex Catarineu's avatar Alex Catarineu Committed by Matthew Finkel
Browse files

Bug 40002: Ensure system download manager is not used

parent dc1e5052
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ android {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }

        buildConfigField("boolean", "ANDROID_DOWNLOADS_INTEGRATION", "false")
    }

    buildTypes {
+4 −1
Original line number Diff line number Diff line
@@ -325,7 +325,9 @@ abstract class AbstractFetchDownloadService : Service() {
            PAUSED -> DownloadNotification.createPausedDownloadNotification(context, download)
            FAILED -> DownloadNotification.createDownloadFailedNotification(context, download)
            COMPLETED -> {
                if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION) {
                    addToDownloadSystemDatabaseCompat(download.state)
                }
                DownloadNotification.createDownloadCompletedNotification(context, download)
            }
            CANCELLED -> {
@@ -723,6 +725,7 @@ abstract class AbstractFetchDownloadService : Service() {

    @VisibleForTesting
    internal fun shouldUseScopedStorage() =
            BuildConfig.ANDROID_DOWNLOADS_INTEGRATION &&
            getSdkVersion() >= Build.VERSION_CODES.Q && !isExternalStorageLegacy()

    @SuppressLint("NewApi")
+1 −2
Original line number Diff line number Diff line
@@ -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,