summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadThread.java
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-09-16 12:04:17 -0700
committerSteve Howard <showard@google.com>2010-09-20 13:45:30 -0700
commitb9a0ad7182209d4aca708e13e876e9b1b43ffafc (patch)
treee49d39e80dfc9c2ffc6a43c81f08ee0edce26c31 /src/com/android/providers/downloads/DownloadThread.java
parentdbefa6f5eff88f97dd91a8adfd65dbd946adb99e (diff)
downloadandroid_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.tar.gz
android_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.tar.bz2
android_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.zip
Improve file error reporting + new detailed error messages in UI
* support new error code for "destination file already exists" * improve error handling for various file error cases to return a more specific error code when appropriate * make UI support more detailed error messages for some cases * use Uri.getPath() instead of Uri.getSchemeSpecificPart() for file URIs Change-Id: Icb01d4d3b47c7776be3ddcd8347212e950cd023e
Diffstat (limited to 'src/com/android/providers/downloads/DownloadThread.java')
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index b2353e16..57007f49 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -426,9 +426,18 @@ public class DownloadThread extends Thread {
}
return;
} catch (IOException ex) {
- if (mInfo.isOnCache()
- && Helpers.discardPurgeableFiles(mContext, Constants.BUFFER_SIZE)) {
- continue;
+ if (mInfo.isOnCache()) {
+ if (Helpers.discardPurgeableFiles(mContext, Constants.BUFFER_SIZE)) {
+ continue;
+ }
+ } else if (!Helpers.isExternalMediaMounted()) {
+ throw new StopRequest(Downloads.Impl.STATUS_DEVICE_NOT_FOUND_ERROR);
+ }
+
+ long availableBytes =
+ Helpers.getAvailableBytes(Helpers.getFilesystemRoot(state.mFilename));
+ if (availableBytes < bytesRead) {
+ throw new StopRequest(Downloads.Impl.STATUS_INSUFFICIENT_SPACE_ERROR, ex);
}
throw new StopRequest(Downloads.Impl.STATUS_FILE_ERROR, ex);
}