summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Newberger <alann@google.com>2014-10-01 16:52:56 -0700
committerThe Android Automerger <android-build@google.com>2014-10-02 11:40:03 -0700
commitaa27d014fcc70b799dfe38026308b017983366f1 (patch)
tree69c9aa2e9ba60e1adfa5d398ae4c5dabc857e16e
parent089a16e1355c3ce6d7d05cfe2435fa85cd024f80 (diff)
downloadandroid_packages_apps_Camera2-aa27d014fcc70b799dfe38026308b017983366f1.tar.gz
android_packages_apps_Camera2-aa27d014fcc70b799dfe38026308b017983366f1.tar.bz2
android_packages_apps_Camera2-aa27d014fcc70b799dfe38026308b017983366f1.zip
Trap camera close exceptions on pause
Bug: 17759456 Change-Id: I5e5fd39829bd0ebf3f37b354ca380cf6396bef55
-rw-r--r--src/com/android/camera/CameraActivity.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 25735ed81..5fac0a803 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1638,8 +1638,6 @@ public class CameraActivity extends Activity
performDeletion();
mCurrentModule.pause();
mOrientationManager.pause();
- // Close the camera and wait for the operation done.
- mCameraController.closeCamera(true);
mPanoramaViewHelper.onPause();
mLocalImagesObserver.setForegroundChangeListener(null);
@@ -1652,6 +1650,17 @@ public class CameraActivity extends Activity
UsageStatistics.instance().backgrounded();
+ // Close the camera and wait for the operation done. But if we time out
+ // via RuntimeException, just continue pausing, and request a finish().
+ try {
+ mCameraController.closeCamera(true);
+ } catch (RuntimeException e) {
+ Log.e(TAG, "Exception while closing camera", e);
+ if (!isFinishing()) {
+ finish();
+ }
+ }
+
super.onPause();
}