From 8481d34d0ac0027703343baf9e5411e663b48235 Mon Sep 17 00:00:00 2001 From: dianlujitao Date: Wed, 20 Nov 2019 11:38:21 +0800 Subject: Snap: Perform null check on AF state in updateCaptureStateMachine * Some camera HAL implementations don't push AF state to urgent metadata. E.g. for QCOM camera HAL this happens only after https://source.codeaurora.org/quic/la/platform/hardware/qcom/camera/commit/?h=LA.UM.7.2.r1-07700-sdm660.0&id=d276a953295364b967c36038362c1e7ea268bdad * Fix crash on capture after c724bc35a9c5f3b36ce36a2081559e2644993da4 Change-Id: I8980fd3fb7d7db4f61189281580ecb17778602df --- src/com/android/camera/CaptureModule.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 5cc20e03f..5cd971598 100755 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -1033,6 +1033,11 @@ public class CaptureModule implements CameraModule, PhotoController, private void updateCaptureStateMachine(int id, CaptureResult result) { Integer afState = result.get(CaptureResult.CONTROL_AF_STATE); Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); + + if (afState == null) { + return; + } + switch (mState[id]) { case STATE_PREVIEW: { break; -- cgit v1.2.3