summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/camera/Camera.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 6c238a6..45e1867 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -122,6 +122,9 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
private Parameters mInitialParams;
private boolean mFocusAreaSupported;
private boolean mMeteringAreaSupported;
+ private boolean mAeLockSupported;
+ private boolean mAwbLockSupported;
+ private boolean mAeAwbLock;
private MyOrientationEventListener mOrientationListener;
// The degrees of the device rotated clockwise from its natural orientation.
@@ -1354,7 +1357,19 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
// Do not do focus if there is not enough storage.
if (pressed && !canTakePicture()) return;
+ // Lock AE and AWB so users can half-press shutter and recompose.
+ mAeAwbLock = pressed;
+ if (mAeAwbLock && (mAeLockSupported || mAwbLockSupported)) {
+ setCameraParameters(UPDATE_PARAM_PREFERENCE);
+ }
+
mFocusManager.doFocus(pressed);
+
+ // Unlock AE and AWB after cancelAutoFocus. Camera API does not
+ // guarantee setParameters can be called during autofocus.
+ if (!mAeAwbLock && (mAeLockSupported || mAwbLockSupported)) {
+ setCameraParameters(UPDATE_PARAM_PREFERENCE);
+ }
}
@Override
@@ -1740,6 +1755,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
setPreviewDisplay(mSurfaceHolder);
setDisplayOrientation();
+ mAeAwbLock = false; // Unlock AE and AWB.
setCameraParameters(UPDATE_PARAM_ALL);
// If the focus mode is continuous autofocus, call cancelAutoFocus to
// resume it because it may have been paused by autoFocus call.
@@ -1813,6 +1829,14 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
private void updateCameraParametersPreference() {
+ if (mAeLockSupported) {
+ mParameters.setAutoExposureLock(mAeAwbLock);
+ }
+
+ if (mAwbLockSupported) {
+ mParameters.setAutoWhiteBalanceLock(mAeAwbLock);
+ }
+
if (mFocusAreaSupported) {
mParameters.setFocusAreas(mFocusManager.getFocusAreas());
}
@@ -2210,5 +2234,7 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
&& isSupported(Parameters.FOCUS_MODE_AUTO,
mInitialParams.getSupportedFocusModes()));
mMeteringAreaSupported = (mInitialParams.getMaxNumMeteringAreas() > 0);
+ mAeLockSupported = mInitialParams.isAutoExposureLockSupported();
+ mAwbLockSupported = mInitialParams.isAutoWhiteBalanceLockSupported();
}
}