summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2017-11-14 13:44:42 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-11-15 18:57:17 -0800
commit1fa22656c1fe62782d287f9427d8e56fbddee8fd (patch)
tree4ebbafe0412b8f6935b4669943060cb544bf8095 /src/com/android
parent067d85f08851d08994d4a83865529d88cb6c333e (diff)
downloadandroid_packages_apps_Snap-1fa22656c1fe62782d287f9427d8e56fbddee8fd.tar.gz
android_packages_apps_Snap-1fa22656c1fe62782d287f9427d8e56fbddee8fd.tar.bz2
android_packages_apps_Snap-1fa22656c1fe62782d287f9427d8e56fbddee8fd.zip
SnapdragonCamera: Fix AF not work when lunch again after touch AF
1. send request from setting only when change value manually 2. init the value "mLastAFmode" by sharepreference Change-Id: I5840b1b3506fa013ac040f4f911a1b8a281c969a CRs-Fixed: 2135175
Diffstat (limited to 'src/com/android')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 3cff8aad1..7dd2e59ff 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -262,6 +262,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private boolean[] mTakingPicture = new boolean[MAX_NUM_CAM];
private int mControlAFMode = CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
+ private int mLastAFmode = -1;
private int mLastResultAFState = -1;
private Rect[] mCropRegion = new Rect[MAX_NUM_CAM];
private boolean mAutoFocusRegionSupported;
@@ -1235,6 +1236,10 @@ public class CaptureModule implements CameraModule, PhotoController,
mSettingsManager = SettingsManager.getInstance();
mSettingsManager.registerListener(this);
mSettingsManager.init();
+ String value = mSettingsManager.getValue(SettingsManager.KEY_AF_MODE);
+ if (value != null) {
+ mLastAFmode = Integer.parseInt(value);
+ }
mFirstPreviewLoaded = false;
Log.d(TAG, "init");
for (int i = 0; i < MAX_NUM_CAM; i++) {
@@ -2128,7 +2133,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private void applyCommonSettings(CaptureRequest.Builder builder, int id) {
builder.set(CaptureRequest.CONTROL_MODE, CaptureRequest.CONTROL_MODE_AUTO);
- builder.set(CaptureRequest.CONTROL_AF_MODE, mControlAFMode);
+ applyAfModes(builder);
applyFaceDetection(builder);
applyWhiteBalance(builder);
applyExposure(builder);
@@ -2140,7 +2145,6 @@ public class CaptureModule implements CameraModule, PhotoController,
applySaturationLevel(builder);
applyAntiBandingLevel(builder);
applySharpnessControlModes(builder);
- applyAfModes(builder);
applyExposureMeteringModes(builder);
applyHistogram(builder);
}
@@ -4037,10 +4041,19 @@ public class CaptureModule implements CameraModule, PhotoController,
private void applyAfModes(CaptureRequest.Builder request) {
String value = mSettingsManager.getValue(SettingsManager.KEY_AF_MODE);
+ int intValue = mLastAFmode;
if (value != null) {
- int intValue = Integer.parseInt(value);
+ intValue = Integer.parseInt(value);
+ }
+ if (mLastAFmode != intValue && -1 != mLastAFmode) {
+ // means afmode value changed manually
request.set(CaptureRequest.CONTROL_AF_MODE, intValue);
+ mControlAFMode = intValue;
+ } else {
+ request.set(CaptureRequest.CONTROL_AF_MODE, mControlAFMode);
+ mSettingsManager.setValue(SettingsManager.KEY_AF_MODE, String.valueOf(mControlAFMode));
}
+ mLastAFmode = mControlAFMode;
}
private void applyExposureMeteringModes(CaptureRequest.Builder request) {