diff options
author | Owen Lin <owenlin@google.com> | 2009-10-13 22:48:50 -0700 |
---|---|---|
committer | Owen Lin <owenlin@google.com> | 2009-10-19 00:54:07 -0700 |
commit | 70fe12f4d0ba9c08be9e0f0bda75b172a21cf70a (patch) | |
tree | a554b203a6f499ff3a8088dd8bea103b6a1304ea /src | |
parent | 4916316bb9a2196cbf6cc63e531c0ce6786ed56a (diff) | |
download | packages_apps_LegacyCamera-70fe12f4d0ba9c08be9e0f0bda75b172a21cf70a.zip packages_apps_LegacyCamera-70fe12f4d0ba9c08be9e0f0bda75b172a21cf70a.tar.gz packages_apps_LegacyCamera-70fe12f4d0ba9c08be9e0f0bda75b172a21cf70a.tar.bz2 |
Fix the focus settings is incorrect when switch back to auto scene mode.
http://b/editIssue?id=2178247
Change-Id: Icbd4eb80b88027f538ddeb4a44316e2b2be911c9
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/Camera.java | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java index 13d0465..a23d155 100644 --- a/src/com/android/camera/Camera.java +++ b/src/com/android/camera/Camera.java @@ -117,7 +117,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, public static final String ZOOM_SPEED = "99"; private Parameters mParameters; - private Parameters mInitialParameters; + private Parameters mInitialParams; // The non-standard parameter strings to communicate with camera driver. // This will be removed in the future. @@ -985,7 +985,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, mSettings = new OnScreenSettings( findViewById(R.id.camera_preview)); CameraSettings helper = - new CameraSettings(this, mInitialParameters); + new CameraSettings(this, mInitialParams); mSettings.setPreferenceScreen(helper .getPreferenceScreen(R.xml.camera_preferences)); mSettings.setOnVisibilityChangedListener(this); @@ -1515,7 +1515,7 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private void ensureCameraDevice() throws CameraHardwareException { if (mCameraDevice == null) { mCameraDevice = CameraHolder.instance().open(); - mInitialParameters = mCameraDevice.getParameters(); + mInitialParams = mCameraDevice.getParameters(); } } @@ -1674,6 +1674,28 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, private void setCameraParameters() { mParameters = mCameraDevice.getParameters(); + // Since change scene mode may change supported values, + // Set scene mode first, + String sceneMode = mPreferences.getString( + CameraSettings.KEY_SCENE_MODE, + getString(R.string.pref_camera_scenemode_default)); + if (isSupported(sceneMode, mParameters.getSupportedSceneModes())) { + if (!mParameters.getSceneMode().equals(sceneMode)) { + mParameters.setSceneMode(sceneMode); + mCameraDevice.setParameters(mParameters); + + // Setting scene mode will change the settings of flash mode, white + // balance, and focus mode. So read back here, so that we know + // what're the settings + mParameters = mCameraDevice.getParameters(); + } + } else { + sceneMode = mParameters.getSceneMode(); + if (sceneMode == null) { + sceneMode = Parameters.SCENE_MODE_AUTO; + } + } + // Reset preview frame rate to the maximum because it may be lowered by // video camera application. List<Integer> frameRates = mParameters.getSupportedPreviewFrameRates(); @@ -1725,31 +1747,11 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, mParameters.setColorEffect(colorEffect); } - // Set scene mode. - String sceneMode = mPreferences.getString( - CameraSettings.KEY_SCENE_MODE, - getString(R.string.pref_camera_scenemode_default)); - if (isSupported(sceneMode, mParameters.getSupportedSceneModes())) { - mParameters.setSceneMode(sceneMode); - } else { - sceneMode = mParameters.getSceneMode(); - if (sceneMode == null) { - sceneMode = Parameters.SCENE_MODE_AUTO; - } - } - // If scene mode is set, we cannot set flash mode, white balance, and // focus mode, instead, we read it from driver String flashMode; String whiteBalance; - if (!Parameters.SCENE_MODE_AUTO.equals(sceneMode)) { - mCameraDevice.setParameters(mParameters); - - // Setting scene mode will change the settings of flash mode, white - // balance, and focus mode. So read back here, so that we know - // what's the settings - mParameters = mCameraDevice.getParameters(); flashMode = mParameters.getFlashMode(); whiteBalance = mParameters.getWhiteBalance(); mFocusMode = mParameters.getFocusMode(); @@ -1787,7 +1789,8 @@ public class Camera extends NoSearchActivity implements View.OnClickListener, whiteBalance = mPreferences.getString( CameraSettings.KEY_WHITE_BALANCE, getString(R.string.pref_camera_whitebalance_default)); - if (isSupported(whiteBalance, mParameters.getSupportedWhiteBalance())) { + if (isSupported(whiteBalance, + mParameters.getSupportedWhiteBalance())) { mParameters.setWhiteBalance(whiteBalance); } else { whiteBalance = mParameters.getWhiteBalance(); |