diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-09-22 12:37:16 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-10-18 16:53:39 +0800 |
commit | bcb097dbf1319edc84ae9bed51fa30b3ae6e3fd1 (patch) | |
tree | bad19239785ed9fae988066b96e51d21632274bc /src/com | |
parent | 267bccfc197cdb2eaa44a0a96c8138863d1cc0bc (diff) | |
download | packages_apps_LegacyCamera-bcb097dbf1319edc84ae9bed51fa30b3ae6e3fd1.zip packages_apps_LegacyCamera-bcb097dbf1319edc84ae9bed51fa30b3ae6e3fd1.tar.gz packages_apps_LegacyCamera-bcb097dbf1319edc84ae9bed51fa30b3ae6e3fd1.tar.bz2 |
Lock AE and AWB before autofocus starts.
Now camera API specifies autofocus does not lock AE and AWB.
So the application locks AE/AWB when focus starts.
AE/AWB are unlocked when focus finishes or preview starts.
bug:5441274
Change-Id: Iddf21a413234bc3569187f4696d54099c362d008
Diffstat (limited to 'src/com')
-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 8cc5816..795c652 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. @@ -1357,7 +1360,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 @@ -1743,6 +1758,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. @@ -1816,6 +1832,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()); } @@ -2213,5 +2237,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(); } } |