summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/CameraActivity.java
diff options
context:
space:
mode:
authorAlan Newberger <alann@google.com>2014-10-01 16:52:56 -0700
committerAlan Newberger <alann@google.com>2014-10-02 17:38:12 +0000
commit749682fa2c27556f50bf02ff79ccb35282e5e9be (patch)
tree69c9aa2e9ba60e1adfa5d398ae4c5dabc857e16e /src/com/android/camera/CameraActivity.java
parente1eb82bcd8050608ec3bda7ddcb7c0de961d93bd (diff)
downloadandroid_packages_apps_Camera2-749682fa2c27556f50bf02ff79ccb35282e5e9be.tar.gz
android_packages_apps_Camera2-749682fa2c27556f50bf02ff79ccb35282e5e9be.tar.bz2
android_packages_apps_Camera2-749682fa2c27556f50bf02ff79ccb35282e5e9be.zip
Trap camera close exceptions on pause
Bug: 17759456 Change-Id: I5e5fd39829bd0ebf3f37b354ca380cf6396bef55 (cherry picked from commit 48d4c8f1856503d88f4e2e42fa729f2556173694)
Diffstat (limited to 'src/com/android/camera/CameraActivity.java')
-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();
}