Verified Commit d6444a09 authored by aguestuser's avatar aguestuser
Browse files

Bug 40075: Support scoped storage to enable downloads on API < 29

- in !7,  we blocked all usage of Scoped
  Storage in an attempt to block usage of Android's
  DownloadManager, which is known to cause proxy bypasses
- as of Android API 29, downloads will not work without Scoped Storage,
  causing all downlaods to fail (see: fenix##40192)
- here, we enable usage of scoped storage for API >= 29, but block
  calls to DownloadManager on API < 29
parent 992d53f7
Loading
Loading
Loading
Loading
+2 −3
Changes for components/feature/downloads/src/main/java/mozilla/components/feature/downloads/AbstractFetchDownloadService.kt: 2 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -371,6 +371,7 @@ abstract class AbstractFetchDownloadService : Service() {
                style.notificationAccentColor
            )
            COMPLETED -> {
                // TBA blocks this call b/c it exposes file to Android DownloadManager in API < 29
                if (BuildConfig.ANDROID_DOWNLOADS_INTEGRATION) {
                    addToDownloadSystemDatabaseCompat(download.state, scope)
                }
@@ -841,9 +842,7 @@ abstract class AbstractFetchDownloadService : Service() {
    }

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

    /**
     * Gets the SDK version from the system.