Verified Commit 66f9f110 authored by Alex Catarineu's avatar Alex Catarineu Committed by aguestuser
Browse files

Bug 40002: Ensure system download manager is not used

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

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

    buildTypes {
+6 −2
Original line number Diff line number Diff line
@@ -371,7 +371,9 @@ abstract class AbstractFetchDownloadService : Service() {
                style.notificationAccentColor
            )
            COMPLETED -> {
                if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION) {
                    addToDownloadSystemDatabaseCompat(download.state, scope)
                }
                DownloadNotification.createDownloadCompletedNotification(
                    context,
                    download,
@@ -839,7 +841,9 @@ abstract class AbstractFetchDownloadService : Service() {
    }

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

    /**
     * Gets the SDK version from the system.
+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
@@ -70,7 +69,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,