OSDN Git Service

b/2383073 Add fine-grained status codes for failed downloads.
authorAttila Bodis <attila@google.com>
Tue, 26 Jan 2010 22:52:32 +0000 (14:52 -0800)
committerAttila Bodis <attila@google.com>
Tue, 26 Jan 2010 22:52:32 +0000 (14:52 -0800)
Introduces new download status codes (STATUS_DEVICE_NOT_FOUND_ERROR and
STATUS_INSUFFICIENT_SPACE_ERROR) to allow apps to show more accurate and
informative error messages upon failed downloads.

core/java/android/provider/Downloads.java

index 6bf09b5..08ab166 100644 (file)
@@ -517,6 +517,8 @@ public final class Downloads {
     /**
      * This download couldn't be completed because of a storage issue.
      * Typically, that's because the filesystem is missing or full.
+     * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
+     * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
      * @hide
      */
     public static final int STATUS_FILE_ERROR = 492;
@@ -558,6 +560,21 @@ public final class Downloads {
     public static final int STATUS_TOO_MANY_REDIRECTS = 497;
 
     /**
+     * This download couldn't be completed due to insufficient storage
+     * space.  Typically, this is because the SD card is full.
+     * @hide
+     */
+    public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 498;
+
+    /**
+     * This download couldn't be completed because no external storage
+     * device was found.  Typically, this is because the SD card is not
+     * mounted.
+     * @hide
+     */
+    public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 499;
+
+    /**
      * This download is visible but only shows in the notifications
      * while it's in progress.
      * @hide
@@ -1019,6 +1036,8 @@ public final class Downloads {
         /**
          * This download couldn't be completed because of a storage issue.
          * Typically, that's because the filesystem is missing or full.
+         * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
+         * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
          */
         public static final int STATUS_FILE_ERROR = 492;
 
@@ -1054,6 +1073,19 @@ public final class Downloads {
         public static final int STATUS_TOO_MANY_REDIRECTS = 497;
 
         /**
+         * This download couldn't be completed due to insufficient storage
+         * space.  Typically, this is because the SD card is full.
+         */
+        public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 498;
+
+        /**
+         * This download couldn't be completed because no external storage
+         * device was found.  Typically, this is because the SD card is not
+         * mounted.
+         */
+        public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 499;
+
+        /**
          * This download is visible but only shows in the notifications
          * while it's in progress.
          */