summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Nava <gnava@google.com>2015-05-27 10:42:03 -0700
committerGabriel Nava <gnava@google.com>2015-05-27 11:26:22 -0700
commitd927492ade2e253ccc620effd5602582eaa6dd2d (patch)
treeaa34ed10470387ef43af2b199adedc53b9ba174d
parent7ca4f1a488c01a649bf39fae1848cd31b1dfaa65 (diff)
downloadandroid_packages_apps_Camera2-d927492ade2e253ccc620effd5602582eaa6dd2d.tar.gz
android_packages_apps_Camera2-d927492ade2e253ccc620effd5602582eaa6dd2d.tar.bz2
android_packages_apps_Camera2-d927492ade2e253ccc620effd5602582eaa6dd2d.zip
Handling the GcamService timeout due to application in paused state (camera-Haleakala)
- When GcamService times out due to a pause state, all resources are released. - Releasing the gcam resources without showing the error dialog allows next resume operation to open the camera Bug: 21025113 Change-Id: I95a89fbf6ce2498c1323cd4d06383141cc7cb913
-rw-r--r--src/com/android/camera/CaptureModule.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 1a0d33d9d..afc4a1492 100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -1362,9 +1362,21 @@ public class CaptureModule extends CameraModule implements
@Override
public void onFailure() {
Log.e(TAG, "Could not open camera.");
+ // Sometimes the failure happens due to the controller
+ // being in paused state but mCamera is already
+ // initialized. In these cases we just need to close the
+ // camera device without showing the error dialog.
+ // Application will properly reopen the camera on the next
+ // resume operation (b/21025113).
+ boolean isControllerPaused = mAppController.isPaused();
+ if (mCamera != null) {
+ mCamera.close();
+ }
mCamera = null;
mCameraOpenCloseLock.release();
- mAppController.getFatalErrorHandler().onCameraOpenFailure();
+ if (!isControllerPaused) {
+ mAppController.getFatalErrorHandler().onCameraOpenFailure();
+ }
}
@Override