diff options
author | Wei Huang <weih@google.com> | 2011-10-18 06:42:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-18 06:42:13 -0700 |
commit | af327d0b5571a9bcddd3f8d69ec25dd4fc59e5b7 (patch) | |
tree | a59b7115b6a24d8b1a150f0b6aa5cd8483f778f9 /src/com/android/camera/Camera.java | |
parent | ad805f2cad2d846790252eed337c638bf4a8c0d8 (diff) | |
parent | ff55f519629fbe839fe051108b396565403d696e (diff) | |
download | LegacyCamera-af327d0b5571a9bcddd3f8d69ec25dd4fc59e5b7.zip LegacyCamera-af327d0b5571a9bcddd3f8d69ec25dd4fc59e5b7.tar.gz LegacyCamera-af327d0b5571a9bcddd3f8d69ec25dd4fc59e5b7.tar.bz2 |
am ff55f519: Merge "Lock AE and AWB before autofocus starts." into ics-mr0
* commit 'ff55f519629fbe839fe051108b396565403d696e':
Lock AE and AWB before autofocus starts.
Diffstat (limited to 'src/com/android/camera/Camera.java')
-rw-r--r-- | src/com/android/camera/Camera.java | 26 |
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(); } } |