summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhijun He <zhijunhe@google.com>2013-10-30 02:07:56 (GMT)
committerZhijun He <zhijunhe@google.com>2013-11-06 22:24:38 (GMT)
commitd4429271623c05376ee1445d13fde9bcf76a0033 (patch)
treec47c42d6193dad891d07cb159d37ba1d993bf520
parent2d8e55f45e52ac0b18c0e46de602e6a6d5ab1001 (diff)
downloadandroid_frameworks_ex-d4429271623c05376ee1445d13fde9bcf76a0033.zip
android_frameworks_ex-d4429271623c05376ee1445d13fde9bcf76a0033.tar.gz
android_frameworks_ex-d4429271623c05376ee1445d13fde9bcf76a0033.tar.bz2
camera2: Add updateCaptureRequest method
It can be used to update repeating request with current auto focus mode. Bug: 10649854 Change-Id: I5e92218c61dea04990581d37f92bf25a1f8dbe91
-rw-r--r--camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java21
1 files changed, 21 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..a2bf703 100644
--- a/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
+++ b/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
@@ -346,4 +346,25 @@ public class AutoFocusStateMachine {
SysTrace.endSectionAsync(mCurrentAfTrace, mCurrentAfCookie);
mCurrentAfCookie = AF_UNINITIALIZED;
}
+
+ /**
+ * Update the repeating request with current focus mode.
+ *
+ * <p>This is typically used when a new repeating request is created to update preview with
+ * new metadata (i.e. crop region). The current auto focus mode needs to be carried over for
+ * correct auto focus behavior.<p>
+ *
+ * @param repeatingBuilder Builder for a repeating request.
+ */
+ public synchronized void updateCaptureRequest(CaptureRequest.Builder repeatingBuilder) {
+ if (repeatingBuilder == null) {
+ throw new IllegalArgumentException("repeatingBuilder shouldn't be null");
+ }
+
+ if (mCurrentAfMode == AF_UNINITIALIZED) {
+ throw new IllegalStateException("AF mode was not enabled");
+ }
+
+ repeatingBuilder.set(CaptureRequest.CONTROL_AF_MODE, mCurrentAfMode);
+ }
}