summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-11-06 12:09:53 -0800
committerIgor Murashkin <iam@google.com>2013-11-06 12:09:53 -0800
commite2fa3d7185929f5e51a851d23db2618a41f18d9d (patch)
tree77f7cd3df2a3de9b1e23670c0b2ea957a2de22e0
parent2d8e55f45e52ac0b18c0e46de602e6a6d5ab1001 (diff)
downloadandroid_frameworks_ex-e2fa3d7185929f5e51a851d23db2618a41f18d9d.tar.gz
android_frameworks_ex-e2fa3d7185929f5e51a851d23db2618a41f18d9d.tar.bz2
android_frameworks_ex-e2fa3d7185929f5e51a851d23db2618a41f18d9d.zip
camera2: Add #resetState to AutoFocusStateMachine
Bug: 11071158 Change-Id: I24bc2d771703bb502dcbb676b6262954f2017630
-rw-r--r--camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java b/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
index ce66285..23959e4 100644
--- a/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
+++ b/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
@@ -31,6 +31,10 @@ import com.android.ex.camera2.utils.SysTrace;
*/
public class AutoFocusStateMachine {
+ /**
+ * Observe state AF state transitions triggered by
+ * {@link AutoFocusStateMachine#onCaptureCompleted onCaptureCompleted}.
+ */
public interface AutoFocusStateListener {
/**
* The camera is currently focused (either active or passive).
@@ -177,6 +181,22 @@ public class AutoFocusStateMachine {
}
/**
+ * Reset the current AF state.
+ *
+ * <p>
+ * When dropping capture results (by not invoking {@link #onCaptureCompleted} when a new
+ * {@link CaptureResult} is available), call this function to reset the state. Otherwise
+ * the next time a new state is observed this class may incorrectly consider it as the same
+ * state as before, and not issue any callbacks by {@link AutoFocusStateListener}.
+ * </p>
+ */
+ public synchronized void resetState() {
+ if (VERBOSE_LOGGING) Log.v(TAG, "resetState - last state was " + mLastAfState);
+
+ mLastAfState = AF_UNINITIALIZED;
+ }
+
+ /**
* Lock the lens from moving. Typically used before taking a picture.
*
* <p>After calling this function, submit the new requestBuilder as a separate capture.