Bug 1071116 - totalBytes must be greater than 0 in DownloadManager.addCompletedDownload r=bnicholson
authorWes Johnston <wjohnston@mozilla.com>
Fri, 17 Oct 2014 20:43:21 -0400
changeset 211223 cfb35f362bb907e4e8a525505d30fa8533f829b4
parent 211222 1c6a933fb75cb3f3e733166f1fce460772d09106
child 211224 d8d5e2acfb7688fed3f70b9448ec74c90037cbde
push id27668
push usercbook@mozilla.com
push dateMon, 20 Oct 2014 12:49:12 +0000
treeherdermozilla-central@f2d7d694aae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbnicholson
bugs1071116
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1071116 - totalBytes must be greater than 0 in DownloadManager.addCompletedDownload r=bnicholson
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -1830,17 +1830,17 @@ public class GeckoAppShell
         if (AppConstants.ANDROID_DOWNLOADS_INTEGRATION) {
             final File f = new File(aFile);
             final DownloadManager dm = (DownloadManager) getContext().getSystemService(Context.DOWNLOAD_SERVICE);
             dm.addCompletedDownload(f.getName(),
                                     f.getName(),
                                     true, // Media scanner should scan this
                                     mimeType,
                                     f.getAbsolutePath(),
-                                    Math.max(0, f.length()),
+                                    Math.max(1, f.length()), // Some versions of Android require downloads to be at least length 1
                                     false); // Don't show a notification.
         } else {
             Context context = getContext();
             GeckoMediaScannerClient.startScan(context, aFile, mimeType);
         }
     }
 
     @WrapElementForJNI(stubName = "GetIconForExtensionWrapper")