Verified Commit 6d4054a6 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 8457ec32
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ android {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }

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

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