summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-05-23 16:19:08 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-25 21:55:20 -0700
commit1b7611b2f3881354d0d0c201ba734ae83e442092 (patch)
treece6e71b487a5c6782f022c732a4e757e77c41ec2
parenteb2e8a2a4da18f97462ca7f67429a135d2dc2df5 (diff)
downloadandroid_packages_apps_Snap-1b7611b2f3881354d0d0c201ba734ae83e442092.tar.gz
android_packages_apps_Snap-1b7611b2f3881354d0d0c201ba734ae83e442092.tar.bz2
android_packages_apps_Snap-1b7611b2f3881354d0d0c201ba734ae83e442092.zip
SnapdragonCamera: Fix savepath set to SD card crash
Fix crash issue when fix savepath is set to SD card and the app is restarted. This is due to not updating storage information. When the module starts up, we need to call storage update so that it will set to proper initial value, not causing crash. Also only update focus UI when AF state is not null. Change-Id: I1a3e444b42eb988ed622d047b1f3dc42bec7a119 CRs-Fixed: 1018118
-rw-r--r--src/com/android/camera/CaptureModule.java26
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());
+ }
+ }
}