aboutsummaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorYuichi Araki <yaraki@google.com>2014-12-05 03:00:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-05 03:00:11 +0000
commite394ec0126fa55cd1472e62a1051b6a4e41f435c (patch)
treed5b128b456761bf5920d2d4582491aa1ba3dfc28 /media
parentc702dd8356c6f718a85a36ca5b691096570cfc1f (diff)
parent0132deb84c23bcfd49b283c5bf986fde5bd00348 (diff)
downloadandroid-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.java20
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();
}