summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Boucher <solb@google.com>2014-08-27 21:07:41 (GMT)
committerThe Android Automerger <android-build@google.com>2014-08-27 23:12:10 (GMT)
commitfbd0084b89fe1c3b7be014d13b15b20a08ed583a (patch)
treeff28644747a8c1a7b481f78ef3c55b9686b983d7
parent12c7df7e6ebbdad4e29aba68222e65cab46529ec (diff)
downloadandroid_frameworks_ex-fbd0084b89fe1c3b7be014d13b15b20a08ed583a.zip
android_frameworks_ex-fbd0084b89fe1c3b7be014d13b15b20a08ed583a.tar.gz
android_frameworks_ex-fbd0084b89fe1c3b7be014d13b15b20a08ed583a.tar.bz2
camera2-portability: Fix camera2 takePicture AE regression
This fixes a regression introduced by 984a086412a94ebea1bd9af8cd8bbf4afab38034 that resulted in captures sometimes hanging until the AE state changed. It includes explanatory comments to guard against this sort of error in the future. Bug: 17302778 Change-Id: I668f5a5470a0ae7712f62c7574d18360d47e410b
-rw-r--r--camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java
index 44f19bc..c4eea50 100644
--- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java
+++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2AgentImpl.java
@@ -854,6 +854,9 @@ class AndroidCamera2AgentImpl extends CameraAgent {
case CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED:
case CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED: {
+ // This check must be made regardless of whether the focus state has
+ // changed recently to avoid infinite waiting during autoFocus()
+ // when the algorithm has already either converged or failed to.
if (mOneshotAfCallback != null) {
// A call to autoFocus() was just made to request a focus lock.
// Notify the caller that the lens is now indefinitely fixed,
@@ -876,8 +879,7 @@ class AndroidCamera2AgentImpl extends CameraAgent {
// might get the final callbacks for an earlier frame after receiving one or
// more that correspond to the next one. To prevent our data from oscillating,
// we never consider AE states that are older than the last one we've seen.
- if (aeState != mCurrentAeState &&
- result.getFrameNumber() > mLastAeFrameNumber) {
+ if (result.getFrameNumber() > mLastAeFrameNumber) {
mCurrentAeState = aeStateMaybe;
mLastAeFrameNumber = result.getFrameNumber();
@@ -885,6 +887,9 @@ class AndroidCamera2AgentImpl extends CameraAgent {
case CaptureResult.CONTROL_AE_STATE_CONVERGED:
case CaptureResult.CONTROL_AE_STATE_FLASH_REQUIRED:
case CaptureResult.CONTROL_AE_STATE_LOCKED: {
+ // This check must be made regardless of whether the exposure state
+ // has changed recently to avoid infinite waiting during
+ // takePicture() when the algorithm has already converged.
if (mOneshotCaptureCallback != null) {
// A call to takePicture() was just made, and autoexposure
// converged so it's time to initiate the capture!