diff options
author | Gabriel Nava <gnava@google.com> | 2015-05-27 21:08:02 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-05-27 21:08:02 +0000 |
commit | a5085e67f2ef90b94534a99d3bf5ec65662ec82d (patch) | |
tree | 501aba4be26bd5faeab8a3e1dc61ed7a928e5f5f | |
parent | faaa286e4544fc75b71b4127c698b47c9c2b0e7a (diff) | |
parent | 84a379fffdc439e49623178e81b9535904de0030 (diff) | |
download | android_packages_apps_Camera2-a5085e67f2ef90b94534a99d3bf5ec65662ec82d.tar.gz android_packages_apps_Camera2-a5085e67f2ef90b94534a99d3bf5ec65662ec82d.tar.bz2 android_packages_apps_Camera2-a5085e67f2ef90b94534a99d3bf5ec65662ec82d.zip |
am 84a379ff: am d927492a: Handling the GcamService timeout due to application in paused state (camera-Haleakala)
* commit '84a379fffdc439e49623178e81b9535904de0030':
Handling the GcamService timeout due to application in paused state (camera-Haleakala)
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 14 |
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 |