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 235537 cfb35f362bb907e4e8a525505d30fa8533f829b4
parent 235536 1c6a933fb75cb3f3e733166f1fce460772d09106
child 235538 d8d5e2acfb7688fed3f70b9448ec74c90037cbde
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [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")