diff options
author | Likai Ding <likaid@codeaurora.org> | 2015-04-03 09:17:48 +0800 |
---|---|---|
committer | Likai Ding <likaid@codeaurora.org> | 2015-04-10 15:30:33 +0800 |
commit | 6ec8de284514ff3dad2dd0187ae8e0481a936c05 (patch) | |
tree | b31a90821e0982aa3872b694f19031eedfb9ed70 /src/com | |
parent | 5a5c08547826030bbe765ed5887aaad39a4f468b (diff) | |
download | android_packages_apps_Snap-6ec8de284514ff3dad2dd0187ae8e0481a936c05.tar.gz android_packages_apps_Snap-6ec8de284514ff3dad2dd0187ae8e0481a936c05.tar.bz2 android_packages_apps_Snap-6ec8de284514ff3dad2dd0187ae8e0481a936c05.zip |
SnapdragonCamera: fix crash during module switch
When module is switched from camcorder to camera, on UI thread, it calls
setFlipValue and then setParameters in onOrientationChanged. Meanwhile,
background OpenCameraThread is modifying mParameters in startPreview().
This leads to a ConcurrentModificationException.
Check camera state in onOrientationChanged. If it's not IDLE, skip
setFlipValue and setParameter since these will be done in startPreview.
This change also fixes camera UI orientation during a landscape launch.
Change-Id: I15ed1e2bbbfc95f1b53b7309b72942d98350c564
CRs-Fixed: 815034
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index aa8caaf3e..fceccdad9 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -1845,8 +1845,8 @@ public class PhotoModule int oldOrientation = mOrientation; mOrientation = CameraUtil.roundOrientation(orientation, mOrientation); if (oldOrientation != mOrientation) { - Log.v(TAG, "onOrientationChanged, update parameters"); - if (mParameters != null && mCameraDevice != null) { + if (mParameters != null && mCameraDevice != null && mCameraState == IDLE) { + Log.v(TAG, "onOrientationChanged, update parameters"); setFlipValue(); mCameraDevice.setParameters(mParameters); } |