Bug 1280184 - Disable system download manager integration on Android 6+. r?sebastian
This is also a mandatory prerequisite for doing something about
bug 1392768 - with download integration enabled, clearing download history items also attempts to remove the corresponding system download manager entry again, which on Android 6+ triggers a mandatory delete of the file and obviates the goal of that bug.
The corresponding Android issue is https://issuetracker.google.com/issues/37115671.
MozReview-Commit-ID: HvOktsgXmb1
--- a/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
@@ -97,16 +97,29 @@ public class DownloadsIntegration implem
}
}
private static boolean useSystemDownloadManager() {
if (!AppConstants.ANDROID_DOWNLOADS_INTEGRATION) {
return false;
}
+ if (Versions.feature23Plus) {
+ // As of Android M, the download manager has started deleting downloaded files when
+ // - a download is removed again from the download manager
+ // - the app that originally downloaded (or just added) the file is uninstalled.
+ // Since we
+ // - want to offer users a choice whether removing a download from the download history
+ // should also remove the corresponding file
+ // - want to avoid users accidentally losing their downloads if they uninstall Firefox
+ // we therefore have to give up our system download manager integration on affected
+ // Android versions.
+ return false;
+ }
+
int state = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
try {
final PackageManager pm = GeckoAppShell.getApplicationContext()
.getPackageManager();
state = pm.getApplicationEnabledSetting("com.android.providers.downloads");
} catch (IllegalArgumentException e) {
// Download Manager package does not exist
return false;