diff options
author | Angus Kong <shkong@google.com> | 2011-09-26 15:36:08 +0800 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2011-09-26 15:36:08 +0800 |
commit | cfcb0b746106900c9233f9bf51843f82d50f9d20 (patch) | |
tree | 1673d838e43307566efec42ed8eb00c73dff4c48 | |
parent | bb8faa4a072bc3b5af93ab080dc1511dd734d32f (diff) | |
download | LegacyCamera-cfcb0b746106900c9233f9bf51843f82d50f9d20.zip LegacyCamera-cfcb0b746106900c9233f9bf51843f82d50f9d20.tar.gz LegacyCamera-cfcb0b746106900c9233f9bf51843f82d50f9d20.tar.bz2 |
Fix the bug that local preference is not reset.
bug:5366049
Change-Id: Ifee52c43c7c2ec8ff674fca8ce7762cc489c1b6a
-rw-r--r-- | src/com/android/camera/CameraSettings.java | 23 | ||||
-rw-r--r-- | src/com/android/camera/VideoCamera.java | 11 |
2 files changed, 9 insertions, 25 deletions
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java index a974402..9c3104b 100644 --- a/src/com/android/camera/CameraSettings.java +++ b/src/com/android/camera/CameraSettings.java @@ -55,7 +55,7 @@ public class CameraSettings { public static final String EXPOSURE_DEFAULT_VALUE = "0"; public static final int CURRENT_VERSION = 5; - public static final int CURRENT_LOCAL_VERSION = 1; + public static final int CURRENT_LOCAL_VERSION = 2; public static final int DEFAULT_VIDEO_DURATION = 0; // no limit @@ -84,14 +84,7 @@ public class CameraSettings { public static String getDefaultVideoQuality(int cameraId, String defaultQuality) { - int quality = -1; - try { - quality = Integer.valueOf(defaultQuality); - } catch(NumberFormatException e) { - Log.e(TAG, "Cannot convert default quality setting '" - + defaultQuality - + "' into CamcorderProfile quality. Using fallback"); - } + int quality = Integer.valueOf(defaultQuality); if (CamcorderProfile.hasProfile(cameraId, quality)) { return defaultQuality; } @@ -305,7 +298,13 @@ public class CameraSettings { version = 0; } if (version == CURRENT_LOCAL_VERSION) return; + SharedPreferences.Editor editor = pref.edit(); + if (version == 1) { + // We use numbers to represent the quality now. The quality definition is identical to + // that of CamcorderProfile.java. + editor.remove("pref_video_quality_key"); + } editor.putInt(KEY_LOCAL_VERSION, CURRENT_LOCAL_VERSION); editor.apply(); } @@ -350,12 +349,6 @@ public class CameraSettings { // ignore the current settings. editor.remove("pref_camera_videoquality_key"); editor.remove("pref_camera_video_duration_key"); - version = 4; - } - if (version == 4) { - // We use numbers to represent the quality now. The quality definition is identical to - // that of CamcorderProfile.java. - editor.remove("pref_video_quality_key"); } editor.putInt(KEY_VERSION, CURRENT_VERSION); diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java index 963618e..a95ef27 100644 --- a/src/com/android/camera/VideoCamera.java +++ b/src/com/android/camera/VideoCamera.java @@ -650,16 +650,7 @@ public class VideoCamera extends ActivityBase String videoQuality = mPreferences.getString(CameraSettings.KEY_VIDEO_QUALITY, defaultQuality); - int quality = 0; - try { - quality = Integer.valueOf(videoQuality); - } catch (NumberFormatException e) { - Log.e(TAG, "Cannot convert quality setting '" - + videoQuality + "' into CamcorderProfile quality." - + " Reverting to default."); - // Conversion guaranteed by getDefaultVideoQuality - quality = Integer.valueOf(defaultQuality); - } + int quality = Integer.valueOf(videoQuality); // Set video quality. Intent intent = getIntent(); |