summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-11-12 22:46:37 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-11-12 22:46:37 -0800
commitb2905d069c66c9dfcbd52da446658359359d2df3 (patch)
tree1f9b7ba6c1aad9f6082ca22ddea9ad647670985e /src
parente9aabb7cafb7d22063af963aeaf8c0fe0e9a2294 (diff)
parent8e52de424b448f4c145c1ead8a06d5e4b6603bf3 (diff)
downloadandroid_packages_apps_Snap-b2905d069c66c9dfcbd52da446658359359d2df3.tar.gz
android_packages_apps_Snap-b2905d069c66c9dfcbd52da446658359359d2df3.tar.bz2
android_packages_apps_Snap-b2905d069c66c9dfcbd52da446658359359d2df3.zip
Merge changes I23def159,Ic824361c into camera-SnapdragonCamera.lnx.2.0
* changes: Avoid changing afmode when trigger TAF Fix isDepthFocus can't be read in one of every two frames
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index f66cd5b35..2c7b4de34 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -545,7 +545,7 @@ public class CaptureModule implements CameraModule, PhotoController,
private static final int STATS_DATA = 768;
public static int statsdata[] = new int[STATS_DATA];
- public static int statsview_scale = 1;
+ private boolean mInTAF = false;
// BG stats
private static final int BGSTATS_DATA = 64*48;
@@ -2075,6 +2075,7 @@ public class CaptureModule implements CameraModule, PhotoController,
if (null == mActivity || null == mCameraDevice[id]
|| !checkSessionAndBuilder(mCaptureSession[id], mPreviewRequestBuilder[id])) {
warningToast("Camera is not ready yet to take a picture.");
+ mInTAF = false;
return;
}
try {
@@ -2084,6 +2085,7 @@ public class CaptureModule implements CameraModule, PhotoController,
mControlAFMode = CaptureRequest.CONTROL_AF_MODE_AUTO;
applySettingsForAutoFocus(builder, id);
+ builder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_AUTO);
mState[id] = STATE_WAITING_TOUCH_FOCUS;
applyFlash(builder, id);//apply flash mode and AEmode for this temp builder
mCaptureSession[id].capture(builder.build(), mCaptureCallback, mCameraHandler);
@@ -3751,9 +3753,8 @@ public class CaptureModule implements CameraModule, PhotoController,
mUI.setFocusPosition(x, y);
x = newXY[0];
y = newXY[1];
- if (!mIsDepthFocus) {
- mUI.onFocusStarted();
- }
+ mInTAF = true;
+ mUI.onFocusStarted();
if (isBackCamera()) {
switch (getCameraMode()) {
case DUAL_MODE:
@@ -6353,6 +6354,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
if (mCropRegion[id] == null) {
Log.d(TAG, "crop region is null at " + id);
+ mInTAF = false;
return;
}
Point p = mUI.getSurfaceViewSize();
@@ -6382,6 +6384,7 @@ public class CaptureModule implements CameraModule, PhotoController,
if (DEBUG) {
Log.v(TAG, "cancelTouchFocus " + id);
}
+ mInTAF = false;
mState[id] = STATE_PREVIEW;
mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE;
setAFModeToPreview(id, mControlAFMode);
@@ -6436,31 +6439,33 @@ public class CaptureModule implements CameraModule, PhotoController,
}
private void updateFocusStateChange(CaptureResult result) {
- final Integer resultAFState = result.get(CaptureResult.CONTROL_AF_STATE);
+ Integer resultAFState = result.get(CaptureResult.CONTROL_AF_STATE);
if (resultAFState == null) return;
try {
Byte isDepthFocus = result.get(CaptureModule.is_depth_focus);
- if(DEBUG) Log.d(TAG, "isDepthFocus is " + isDepthFocus);
- if (isDepthFocus != null && isDepthFocus == 1) {
- mIsDepthFocus = true;
- } else {
- mIsDepthFocus = false;
+ if (isDepthFocus != null) {
+ if (isDepthFocus == 1) {
+ mIsDepthFocus = true;
+ } else {
+ mIsDepthFocus = false;
+ }
}
+ if(DEBUG) Log.d(TAG, "isDepthFocus is " + mIsDepthFocus + ", inTAF is " + mInTAF);
} catch (IllegalArgumentException e) {
mIsDepthFocus = false;
if (DEBUG) e.printStackTrace();
}
- // If focus started then don't return
- if (mIsDepthFocus && mLastResultAFState == CaptureResult.CONTROL_AF_STATE_INACTIVE) {
- return;
+ if (mIsDepthFocus && !mInTAF) {
+ resultAFState = CaptureResult.CONTROL_AF_STATE_INACTIVE;
}
+ final Integer afState = resultAFState;
// Report state change when AF state has changed.
if (resultAFState != mLastResultAFState && mFocusStateListener != null) {
mActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
- mFocusStateListener.onFocusStatusUpdate(resultAFState);
+ mFocusStateListener.onFocusStatusUpdate(afState);
}
});
}