summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilian Peev <epeevs@codeaurora.org>2016-01-07 20:02:37 +0100
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2016-01-07 11:31:28 -0800
commitec7c5c59cd891e37b0661a883b597b1c34a6e9f2 (patch)
tree9062ec605f26c27a38f24eda59f646054d5ff883
parente351de67ac61ab6ebeffc995d647891edd24d2f4 (diff)
downloadandroid_packages_apps_Snap-ec7c5c59cd891e37b0661a883b597b1c34a6e9f2.tar.gz
android_packages_apps_Snap-ec7c5c59cd891e37b0661a883b597b1c34a6e9f2.tar.bz2
android_packages_apps_Snap-ec7c5c59cd891e37b0661a883b597b1c34a6e9f2.zip
Camera: Avoid 'takePicture()' in preview ready state
Depending on timing 'takePicture()' could be triggered while the preview surface holder is still not available. The camera preview in such scenario can be started but will not run without a valid surface holder. Triggering snapshot in this case is not allowed and can lead to runtime exception. CRs-Fixed: 769441 Change-Id: I6c4f013e9ca8b5903abbfe69394dc0871669d7c2
-rw-r--r--src/com/android/camera/PhotoModule.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index c30a10fa2..44f375e3a 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -2097,8 +2097,11 @@ public class PhotoModule
|| mUI.collapseCameraControls()
|| (mCameraState == SWITCHING_CAMERA)
|| (mCameraState == PREVIEW_STOPPED)
- || (null == mFocusManager)) return;
+ || (null == mFocusManager)
+ || (null == mUI.getSurfaceHolder())) return;
+
mShutterPressing = true;
+
// Do not take the picture if there is not enough storage.
if (mActivity.getStorageSpaceBytes() <= Storage.LOW_STORAGE_THRESHOLD_BYTES) {
Log.i(TAG, "Not enough space or storage not ready. remaining="