summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/arrays.xml6
-rw-r--r--res/values/strings.xml5
-rw-r--r--src/com/android/camera/Camera.java26
-rw-r--r--src/com/android/camera/CameraSettings.java16
4 files changed, 46 insertions, 7 deletions
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 084f17e..53d9edb 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -75,9 +75,9 @@
</string-array>
<string-array name="pref_camera_jpegquality_entryvalues" translatable="false">
- <item>85</item>
- <item>75</item>
- <item>65</item>
+ <item>superfine</item>
+ <item>fine</item>
+ <item>normal</item>
</string-array>
<!-- Camera Preferences focus mode dialog box entries -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 3289d5a..40b148d 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -362,8 +362,9 @@
<!-- Settings screen, picture size dialog title -->
<string name="pref_camera_picturesize_dialogtitle">Picture size</string>
- <!-- Default picture quality setting.-->
- <string name="pref_camera_jpegquality_default" translatable="false">85</string>
+ <!-- Default picture quality setting. See
+ pref_camera_jpegquality_entryvalues for possible values -->
+ <string name="pref_camera_jpegquality_default" translatable="false">superfine</string>
<!-- Settings screen, Picture quality title -->
<string name="pref_camera_jpegquality_title">Picture quality</string>
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 30f427e..972476d 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -44,6 +44,7 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
+import android.os.SystemProperties;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.text.format.DateFormat;
@@ -874,6 +875,7 @@ public class Camera extends Activity implements View.OnClickListener,
mSurfaceView = (SurfaceView) findViewById(R.id.camera_preview);
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
+ CameraSettings.upgradePreferences(mPreferences);
/*
* To reduce startup time, we start the preview in another thread.
@@ -1726,7 +1728,7 @@ public class Camera extends Activity implements View.OnClickListener,
String jpegQuality = mPreferences.getString(
CameraSettings.KEY_JPEG_QUALITY,
getString(R.string.pref_camera_jpegquality_default));
- mParameters.setJpegQuality(Integer.parseInt(jpegQuality));
+ mParameters.setJpegQuality(getQualityNumber(jpegQuality));
// Set zoom.
if (mParameters.isZoomSupported()) {
@@ -2039,6 +2041,28 @@ public class Camera extends Activity implements View.OnClickListener,
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
mHandler.sendEmptyMessageDelayed(CLEAR_SCREEN_DELAY, SCREEN_DELAY);
}
+
+ private static String[] mQualityStrings = {"superfine", "fine", "normal"};
+ private static String[] mQualityNumbers = SystemProperties.get(
+ "ro.media.enc.jpeg.quality", "85,75,65").split(",");
+ private static int DEFAULT_QUALITY = 85;
+
+ // Translate from a quality string to a quality number using the system
+ // properties.
+ private static int getQualityNumber(String jpegQuality) {
+ // Find the index of the input string
+ int index = Util.indexOf(mQualityStrings, jpegQuality);
+
+ if (index == -1 || index > mQualityNumbers.length - 1) {
+ return DEFAULT_QUALITY;
+ }
+
+ try {
+ return Integer.parseInt(mQualityNumbers[index]);
+ } catch (NumberFormatException ex) {
+ return DEFAULT_QUALITY;
+ }
+ }
}
class FocusRectangle extends View {
diff --git a/src/com/android/camera/CameraSettings.java b/src/com/android/camera/CameraSettings.java
index e7d7d0e..9b106ff 100644
--- a/src/com/android/camera/CameraSettings.java
+++ b/src/com/android/camera/CameraSettings.java
@@ -37,7 +37,7 @@ public class CameraSettings {
"pref_camera_whitebalance_key";
public static final String KEY_SCENE_MODE = "pref_camera_scenemode_key";
- public static final int CURRENT_VERSION = 1;
+ public static final int CURRENT_VERSION = 2;
// max mms video duration in seconds.
public static final int MMS_VIDEO_DURATION =
@@ -249,6 +249,20 @@ public class CameraSettings {
if (pref.getString(KEY_VIDEO_DURATION, "1").equals("1")) {
editor.putString(KEY_VIDEO_DURATION, "10");
}
+ version = 1;
+ }
+ if (version == 1) {
+ // Change jpeg quality {65,75,85} to {normal,fine,superfine}
+ String quality = pref.getString(KEY_JPEG_QUALITY, "85");
+ if (quality.equals("65")) {
+ quality = "normal";
+ } else if (quality.equals("75")) {
+ quality = "fine";
+ } else {
+ quality = "superfine";
+ }
+ editor.putString(KEY_JPEG_QUALITY, quality);
+ version = 2;
}
editor.putInt(KEY_VERSION, CURRENT_VERSION);
editor.commit();