summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorSelim Gurun <sgurun@android.com>2014-03-11 18:51:16 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-03-11 18:51:16 +0000
commit4c1e2fb40bee6d3361b2d90a27493006f33f729b (patch)
tree67d0bf5cad52a1afacfe2eb6cbae80f4b4b826dc /src/com/android/browser
parentaf7b4b764b9edd885945f7265f4d747598c53ab7 (diff)
parenta83366c52fa7743615d60907d79c39853f5417c1 (diff)
downloadpackages_apps_Browser-4c1e2fb40bee6d3361b2d90a27493006f33f729b.zip
packages_apps_Browser-4c1e2fb40bee6d3361b2d90a27493006f33f729b.tar.gz
packages_apps_Browser-4c1e2fb40bee6d3361b2d90a27493006f33f729b.tar.bz2
am a83366c5: Merge "Handle DownloadManager expceptions"
* commit 'a83366c52fa7743615d60907d79c39853f5417c1': Handle DownloadManager expceptions
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/DownloadHandler.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/browser/DownloadHandler.java b/src/com/android/browser/DownloadHandler.java
index dee10ae..208d4ce 100644
--- a/src/com/android/browser/DownloadHandler.java
+++ b/src/com/android/browser/DownloadHandler.java
@@ -195,8 +195,17 @@ public class DownloadHandler {
request.setMimeType(mimetype);
// set downloaded file destination to /sdcard/Download.
// or, should it be set to one of several Environment.DIRECTORY* dirs depending on mimetype?
- request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
- // let this downloaded file be scanned by MediaScanner - so that it can
+ try {
+ request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
+ } catch (IllegalStateException ex) {
+ // This only happens when directory Downloads can't be created or it isn't a directory
+ // this is most commonly due to temporary problems with sdcard so show appropriate string
+ Log.w(LOGTAG, "Exception trying to create Download dir:", ex);
+ Toast.makeText(activity, R.string.download_sdcard_busy_dlg_title,
+ Toast.LENGTH_SHORT).show();
+ return;
+ }
+ // let this downloaded file be scanned by MediaScanner - so that it can
// show up in Gallery app, for example.
request.allowScanningByMediaScanner();
request.setDescription(webAddress.getHost());