diff options
author | Santhosh Kumar H E <skhara@codeaurora.org> | 2015-08-11 10:41:54 +0530 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2016-01-08 22:50:15 -0800 |
commit | 72b58b9afb6b2aca15cfeb4142e1644c7b6c9fc7 (patch) | |
tree | 67ad9fc78d9523d7a178c523bf63a70c8d41cd4c /src/com | |
parent | 8ceb088bf9cf14ff1f5288744dfdd07cd32b5432 (diff) | |
download | android_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/com')
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 3 |
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; |