diff options
author | Jim Wilson <jwilson@cyngn.com> | 2015-11-23 12:52:09 -0800 |
---|---|---|
committer | Bruno Martins <bgcngm@gmail.com> | 2018-11-20 12:31:36 +0000 |
commit | 6a070ca29fb8b6744fbe319cecd2fa5d39fb696c (patch) | |
tree | ffac5b7d0541e4a633358b0428aa10093b337988 /src/com/android/camera | |
parent | 9bb3bc11bb77ec511f96b348256939c15ba1dd11 (diff) | |
download | android_packages_apps_Snap-6a070ca29fb8b6744fbe319cecd2fa5d39fb696c.tar.gz android_packages_apps_Snap-6a070ca29fb8b6744fbe319cecd2fa5d39fb696c.tar.bz2 android_packages_apps_Snap-6a070ca29fb8b6744fbe319cecd2fa5d39fb696c.zip |
CameraNext: Update focus behavior for panoramas
Panorama was using Infinity for the focus mode all the time for
panoramas. Change to use continuous-picture in viewfinder before
the actual mosaic is started then change to fixed to lock in.
This allows indoor panoramas to not suck.
Change-Id: Ida01ca1ded1e1058d76da851cd20e5b7072e15be
(cherry picked from commit 33ece020c28796f004f28843fda28092e315c9dc)
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java index 77f724606..2e1e8fe08 100644 --- a/src/com/android/camera/WideAnglePanoramaModule.java +++ b/src/com/android/camera/WideAnglePanoramaModule.java @@ -125,10 +125,6 @@ public class WideAnglePanoramaModule private float mHorizontalViewAngle; private float mVerticalViewAngle; - // Prefer FOCUS_MODE_INFINITY to FOCUS_MODE_CONTINUOUS_VIDEO because of - // getting a better image quality by the former. - private String mTargetFocusMode = Parameters.FOCUS_MODE_INFINITY; - private PanoOrientationEventListener mOrientationEventListener; // The value could be 0, 90, 180, 270 for the 4 different orientations measured in clockwise // respectively. @@ -471,12 +467,13 @@ public class WideAnglePanoramaModule parameters.setPreviewFpsRange(minFps, maxFps); Log.d(TAG, "preview fps: " + minFps + ", " + maxFps); + // use CAF for viewfinder until starting the real mosaic, then lock List<String> supportedFocusModes = parameters.getSupportedFocusModes(); - if (supportedFocusModes.indexOf(mTargetFocusMode) >= 0) { - parameters.setFocusMode(mTargetFocusMode); + if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) >= 0) { + parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); } else { // Use the default focus mode and log a message - Log.w(TAG, "Cannot set the focus mode to " + mTargetFocusMode + + Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_CONTINUOUS_PICTURE + " becuase the mode is not supported."); } @@ -574,15 +571,25 @@ public class WideAnglePanoramaModule public void startCapture() { // Reset values so we can do this again. + + Parameters parameters = mCameraDevice.getParameters(); + List<String> supportedFocusModes = parameters.getSupportedFocusModes(); + if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_FIXED) >= 0) { + parameters.setFocusMode(Parameters.FOCUS_MODE_FIXED); + } else { + // Use the default focus mode and log a message + Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_FIXED + + " becuase the mode is not supported."); + } + parameters.setAutoExposureLock(true); + parameters.setAutoWhiteBalanceLock(true); + configureCamera(parameters); + mCancelComputation = false; mTimeTaken = System.currentTimeMillis(); mActivity.setSwipingEnabled(false); mCaptureState = CAPTURE_STATE_MOSAIC; mUI.onStartCapture(); - Parameters parameters = mCameraDevice.getParameters(); - parameters.setAutoExposureLock(true); - parameters.setAutoWhiteBalanceLock(true); - configureCamera(parameters); final int sweepAngle = (mDeviceOrientation == 90 || mDeviceOrientation == 270) ? DEFAULT_SWEEP_ANGLE_LANDSCAPE : DEFAULT_SWEEP_ANGLE_PORTRAIT; @@ -634,6 +641,14 @@ public class WideAnglePanoramaModule Parameters parameters = mCameraDevice.getParameters(); parameters.setAutoExposureLock(false); parameters.setAutoWhiteBalanceLock(false); + List<String> supportedFocusModes = parameters.getSupportedFocusModes(); + if (supportedFocusModes.indexOf(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) >= 0) { + parameters.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE); + } else { + // Use the default focus mode and log a message + Log.w(TAG, "Cannot set the focus mode to " + Parameters.FOCUS_MODE_CONTINUOUS_PICTURE + + " becuase the mode is not supported."); + } configureCamera(parameters); mMosaicFrameProcessor.setProgressListener(null); |