--- a/packages/apps/Camera2/res/values-en-rGB/strings.xml
+++ b/packages/apps/Camera2/res/values-en-rGB/strings.xml
@@ -96,6 +96,7 @@
<string name="pref_camera_picturesize_title" msgid="686045304547541815">"Picture size"</string>
<string name="pref_camera_previewsize_title" msgid="686045304547541816">"Preview size"</string>
<string name="pref_camera_previeworientation_title" msgid="686045304547541817">"Preview orientation"</string>
+ <string name="pref_camera_pictureorientation_title" msgid="686045304547541817">"Picture orientation"</string>
<string name="pref_camera_picturesize_entry_large" msgid="9014447075089601575">"Large"</string>
<string name="pref_camera_picturesize_entry_medium" msgid="7708839551627003154">"Medium"</string>
<string name="pref_camera_picturesize_entry_small" msgid="2991239656622539068">"Small"</string>
diff --git a/packages/apps/Camera2/res/values-zh-rCN/strings.xml b/packages/apps/Camera2/res/values-zh-rCN/strings.xml
index d49e2537f9..52722d2da5 100644
--- a/packages/apps/Camera2/res/values-zh-rCN/strings.xml
+++ b/packages/apps/Camera2/res/values-zh-rCN/strings.xml
@@ -96,6 +96,7 @@
<string name="pref_camera_picturesize_title" msgid="686045304547541815">"照片尺寸"</string>
<string name="pref_camera_previewsize_title" msgid="686045304547541816">"预览尺寸"</string>
<string name="pref_camera_previeworientation_title" msgid="686045304547541817">"预览方向"</string>
+ <string name="pref_camera_pictureorientation_title" msgid="686045304547541817">"图片方向"</string>
<string name="pref_camera_picturesize_entry_large" msgid="9014447075089601575">"大"</string>
<string name="pref_camera_picturesize_entry_medium" msgid="7708839551627003154">"中"</string>
<string name="pref_camera_picturesize_entry_small" msgid="2991239656622539068">"小"</string>
diff --git a/packages/apps/Camera2/res/values/arrays.xml b/packages/apps/Camera2/res/values/arrays.xml
--- a/packages/apps/Camera2/res/values/arrays.xml
+++ b/packages/apps/Camera2/res/values/arrays.xml
@@ -705,4 +705,22 @@
<item>270</item>
</string-array>
+ <!-- Camera Preferences Preview orientation dialog box entries -->
+ <string-array name="pref_camera_pictureorientation_entries" translatable="false">
+ <item>0</item>
+ <item>90</item>
+ <item>180</item>
+ <item>270</item>
+ </string-array>
+
+ <!-- When launching the camera app first time, we will set the picture
+ size to the first one in the list that is also supported by the
+ driver -->
+ <string-array name="pref_camera_pictureorientation_entryvalues" translatable="false">
+ <item>0</item>
+ <item>90</item>
+ <item>180</item>
+ <item>270</item>
+ </string-array>
+
</resources>
diff --git a/packages/apps/Camera2/res/values/strings.xml b/packages/apps/Camera2/res/values/strings.xml
index b7880bbad5..eaaf2d8604 100644
--- a/packages/apps/Camera2/res/values/strings.xml
+++ b/packages/apps/Camera2/res/values/strings.xml
@@ -238,6 +238,7 @@
<string name="pref_camera_picturesize_title">Picture size</string>
<string name="pref_camera_previewsize_title">Preview size</string>
<string name="pref_camera_previeworientation_title">Preview orientation</string>
+ <string name="pref_camera_pictureorientation_title">Picture orientation</string>
<!-- Settings screen, dialog choice for "large" picture size [CHAR LIMIT=20] -->
<string name="pref_camera_picturesize_entry_large">Large</string>
diff --git a/packages/apps/Camera2/res/xml/camera_preferences.xml b/packages/apps/Camera2/res/xml/camera_preferences.xml
index f5297186ec..119bba8e3a 100644
--- a/packages/apps/Camera2/res/xml/camera_preferences.xml
+++ b/packages/apps/Camera2/res/xml/camera_preferences.xml
@@ -46,6 +46,11 @@
android:title="@string/pref_camera_previeworientation_title"
android:entries="@array/pref_camera_previeworientation_entries"
android:entryValues="@array/pref_camera_previeworientation_entryvalues" />
+ <ListPreference
+ android:key="pref_camera_pictureorientation_key"
+ android:title="@string/pref_camera_pictureorientation_title"
+ android:entries="@array/pref_camera_pictureorientation_entries"
+ android:entryValues="@array/pref_camera_pictureorientation_entryvalues" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/mode_video" >
--- a/packages/apps/Camera2/src/com/android/camera/PhotoModule.java
+++ b/packages/apps/Camera2/src/com/android/camera/PhotoModule.java
@@ -1890,11 +1890,25 @@ public class PhotoModule
int orientation = mActivity.isAutoRotateScreen() ? mDisplayRotation : mOrientation;
Characteristics info = mActivity.getCameraProvider().getCharacteristics(mCameraId);
mJpegRotation = info.getJpegOrientation(orientation);
- mCameraDevice.setJpegOrientation(mJpegRotation);
-
- Log.v(TAG, "capture orientation (screen:device:used:jpeg) " +
+ context = mActivity;
+ SharedPreferences cameraSetting= context.getSharedPreferences("camera_setting", Context.MODE_PRIVATE);
+ String pic_ori = cameraSetting.getString("picture_orientation", null);
+ if (pic_ori != null) {
+ int custOri = Integer.parseInt(pic_ori);
+ int tmpRotation = mJpegRotation + custOri;
+ if(tmpRotation >= 360)
+ tmpRotation = tmpRotation % 360;
+ mCameraDevice.setJpegOrientation(tmpRotation);
+ Log.v(TAG, "capture orientation (screen:device:used:jpeg) " +
+ mDisplayRotation + ":" + mOrientation + ":" +
+ orientation + ":" + tmpRotation);
+ } else {
+ mCameraDevice.setJpegOrientation(mJpegRotation);
+ Log.v(TAG, "capture orientation (screen:device:used:jpeg) " +
mDisplayRotation + ":" + mOrientation + ":" +
orientation + ":" + mJpegRotation);
+ }
+
mCameraDevice.takePicture(mHandler,
new ShutterCallback(!animateBefore),
@@ -1945,7 +1959,24 @@ public class PhotoModule
int orientation = mActivity.isAutoRotateScreen() ? mDisplayRotation : mOrientation;
Characteristics info = mActivity.getCameraProvider().getCharacteristics(mCameraId);
mJpegRotation = info.getJpegOrientation(orientation);
- mCameraDevice.setJpegOrientation(mJpegRotation);
+ context = mActivity;
+ SharedPreferences cameraSetting= context.getSharedPreferences("camera_setting", Context.MODE_PRIVATE);
+ String pic_ori = cameraSetting.getString("picture_orientation", null);
+ if (pic_ori != null) {
+ int custOri = Integer.parseInt(pic_ori);
+ int tmpRotation = mJpegRotation + custOri;
+ if(tmpRotation >= 360)
+ tmpRotation = tmpRotation % 360;
+ mCameraDevice.setJpegOrientation(tmpRotation);
+ Log.v(TAG, "capture orientation (screen:device:used:jpeg) " +
+ mDisplayRotation + ":" + mOrientation + ":" +
+ orientation + ":" + tmpRotation);
+ } else {
+ mCameraDevice.setJpegOrientation(mJpegRotation);
+ Log.v(TAG, "capture orientation (screen:device:used:jpeg) " +
+ mDisplayRotation + ":" + mOrientation + ":" +
+ orientation + ":" + mJpegRotation);
+ }
Log.v(TAG, "burstcapture orientation (screen:device:used:jpeg) " +
mDisplayRotation + ":" + mOrientation + ":" +
@@ -2801,6 +2832,8 @@ public class PhotoModule
private void setDisplayOrientation() {
mDisplayRotation = CameraUtil.getDisplayRotation();
+ // CameraInfo info_test = CameraHolder.instance().getCameraInfo()[mCameraId];
+ Log.d(TAG, "zwei -- mCameraId = " + mCameraId + " : FRONT = " + android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
Characteristics info =
mActivity.getCameraProvider().getCharacteristics(mCameraId);
mDisplayOrientation = info.getPreviewOrientation(mDisplayRotation);
@@ -2815,6 +2848,9 @@ public class PhotoModule
String orientation = cameraSetting.getString("preview_orientation", null);
if (orientation != null) {
int custOri = Integer.parseInt(orientation);
+ if(mCameraId == android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT && (custOri == 90 || custOri == 270)){
+ mDisplayOrientation += 180;
+ }
int tmpOri = mDisplayOrientation + custOri;
if (tmpOri >= 360)
tmpOri = tmpOri % 360;
--- a/packages/apps/Camera2/src/com/android/camera/settings/CameraSettingsActivity.java
+++ b/packages/apps/Camera2/src/com/android/camera/settings/CameraSettingsActivity.java
@@ -180,6 +180,7 @@ public class CameraSettingsActivity extends FragmentActivity {
private OneCameraManager mOneCameraManager;
private ListPreference previewSize;
private ListPreference previewOrientation;
+ private ListPreference pictureOrientation;
private SharedPreferences sharedPreferences;
private SharedPreferences.Editor editor;
private Context context;
@@ -199,6 +200,8 @@ public class CameraSettingsActivity extends FragmentActivity {
//previewSize.setOnPreferenceClickListener(this);
previewOrientation = (ListPreference) findPreference(Keys.KEY_PREVIEW_ORIENTATION);
previewOrientation.setOnPreferenceChangeListener(this);
+ pictureOrientation = (ListPreference) findPreference(Keys.KEY_PICTURE_ORIENTATION);
+ pictureOrientation.setOnPreferenceChangeListener(this);
SharedPreferences cameraSetting= context.getSharedPreferences("camera_setting", Context.MODE_PRIVATE);
editor = cameraSetting.edit();
@@ -257,6 +260,12 @@ public class CameraSettingsActivity extends FragmentActivity {
else
previewOrientation.setValue("0");
+ value=cameraSetting.getString("picture_orientation", null);
+ if(value != null)
+ pictureOrientation.setValue(value);
+ else
+ pictureOrientation.setValue("0");
+
// Load the camera sizes.
loadSizes();
@@ -343,6 +352,9 @@ public class CameraSettingsActivity extends FragmentActivity {
} else if (preference == previewOrientation) {
editor.putString("preview_orientation", (String) obj);
editor.commit();
+ } else if (preference == pictureOrientation) {
+ editor.putString("picture_orientation", (String) obj);
+ editor.commit();
}
return true;
}
--- a/packages/apps/Camera2/src/com/android/camera/settings/Keys.java
+++ b/packages/apps/Camera2/src/com/android/camera/settings/Keys.java
@@ -43,6 +43,7 @@ public class Keys {
public static final String KEY_PICTURE_SIZE_FRONT = "pref_camera_picturesize_front_key";
public static final String KEY_PREVIEW_SIZE = "pref_camera_previewsize_key";
public static final String KEY_PREVIEW_ORIENTATION = "pref_camera_previeworientation_key";
+ public static final String KEY_PICTURE_ORIENTATION = "pref_camera_pictureorientation_key";
public static final String KEY_JPEG_QUALITY = "pref_camera_jpegquality_key";
public static final String KEY_FOCUS_MODE = "pref_camera_focusmode_key";
public static final String KEY_FLASH_MODE = "pref_camera_flashmode_key";
@@ -212,6 +213,14 @@ public class Keys {
Keys.KEY_PREVIEW_ORIENTATION);
}
+ settingsManager.setDefaults(KEY_PICTURE_ORIENTATION,
+ context.getString(R.string.pref_camera_pictureorientation_title),
+ context.getResources().getStringArray(R.array.pref_camera_pictureorientation_entryvalues));
+ if (!settingsManager.isSet(SettingsManager.SCOPE_GLOBAL, Keys.KEY_PICTURE_ORIENTATION)) {
+ settingsManager.setToDefault(SettingsManager.SCOPE_GLOBAL,
+ Keys.KEY_PICTURE_ORIENTATION);
+ }
+
settingsManager.setDefaults(KEY_JPEG_QUALITY,
context.getString(R.string.pref_camera_jpeg_quality_normal),
context.getResources().getStringArray(
@@ -395,6 +404,10 @@ public class Keys {
settingsManager.setToDefault(SettingsManager.SCOPE_GLOBAL,
KEY_PREVIEW_SIZE);
+ if (settingsManager.isSet(SettingsManager.SCOPE_GLOBAL, KEY_PICTURE_ORIENTATION))
+ settingsManager.setToDefault(SettingsManager.SCOPE_GLOBAL,
+ KEY_PICTURE_ORIENTATION);
+
if (settingsManager.isSet(SettingsManager.SCOPE_GLOBAL, KEY_PREVIEW_ORIENTATION))
settingsManager.setToDefault(SettingsManager.SCOPE_GLOBAL,
KEY_PREVIEW_ORIENTATION);