diff options
author | Senpo Hu <senpo@google.com> | 2014-09-25 18:21:58 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-25 18:21:58 +0000 |
commit | 437fd924f0bcffafa9aafcb719e233c68d81042b (patch) | |
tree | 79e39e7ab56d74b259273c51cc6991354f0fdbf3 | |
parent | 3f8c75b21820b64551a3226ab71bdb7707b286f9 (diff) | |
parent | ee3123ba4b4cc107423441bb8d687c14a2dc4b9a (diff) | |
download | android_packages_apps_Camera2-437fd924f0bcffafa9aafcb719e233c68d81042b.tar.gz android_packages_apps_Camera2-437fd924f0bcffafa9aafcb719e233c68d81042b.tar.bz2 android_packages_apps_Camera2-437fd924f0bcffafa9aafcb719e233c68d81042b.zip |
am ee3123ba: Stability: add null check for all CameraProxy obj references in PhotoModule.
* commit 'ee3123ba4b4cc107423441bb8d687c14a2dc4b9a':
Stability: add null check for all CameraProxy obj references in PhotoModule.
-rw-r--r-- | src/com/android/camera/PhotoModule.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java index 7afa9156e..43103080a 100644 --- a/src/com/android/camera/PhotoModule.java +++ b/src/com/android/camera/PhotoModule.java @@ -749,7 +749,9 @@ public class PhotoModule CameraCapabilities.SceneMode.AUTO)); } updateParametersSceneMode(); - mCameraDevice.applySettings(mCameraSettings); + if (mCameraDevice != null) { + mCameraDevice.applySettings(mCameraSettings); + } updateSceneMode(); } } @@ -906,7 +908,7 @@ public class PhotoModule @Override public void startFaceDetection() { - if (mFaceDetectionStarted) { + if (mFaceDetectionStarted || mCameraDevice == null) { return; } if (mCameraCapabilities.getMaxNumOfFacesSupported() > 0) { @@ -920,7 +922,7 @@ public class PhotoModule @Override public void stopFaceDetection() { - if (!mFaceDetectionStarted) { + if (!mFaceDetectionStarted || mCameraDevice == null) { return; } if (mCameraCapabilities.getMaxNumOfFacesSupported() > 0) { @@ -1970,7 +1972,7 @@ public class PhotoModule // eventually recurse back into startPreview(). // To avoid calling startPreview() twice, we must acquire // mStartPreviewLock. - if (mStartPreviewLock) { + if (mStartPreviewLock || mCameraDevice == null) { // do nothing return; } @@ -2155,6 +2157,10 @@ public class PhotoModule } private void updateParametersPictureSize() { + if (mCameraDevice == null) { + return; + } + SettingsManager settingsManager = mActivity.getSettingsManager(); String pictureSizeKey = isCameraFrontFacing() ? Keys.KEY_PICTURE_SIZE_FRONT : Keys.KEY_PICTURE_SIZE_BACK; @@ -2284,6 +2290,9 @@ public class PhotoModule @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void updateAutoFocusMoveCallback() { + if (mCameraDevice == null) { + return; + } if (mCameraSettings.getCurrentFocusMode() == CameraCapabilities.FocusMode.CONTINUOUS_PICTURE) { mCameraDevice.setAutoFocusMoveCallback(mHandler, @@ -2327,8 +2336,6 @@ public class PhotoModule updateCameraParametersPreference(); } - // some monkey tests can get here when shutting the app down - // make sure mCameraDevice is still valid, b/17604028 if (mCameraDevice != null) { mCameraDevice.applySettings(mCameraSettings); } |