summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java51
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();