diff options
author | Santhosh Kumar H E <skhara@codeaurora.org> | 2014-12-03 15:33:56 +0530 |
---|---|---|
committer | Chippa-a <vusal1372@gmail.com> | 2019-10-25 15:55:25 +0300 |
commit | f43a3d7b1cee33cac1edb9bf0a15bf22c9b366c8 (patch) | |
tree | 602b8150e8631ca96021f17e511cb2235a975f89 /src/com/android/camera/PhotoModule.java | |
parent | 8994be089bcdc0b6569aecf02d47007f7597f26d (diff) | |
download | android_packages_apps_Snap-f43a3d7b1cee33cac1edb9bf0a15bf22c9b366c8.tar.gz android_packages_apps_Snap-f43a3d7b1cee33cac1edb9bf0a15bf22c9b366c8.tar.bz2 android_packages_apps_Snap-f43a3d7b1cee33cac1edb9bf0a15bf22c9b366c8.zip |
Initialize focus overlay manager if it is not initialized.
Camera open thread initializes the focus overlay manager
after opening camera. In a rare scenario above background
thread had not initialized focus overlay manager by the
time UI thread start acessesing it, so we see a crash.
Initialize focus overlay manager from UI thread if it is
not initialized already.
Change-Id: I1635c8759d0e0647fe61fe975a0cc24df40df529
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rwxr-xr-x | src/com/android/camera/PhotoModule.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 372ae3aa1..206f05f18 100755 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -2784,9 +2784,13 @@ public class PhotoModule mMirror = (info.facing == CameraInfo.CAMERA_FACING_FRONT); String[] defaultFocusModes = mActivity.getResources().getStringArray( R.array.pref_camera_focusmode_default_array); - mFocusManager = new FocusOverlayManager(mPreferences, defaultFocusModes, - mInitialParams, this, mMirror, - mActivity.getMainLooper(), mUI); + synchronized (this) { + if (mFocusManager == null) { + mFocusManager = new FocusOverlayManager(mPreferences, defaultFocusModes, + mInitialParams, this, mMirror, + mActivity.getMainLooper(), mUI); + } + } } } @@ -3057,6 +3061,8 @@ public class PhotoModule setCameraState(IDLE); } + if (mFocusManager == null) initializeFocusManager(); + if (!mSnapshotOnIdle) { mFocusManager.setAeAwbLock(false); // Unlock AE and AWB. } |