Mark incomplete downloads as partial.
Steve McKay [Tue, 15 Mar 2016 22:26:08 +0000 (15:26 -0700)]
Bug: 27526321
Change-Id: Ic29bc235242a8b87ab8321ee201cb7918594366f

src/com/android/providers/downloads/DownloadStorageProvider.java

index cc04d4d..bb78215 100644 (file)
@@ -326,10 +326,12 @@ public class DownloadStorageProvider extends DocumentsProvider {
             size = null;
         }
 
+        int extraFlags = Document.FLAG_PARTIAL;
         final int status = cursor.getInt(
                 cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS));
         switch (status) {
             case DownloadManager.STATUS_SUCCESSFUL:
+                extraFlags = 0;  // only successful is non-partial
                 break;
             case DownloadManager.STATUS_PAUSED:
                 summary = getContext().getString(R.string.download_queued);
@@ -354,7 +356,7 @@ public class DownloadStorageProvider extends DocumentsProvider {
                 break;
         }
 
-        int flags = Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE;
+        int flags = Document.FLAG_SUPPORTS_DELETE | Document.FLAG_SUPPORTS_WRITE | extraFlags;
         if (mimeType.startsWith("image/")) {
             flags |= Document.FLAG_SUPPORTS_THUMBNAIL;
         }