summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Newberger <alann@google.com>2014-10-05 18:57:08 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-05 18:57:10 +0000
commitb0be8f5321605380110ca03a3ae6880b042fe187 (patch)
tree2c9127c3f34ca8b3e09746448729303dbb0239c1
parent0021c30190af49119ee319af6b207643b417c6c3 (diff)
parent749682fa2c27556f50bf02ff79ccb35282e5e9be (diff)
downloadandroid_packages_apps_Camera2-b0be8f5321605380110ca03a3ae6880b042fe187.tar.gz
android_packages_apps_Camera2-b0be8f5321605380110ca03a3ae6880b042fe187.tar.bz2
android_packages_apps_Camera2-b0be8f5321605380110ca03a3ae6880b042fe187.zip
Merge "Trap camera close exceptions on pause" into lmp-dev
-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();
}