summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSanthosh Kumar H E <skhara@codeaurora.org>2015-08-11 10:41:54 +0530
committerDaniel Hillenbrand <codeworkx@cyanogenmod.org>2016-01-08 22:50:15 -0800
commit72b58b9afb6b2aca15cfeb4142e1644c7b6c9fc7 (patch)
tree67ad9fc78d9523d7a178c523bf63a70c8d41cd4c /src
parent8ceb088bf9cf14ff1f5288744dfdd07cd32b5432 (diff)
downloadandroid_packages_apps_Snap-72b58b9afb6b2aca15cfeb4142e1644c7b6c9fc7.tar.gz
android_packages_apps_Snap-72b58b9afb6b2aca15cfeb4142e1644c7b6c9fc7.tar.bz2
android_packages_apps_Snap-72b58b9afb6b2aca15cfeb4142e1644c7b6c9fc7.zip
Read camera state from HAL instead of local state variable.
Camera open thread opens the hardware and triggers preview. State of preview is updated over a handler message to UI thred. In between this surface window re-creation happens in UI thread. To set new window to HAL, preview should be in stopped state. Since state updation hasn't completed yet, UI thread reads old state and sets window while HAL is in previewing state. This lead to crash. To avoid the error read the camera state from HAL through framework API rather local state variable. Change-Id: Ieee86edc601f43b85773392a9a44853b4a56cde8
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/PhotoModule.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 13802c031..469e5a422 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -2740,7 +2740,8 @@ public class PhotoModule
@Override
public void stopPreview() {
- if (mCameraDevice != null && mCameraState != PREVIEW_STOPPED) {
+ boolean isPreviewing = mCameraDevice.getCamera().previewEnabled();
+ if (mCameraDevice != null && isPreviewing) {
if (mCameraState == LONGSHOT) {
mCameraDevice.setLongshot(false);
mLongshotActive = false;