diff options
author | Yuichi Araki <yaraki@google.com> | 2014-12-05 03:00:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-05 03:00:11 +0000 |
commit | e394ec0126fa55cd1472e62a1051b6a4e41f435c (patch) | |
tree | d5b128b456761bf5920d2d4582491aa1ba3dfc28 /media | |
parent | c702dd8356c6f718a85a36ca5b691096570cfc1f (diff) | |
parent | 0132deb84c23bcfd49b283c5bf986fde5bd00348 (diff) | |
download | android-e394ec0126fa55cd1472e62a1051b6a4e41f435c.tar.gz |
Merge "Fix NPE on Nexus 4." into lmp-docs
Diffstat (limited to 'media')
-rw-r--r-- | media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java b/media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java index f4bf2207..4b553585 100644 --- a/media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java +++ b/media/Camera2Basic/Application/src/main/java/com/example/android/camera2basic/Camera2BasicFragment.java @@ -266,8 +266,10 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen int afState = result.get(CaptureResult.CONTROL_AF_STATE); if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState || CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) { - int aeState = result.get(CaptureResult.CONTROL_AE_STATE); - if (aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) { + // CONTROL_AE_STATE can be null on some devices + Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); + if (aeState == null || + aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) { mState = STATE_WAITING_NON_PRECAPTURE; captureStillPicture(); } else { @@ -277,17 +279,19 @@ public class Camera2BasicFragment extends Fragment implements View.OnClickListen break; } case STATE_WAITING_PRECAPTURE: { - int aeState = result.get(CaptureResult.CONTROL_AE_STATE); - if (CaptureResult.CONTROL_AE_STATE_PRECAPTURE == aeState) { - mState = STATE_WAITING_NON_PRECAPTURE; - } else if (CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED == aeState) { + // CONTROL_AE_STATE can be null on some devices + Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); + if (aeState == null || + aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE || + aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) { mState = STATE_WAITING_NON_PRECAPTURE; } break; } case STATE_WAITING_NON_PRECAPTURE: { - int aeState = result.get(CaptureResult.CONTROL_AE_STATE); - if (CaptureResult.CONTROL_AE_STATE_PRECAPTURE != aeState) { + // CONTROL_AE_STATE can be null on some devices + Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); + if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) { mState = STATE_PICTURE_TAKEN; captureStillPicture(); } |