diff options
-rw-r--r-- | camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java | 24 |
1 files changed, 24 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 cb636ea..5b11c2b 100644 --- a/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java +++ b/camera2/public/src/com/android/ex/camera2/pos/AutoFocusStateMachine.java @@ -16,6 +16,7 @@ package com.android.ex.camera2.pos; import android.hardware.camera2.CameraDevice; +import android.hardware.camera2.CameraMetadata.Key; import android.hardware.camera2.CaptureRequest; import android.hardware.camera2.CaptureResult; import android.util.Log; @@ -90,6 +91,29 @@ public class AutoFocusStateMachine { */ public synchronized void onCaptureCompleted(CaptureResult result) { + /** + * Work-around for b/11269834 + * Although these should never-ever happen, harden for ship + */ + if (result == null) { + Log.w(TAG, "onCaptureCompleted - missing result, skipping AF update"); + return; + } + + Key<Integer> keyAfState = CaptureResult.CONTROL_AF_STATE; + if (keyAfState == null) { + Log.e(TAG, "onCaptureCompleted - missing android.control.afState key, " + + "skipping AF update"); + return; + } + + Key<Integer> keyAfMode = CaptureResult.CONTROL_AF_MODE; + if (keyAfMode == null) { + Log.e(TAG, "onCaptureCompleted - missing android.control.afMode key, " + + "skipping AF update"); + return; + } + Integer afState = result.get(CaptureResult.CONTROL_AF_STATE); Integer afMode = result.get(CaptureResult.CONTROL_AF_MODE); |