summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Newberger <alann@google.com>2013-10-30 11:50:36 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-10-30 11:50:36 -0700
commit48372e319a4e27b08c4449391b8bc92a4a59ebbe (patch)
tree9ad9c891418365ac9fbf7d705e8fe938d2023c8b
parentdcd1b26068aeb71624220bdff25703dfbf5b7058 (diff)
parentebbcc3944adcc01846128d1bdacc7c8b1c8cdb35 (diff)
downloadandroid_packages_apps_Gallery2-48372e319a4e27b08c4449391b8bc92a4a59ebbe.tar.gz
android_packages_apps_Gallery2-48372e319a4e27b08c4449391b8bc92a4a59ebbe.tar.bz2
android_packages_apps_Gallery2-48372e319a4e27b08c4449391b8bc92a4a59ebbe.zip
am ebbcc394: Avoid crash if user disables Camera while Gallery is open
* commit 'ebbcc3944adcc01846128d1bdacc7c8b1c8cdb35': Avoid crash if user disables Camera while Gallery is open
-rw-r--r--src/com/android/gallery3d/util/GalleryUtils.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/com/android/gallery3d/util/GalleryUtils.java b/src/com/android/gallery3d/util/GalleryUtils.java
index d1f822923..8fb926c0b 100644
--- a/src/com/android/gallery3d/util/GalleryUtils.java
+++ b/src/com/android/gallery3d/util/GalleryUtils.java
@@ -247,7 +247,13 @@ public class GalleryUtils {
Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_NEW_TASK);
- context.startActivity(intent);
+ try {
+ context.startActivity(intent);
+ } catch (ActivityNotFoundException e) {
+ // This will only occur if Camera was disabled while Gallery is open
+ // since we cache our availability check. Just abort the attempt.
+ Log.e(TAG, "Camera activity previously detected but cannot be found", e);
+ }
}
public static void startGalleryActivity(Context context) {