summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-11-14 21:25:51 -0800
committerSteve Kondik <steve@cyngn.com>2016-11-14 21:25:51 -0800
commit4977a83cd341bfb2df8903dc0877ef3139ac51ce (patch)
tree9bbbf9c615d8b06fe13fafdcca9f93df318685c1
parente003727e367b17a0bea0103b6dee42bc39208cb9 (diff)
downloadandroid_packages_apps_Snap-4977a83cd341bfb2df8903dc0877ef3139ac51ce.zip
android_packages_apps_Snap-4977a83cd341bfb2df8903dc0877ef3139ac51ce.tar.gz
android_packages_apps_Snap-4977a83cd341bfb2df8903dc0877ef3139ac51ce.tar.bz2
snap: Check for null when setting up the focus callback
* Depending on phase of moon and location of Jupiter, we might race during startup. Add a nullcheck and synchronize until we have a proper callback. Change-Id: I2d026f0eaae3541f78c105e8cb03ae38195f48ba
-rwxr-xr-xsrc/com/android/camera/PhotoModule.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index c4434bd..69976fd 100755
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -4155,15 +4155,17 @@ public class PhotoModule
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
private void updateAutoFocusMoveCallback() {
- if (mCameraDevice == null) {
+ if (mCameraDevice == null || mParameters == null) {
return;
}
- if (mParameters.getFocusMode().equals(CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE) ||
- mParameters.getFocusMode().equals(CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE)) {
- mCameraDevice.setAutoFocusMoveCallback(mHandler,
- (CameraAFMoveCallback) mAutoFocusMoveCallback);
- } else {
- mCameraDevice.setAutoFocusMoveCallback(null, null);
+ synchronized (mCameraDevice) {
+ if (mParameters.getFocusMode().equals(CameraUtil.FOCUS_MODE_CONTINUOUS_PICTURE) ||
+ mParameters.getFocusMode().equals(CameraUtil.FOCUS_MODE_MW_CONTINUOUS_PICTURE)) {
+ mCameraDevice.setAutoFocusMoveCallback(mHandler,
+ (CameraAFMoveCallback) mAutoFocusMoveCallback);
+ } else {
+ mCameraDevice.setAutoFocusMoveCallback(null, null);
+ }
}
}