summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-10-15 14:01:23 -0700
committerIgor Murashkin <iam@google.com>2013-10-15 14:01:23 -0700
commitba7f02549047afd96f033eda9729592a7668e039 (patch)
treefe3cdb89e9f7673da1c2d03d5578f31480f36f0a
parent7705b0b80a3f432c59d1e1892ca3751e89508aed (diff)
downloadandroid_frameworks_ex-ba7f02549047afd96f033eda9729592a7668e039.tar.gz
android_frameworks_ex-ba7f02549047afd96f033eda9729592a7668e039.tar.bz2
android_frameworks_ex-ba7f02549047afd96f033eda9729592a7668e039.zip
camera2: Skip AF state updates when afMode/afState are missing
* Workaround for hal3 sometimes dropping afMode/afState (rarely) - don't update AF states, instead just skip this frame, safer and adds 1 frame of latency very rarely sometimes. * Assumes request is repeating, since otherwise we wouldn't get future af transition results Bug: 11238865 Change-Id: Ic793d8c6d44873f6a7983e84e4510b8587a148a0
-rw-r--r--camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java16
1 files changed, 14 insertions, 2 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 b2a55e4..cb636ea 100644
--- a/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
+++ b/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java
@@ -90,8 +90,20 @@ public class AutoFocusStateMachine {
*/
public synchronized void onCaptureCompleted(CaptureResult result) {
- int afState = result.get(CaptureResult.CONTROL_AF_STATE);
- int afMode = result.get(CaptureResult.CONTROL_AF_MODE);
+ Integer afState = result.get(CaptureResult.CONTROL_AF_STATE);
+ Integer afMode = result.get(CaptureResult.CONTROL_AF_MODE);
+
+ /**
+ * Work-around for b/11238865
+ * This is a HAL bug as these fields should be there always.
+ */
+ if (afState == null) {
+ Log.w(TAG, "onCaptureCompleted - missing android.control.afState !");
+ return;
+ } else if (afMode == null) {
+ Log.w(TAG, "onCaptureCompleted - missing android.control.afMode !");
+ return;
+ }
if (DEBUG_LOGGING) Log.d(TAG, "onCaptureCompleted - new AF mode = " + afMode +
" new AF state = " + afState);