summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/VideoModule.java
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2016-02-28 17:20:23 +0000
committerSteve Kondik <shade@chemlab.org>2016-04-14 01:03:49 -0700
commit57799db3c1757618e00d331fe659ac4058624352 (patch)
treea60a979b8deaff75f98a57ff2c38cc718899e98a /src/com/android/camera/VideoModule.java
parenta78d012468101b86c3937c5d4c6cb6ef48d04745 (diff)
downloadandroid_packages_apps_Snap-57799db3c1757618e00d331fe659ac4058624352.tar.gz
android_packages_apps_Snap-57799db3c1757618e00d331fe659ac4058624352.tar.bz2
android_packages_apps_Snap-57799db3c1757618e00d331fe659ac4058624352.zip
Snap: Improve focusing
* Don't needlessly break touch-to-focus during various modes * Set focus parameters immediately for better UX Change-Id: I39b287562c3d2b62a1d5c8953577e366b11b8e15
Diffstat (limited to 'src/com/android/camera/VideoModule.java')
-rw-r--r--src/com/android/camera/VideoModule.java51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 5121a032f..6a1e3e326 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -96,6 +96,7 @@ public class VideoModule implements CameraModule,
private static final int SHOW_TAP_TO_SNAPSHOT_TOAST = 7;
private static final int SWITCH_CAMERA = 8;
private static final int SWITCH_CAMERA_START_ANIMATION = 9;
+ private static final int SET_FOCUS_RATIO = 10;
private static final int SCREEN_DELAY = 2 * 60 * 1000;
@@ -391,6 +392,11 @@ public class VideoModule implements CameraModule,
break;
}
+ case SET_FOCUS_RATIO: {
+ mUI.getFocusRing().setRadiusRatio((Float)msg.obj);
+ break;
+ }
+
default:
Log.v(TAG, "Unhandled message: " + msg.what);
break;
@@ -546,15 +552,27 @@ public class VideoModule implements CameraModule,
@Override
public void setFocusParameters() {
- if (mFocusAreaSupported)
- mParameters.setFocusAreas(mFocusManager.getFocusAreas());
- if (mMeteringAreaSupported)
- mParameters.setMeteringAreas(mFocusManager.getMeteringAreas());
+ updateCameraParametersFocus();
+ mCameraDevice.setParameters(mParameters);
+ }
+
+ private void updateCameraParametersFocus() {
setAutoExposureLockIfSupported();
setAutoWhiteBalanceLockIfSupported();
- if (mFocusAreaSupported || mMeteringAreaSupported) {
- mParameters.setFocusMode(mFocusManager.getFocusMode(true));
- mCameraDevice.setParameters(mParameters);
+ setFocusAreasIfSupported();
+ setMeteringAreasIfSupported();
+ mParameters.setFocusMode(mFocusManager.getFocusMode(true));
+ }
+
+ private void setFocusAreasIfSupported() {
+ if (mFocusAreaSupported) {
+ mParameters.setFocusAreas(mFocusManager.getFocusAreas());
+ }
+ }
+
+ private void setMeteringAreasIfSupported() {
+ if (mMeteringAreaSupported) {
+ mParameters.setMeteringAreas(mFocusManager.getMeteringAreas());
}
}
@@ -840,14 +858,22 @@ public class VideoModule implements CameraModule,
@Override
public void onAutoFocus(
boolean focused, CameraProxy camera) {
- Log.v(TAG, "AutoFocusCallback, mPaused=" + mPaused);
if (mPaused) return;
- //setCameraState(IDLE);
+ mCameraDevice.refreshParameters();
+ mFocusManager.setParameters(mCameraDevice.getParameters());
mFocusManager.onAutoFocus(focused, false);
}
}
+ @Override
+ public void setFocusRatio(float ratio) {
+ mHandler.removeMessages(SET_FOCUS_RATIO);
+ Message m = mHandler.obtainMessage(SET_FOCUS_RATIO);
+ m.obj = ratio;
+ mHandler.sendMessage(m);
+ }
+
private void readVideoPreferences() {
// The preference stores values from ListPreference and is thus string type for all values.
// We need to convert it to int manually.
@@ -2538,6 +2564,10 @@ public class VideoModule implements CameraModule,
mParameters.setPreviewFrameRate(mProfile.videoFrameRate);
}
+ // Set focus mode
+ mFocusManager.overrideFocusMode(null);
+ updateCameraParametersFocus();
+
forceFlashOffIfSupported(!mPreviewFocused);
videoWidth = mProfile.videoFrameWidth;
videoHeight = mProfile.videoFrameHeight;
@@ -2577,9 +2607,6 @@ public class VideoModule implements CameraModule,
mParameters.setZoom(mZoomValue);
}
- // Set focus mode
- mParameters.setFocusMode(mFocusManager.getFocusMode(true));
-
mParameters.set(CameraUtil.RECORDING_HINT, CameraUtil.TRUE);
// Enable video stabilization. Convenience methods not available in API