diff options
author | mingwax <mingwax@codeaurora.org> | 2017-03-07 17:14:35 +0800 |
---|---|---|
committer | mingwax <mingwax@codeaurora.org> | 2017-03-07 19:48:14 +0800 |
commit | 3e03c54f44390e76111b0af9c295925b8dff9537 (patch) | |
tree | d0b7ee58f1609840a02b98d0ef788d163b53a606 /src | |
parent | fb7a974380cf55206f546ffba5ee58d9b607d409 (diff) | |
download | android_packages_apps_Snap-3e03c54f44390e76111b0af9c295925b8dff9537.tar.gz android_packages_apps_Snap-3e03c54f44390e76111b0af9c295925b8dff9537.tar.bz2 android_packages_apps_Snap-3e03c54f44390e76111b0af9c295925b8dff9537.zip |
SnapdragonCamera: Fix cancelTouchFocus only once
When the user click the screen many time for autoFocusTrigger,
ensure the cancelTouchFocus only execute once.
CRs-Fixed: 2005432
Change-Id: I16b027cbc42d4af2505c04d5c7ccbf1ce8487e9e
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/CaptureModule.java | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index db9feffb8..e8a00415a 100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -194,6 +194,10 @@ public class CaptureModule implements CameraModule, PhotoController, private static final int SCREEN_DELAY = 2 * 60 * 1000; + public static final boolean DEBUG = + (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_LOG) || + (PersistUtil.getCamera2Debug() == PersistUtil.CAMERA2_DEBUG_DUMP_ALL); + MeteringRectangle[][] mAFRegions = new MeteringRectangle[MAX_NUM_CAM][]; MeteringRectangle[][] mAERegions = new MeteringRectangle[MAX_NUM_CAM][]; CaptureRequest.Key<Byte> BayerMonoLinkEnableKey = @@ -1109,7 +1113,9 @@ public class CaptureModule implements CameraModule, PhotoController, if (!checkSessionAndBuilder(mCaptureSession[id], mPreviewRequestBuilder[id])) { return; } - Log.d(TAG, "setAFModeToPreview " + afMode); + if (DEBUG) { + Log.d(TAG, "setAFModeToPreview " + afMode); + } mPreviewRequestBuilder[id].set(CaptureRequest.CONTROL_AF_MODE, afMode); applyAFRegions(mPreviewRequestBuilder[id], id); applyAERegions(mPreviewRequestBuilder[id], id); @@ -1123,7 +1129,9 @@ public class CaptureModule implements CameraModule, PhotoController, } public void setFlashModeToPreview(int id, boolean isFlashOn) { - Log.d(TAG, "setFlashModeToPreview " + isFlashOn); + if (DEBUG) { + Log.d(TAG, "setFlashModeToPreview " + isFlashOn); + } if (!checkSessionAndBuilder(mCaptureSession[id], mPreviewRequestBuilder[id])) { return; } @@ -1352,7 +1360,9 @@ public class CaptureModule implements CameraModule, PhotoController, } private void autoFocusTrigger(int id) { - Log.d(TAG, "autoFocusTrigger " + id); + if (DEBUG) { + Log.d(TAG, "autoFocusTrigger " + id); + } if (null == mActivity || null == mCameraDevice[id] || !checkSessionAndBuilder(mCaptureSession[id], mPreviewRequestBuilder[id])) { warningToast("Camera is not ready yet to take a picture."); @@ -1368,8 +1378,7 @@ public class CaptureModule implements CameraModule, PhotoController, mState[id] = STATE_WAITING_TOUCH_FOCUS; mCaptureSession[id].capture(builder.build(), mCaptureCallback, mCameraHandler); setAFModeToPreview(id, mControlAFMode); - Message message = mCameraHandler.obtainMessage( - CANCEL_TOUCH_FOCUS, Integer.valueOf(mCameraId[id]), 0); + Message message = mCameraHandler.obtainMessage(CANCEL_TOUCH_FOCUS, mCameraId[id]); mCameraHandler.sendMessageDelayed(message, CANCEL_TOUCH_FOCUS_DELAY); } catch (CameraAccessException | IllegalStateException e) { e.printStackTrace(); @@ -1569,7 +1578,7 @@ public class CaptureModule implements CameraModule, PhotoController, } private void captureVideoSnapshot(final int id) { - Log.d(TAG, "captureStillPicture " + id); + Log.d(TAG, "captureVideoSnapshot " + id); try { if (null == mActivity || null == mCameraDevice[id] || mCurrentSession == null) { warningToast("Camera is not ready yet to take a video snapshot."); @@ -2665,7 +2674,9 @@ public class CaptureModule implements CameraModule, PhotoController, || !mAutoExposureRegionSupported || !isTouchToFocusAllowed()) { return; } - Log.d(TAG, "onSingleTapUp " + x + " " + y); + if (DEBUG) { + Log.d(TAG, "onSingleTapUp " + x + " " + y); + } int[] newXY = {x, y}; if (mUI.isOverControlRegion(newXY)) return; if (!mUI.isOverSurfaceView(newXY)) return; @@ -3852,7 +3863,9 @@ public class CaptureModule implements CameraModule, PhotoController, } public Rect cropRegionForZoom(int id) { - Log.d(TAG, "cropRegionForZoom " + id); + if (DEBUG) { + Log.d(TAG, "cropRegionForZoom " + id); + } Rect activeRegion = mSettingsManager.getSensorActiveArraySize(id); Rect cropRegion = new Rect(); @@ -4178,7 +4191,9 @@ public class CaptureModule implements CameraModule, PhotoController, } public void triggerFocusAtPoint(float x, float y, int id) { - Log.d(TAG, "triggerFocusAtPoint " + x + " " + y + " " + id); + if (DEBUG) { + Log.d(TAG, "triggerFocusAtPoint " + x + " " + y + " " + id); + } Point p = mUI.getSurfaceViewSize(); int width = p.x; int height = p.y; @@ -4192,6 +4207,9 @@ public class CaptureModule implements CameraModule, PhotoController, if(mPaused) return; + if (DEBUG) { + Log.v(TAG, "cancelTouchFocus " + id); + } mState[id] = STATE_PREVIEW; mControlAFMode = CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE; setAFModeToPreview(id, mControlAFMode); |