diff options
author | Steve Howard <showard@google.com> | 2010-08-17 08:20:52 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-17 08:20:52 -0700 |
commit | b3e957bb9d3a3811412e5d94233c7f7e2e777c28 (patch) | |
tree | 8b97a1aefd77392a5ecf14a70165982077bcdc45 | |
parent | b6ef8bad8a48fdc28770cf34d0c9efefc7fdd815 (diff) | |
parent | 33bbd12a05005ac92a0ecf82695893148227bb22 (diff) | |
download | frameworks_base-b3e957bb9d3a3811412e5d94233c7f7e2e777c28.zip frameworks_base-b3e957bb9d3a3811412e5d94233c7f7e2e777c28.tar.gz frameworks_base-b3e957bb9d3a3811412e5d94233c7f7e2e777c28.tar.bz2 |
Merge "New download manager error code when we can't resume." into gingerbread
-rw-r--r-- | api/current.xml | 11 | ||||
-rw-r--r-- | core/java/android/net/DownloadManager.java | 12 | ||||
-rw-r--r-- | core/java/android/provider/Downloads.java | 10 |
3 files changed, 32 insertions, 1 deletions
diff --git a/api/current.xml b/api/current.xml index 392ea95..f494775 100644 --- a/api/current.xml +++ b/api/current.xml @@ -96284,6 +96284,17 @@ visibility="public" > </field> +<field name="ERROR_CANNOT_RESUME" + type="int" + transient="false" + volatile="false" + value="1008" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="ERROR_DEVICE_NOT_FOUND" type="int" transient="false" diff --git a/core/java/android/net/DownloadManager.java b/core/java/android/net/DownloadManager.java index e69c324..447e642 100644 --- a/core/java/android/net/DownloadManager.java +++ b/core/java/android/net/DownloadManager.java @@ -185,6 +185,12 @@ public class DownloadManager { public final static int ERROR_DEVICE_NOT_FOUND = 1007; /** + * Value of {@link #COLUMN_ERROR_CODE} when some possibly transient error occurred but we can't + * resume the download. + */ + public final static int ERROR_CANNOT_RESUME = 1008; + + /** * Broadcast intent action sent by the download manager when a download completes. */ public final static String ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE"; @@ -715,7 +721,8 @@ public class DownloadManager { if (translateStatus(status) != STATUS_FAILED) { return 0; // arbitrary value when status is not an error } - if ((400 <= status && status < 490) || (500 <= status && status < 600)) { + if ((400 <= status && status < Downloads.Impl.MIN_ARTIFICIAL_ERROR_STATUS) + || (500 <= status && status < 600)) { // HTTP status code return status; } @@ -740,6 +747,9 @@ public class DownloadManager { case Downloads.STATUS_DEVICE_NOT_FOUND_ERROR: return ERROR_DEVICE_NOT_FOUND; + case Downloads.Impl.STATUS_CANNOT_RESUME: + return ERROR_CANNOT_RESUME; + default: return ERROR_UNKNOWN; } diff --git a/core/java/android/provider/Downloads.java b/core/java/android/provider/Downloads.java index c9b5512..6bf0d5b 100644 --- a/core/java/android/provider/Downloads.java +++ b/core/java/android/provider/Downloads.java @@ -1060,6 +1060,16 @@ public final class Downloads { public static final int STATUS_PRECONDITION_FAILED = 412; /** + * The lowest-valued error status that is not an actual HTTP status code. + */ + public static final int MIN_ARTIFICIAL_ERROR_STATUS = 489; + + /** + * Some possibly transient error occurred, but we can't resume the download. + */ + public static final int STATUS_CANNOT_RESUME = 489; + + /** * This download was canceled */ public static final int STATUS_CANCELED = 490; |