summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChih-Chung Chang <chihchung@google.com>2011-10-26 19:19:01 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-26 19:19:01 -0700
commit6b3a61edf6cfc87473ad8e97c39988260d2e2a3a (patch)
tree0e7cba76bd35bc88a04bd66eb04d51abeb533ce5 /src
parenta4bfc37a8d4567745bf2c5d9bbb3166fa0e7f302 (diff)
parent80efb2ecfb09db1ac0915b13a91165d06bfbee74 (diff)
downloadLegacyCamera-6b3a61edf6cfc87473ad8e97c39988260d2e2a3a.zip
LegacyCamera-6b3a61edf6cfc87473ad8e97c39988260d2e2a3a.tar.gz
LegacyCamera-6b3a61edf6cfc87473ad8e97c39988260d2e2a3a.tar.bz2
Merge "Fix 5489985: Handle the exception when the external volume has not been added to MediaProvider." into ics-mr1
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Storage.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java
index 564c088..38a6d48 100644
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -84,10 +84,16 @@ public class Storage {
values.put(ImageColumns.LONGITUDE, location.getLongitude());
}
- Uri uri = resolver.insert(Images.Media.EXTERNAL_CONTENT_URI, values);
- if (uri == null) {
- Log.e(TAG, "Failed to write MediaStore");
- return null;
+ Uri uri = null;
+ try {
+ uri = resolver.insert(Images.Media.EXTERNAL_CONTENT_URI, values);
+ } catch (Throwable th) {
+ // This can happen when the external volume is already mounted, but
+ // MediaScanner has not notify MediaProvider to add that volume.
+ // The picture is still safe and MediaScanner will find it and
+ // insert it into MediaProvider. The only problem is that the user
+ // cannot click the thumbnail to review the picture.
+ Log.e(TAG, "Failed to write MediaStore" + th);
}
return uri;
}