diff options
author | Camera Software Integration <camswint@localhost> | 2016-06-20 01:38:38 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-06-20 01:38:38 -0700 |
commit | 8b94869670e9907ff23776b790b7925b31725d4a (patch) | |
tree | b2d3aaf0cdaa35bdc635d31d2d8a78bc73cff598 /src/com/android/camera/CaptureModule.java | |
parent | 3480ca62eadf4b30cbf88b5f7f751459089826d6 (diff) | |
parent | 08d9641024101f8a6edecb4eb1ffc15ca1cf011a (diff) | |
download | android_packages_apps_Snap-8b94869670e9907ff23776b790b7925b31725d4a.tar.gz android_packages_apps_Snap-8b94869670e9907ff23776b790b7925b31725d4a.tar.bz2 android_packages_apps_Snap-8b94869670e9907ff23776b790b7925b31725d4a.zip |
Merge "SnapdragonCamera: Fix savepath set to SD card crash" into camera.lnx.1.0-dev.1.0
Diffstat (limited to 'src/com/android/camera/CaptureModule.java')
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index 9d09343ea..2b28f9946 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -226,6 +226,7 @@ public class CaptureModule implements CameraModule, PhotoController, private boolean mFirstPreviewLoaded; private int[] mPrecaptureRequestHashCode = new int[MAX_NUM_CAM]; private int[] mLockRequestHashCode = new int[MAX_NUM_CAM]; + private final Handler mHandler = new MainHandler(); private class MediaSaveNotifyThread extends Thread { private Uri uri; @@ -340,7 +341,7 @@ public class CaptureModule implements CameraModule, PhotoController, private CameraCaptureSession.CaptureCallback mCaptureCallback = new CameraCaptureSession.CaptureCallback() { - private void process(CaptureResult result) { + private void updateState(CaptureResult result) { int id = (int) result.getRequest().getTag(); if (!mFirstPreviewLoaded) { @@ -420,7 +421,6 @@ public class CaptureModule implements CameraModule, PhotoController, CaptureResult partialResult) { int id = (int) partialResult.getRequest().getTag(); if (id == getMainCameraId()) updateFocusStateChange(partialResult); - process(partialResult); } @Override @@ -429,7 +429,7 @@ public class CaptureModule implements CameraModule, PhotoController, TotalCaptureResult result) { int id = (int) result.getRequest().getTag(); if (id == getMainCameraId()) updateFocusStateChange(result); - process(result); + updateState(result); } }; @@ -1438,7 +1438,12 @@ public class CaptureModule implements CameraModule, PhotoController, initializeSecondTime(); } mUI.reInitUI(); - mActivity.updateStorageSpaceAndHint(); + mHandler.post(new Runnable() { + @Override + public void run() { + mActivity.updateStorageSpaceAndHint(); + } + }); estimateJpegFileSize(); mUI.enableShutter(true); } @@ -2117,7 +2122,8 @@ public class CaptureModule implements CameraModule, PhotoController, } private void updateFocusStateChange(CaptureResult result) { - final int resultAFState = result.get(CaptureResult.CONTROL_AF_STATE); + final Integer resultAFState = result.get(CaptureResult.CONTROL_AF_STATE); + if (resultAFState == null) return; // Report state change when AF state has changed. if (resultAFState != mLastResultAFState && mFocusStateListener != null) { @@ -2335,4 +2341,14 @@ public class CaptureModule implements CameraModule, PhotoController, unlockFocus(BAYER_ID); unlockFocus(MONO_ID); } + + /** + * This Handler is used to post message back onto the main thread of the + * application + */ + private class MainHandler extends Handler { + public MainHandler() { + super(Looper.getMainLooper()); + } + } } |