summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEthan Chen <intervigil@gmail.com>2016-01-27 13:31:13 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-02-01 14:13:17 -0800
commit569035d6f61b76a2826cdec126ebf6b50ecaba38 (patch)
tree72e1e1a319f449415bc8a136bd47d7a5871b6d90
parent7c3f01e88cb7d45db99f08854d4b4be5c2e6c779 (diff)
downloadandroid_packages_apps_Snap-569035d6f61b76a2826cdec126ebf6b50ecaba38.zip
android_packages_apps_Snap-569035d6f61b76a2826cdec126ebf6b50ecaba38.tar.gz
android_packages_apps_Snap-569035d6f61b76a2826cdec126ebf6b50ecaba38.tar.bz2
Snap: Don't crash when hardcoded gallery intent fails
* startActivity may also throw IllegalArgumentException in addition to ActivityNotFoundException when the component can't be found. Change-Id: Ia3124591c625f4c249f3c6f76a226e8178df6e9d
-rw-r--r--src/com/android/camera/CameraActivity.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 8e0c144..e6e1ea4 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -599,14 +599,22 @@ public class CameraActivity extends Activity
intent.putExtra(KEY_TOTAL_NUMBER, (adapter.getTotalNumber() -1));
startActivity(intent);
} catch (ActivityNotFoundException ex) {
- try {
- Log.w(TAG, "Gallery not found");
- Intent intent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(intent);
- intent.putExtra(KEY_FROM_SNAPCAM, true);
- } catch (ActivityNotFoundException e) {
- Log.w(TAG, "No Activity could be found to open image or video");
- }
+ gotoViewPhoto(uri);
+ } catch (IllegalArgumentException ex) {
+ gotoViewPhoto(uri);
+ }
+ }
+
+ private void gotoViewPhoto(Uri uri) {
+ try {
+ Log.w(TAG, "Gallery not found");
+ Intent intent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(intent);
+ intent.putExtra(KEY_FROM_SNAPCAM, true);
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "No Activity could be found to open image or video");
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "No Activity could be found to open image or video");
}
}