summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorByunghun Jeon <bjeon@codeaurora.org>2016-05-23 16:19:08 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-21 18:45:51 -0700
commit2c9880b907f5a58800e8c48c13897e611a2efe48 (patch)
treed7f98c411bc96146fd1371fbe4f91fce40d6bf05 /src/com
parent7f35afc3939acbffeff32c2e419d1e46648fba4c (diff)
downloadandroid_packages_apps_Snap-2c9880b907f5a58800e8c48c13897e611a2efe48.tar.gz
android_packages_apps_Snap-2c9880b907f5a58800e8c48c13897e611a2efe48.tar.bz2
android_packages_apps_Snap-2c9880b907f5a58800e8c48c13897e611a2efe48.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
Diffstat (limited to 'src/com')
-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());
+ }
+ }
}