summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2013-02-15 10:55:37 -0800
committerDoris Liu <tianliu@google.com>2013-02-15 17:33:00 -0800
commit3cf565c4242a9deab7da5eb84fc302c79d594f11 (patch)
treee7e86576e14ad8b374b4e893d0629746961ef210 /src
parent4d88243c1e0c8d0ac5390b79ef0cf3418adcf02a (diff)
downloadandroid_packages_apps_Snap-3cf565c4242a9deab7da5eb84fc302c79d594f11.tar.gz
android_packages_apps_Snap-3cf565c4242a9deab7da5eb84fc302c79d594f11.tar.bz2
android_packages_apps_Snap-3cf565c4242a9deab7da5eb84fc302c79d594f11.zip
Make photo orientation consistent with UI
Also fixed the wrong animation orientation. Bug: 7302506 Change-Id: I58615a7b3cc2e08c2a8dc4e174512a502c2482f5
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java18
-rw-r--r--src/com/android/camera/PhotoModule.java10
2 files changed, 27 insertions, 1 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index bf1ec2483..b0374986c 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -23,11 +23,14 @@ import android.content.Context;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
+import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.MediaStore;
+import android.provider.Settings;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -57,6 +60,7 @@ public class CameraActivity extends ActivityBase
private Drawable[] mDrawables;
private int mCurrentModuleIndex;
private MotionEvent mDown;
+ private boolean mAutoRotateScreen;
private MyOrientationEventListener mOrientationListener;
// The degrees of the device rotated clockwise from its natural orientation.
@@ -140,6 +144,12 @@ public class CameraActivity extends ActivityBase
super.onDestroy();
}
+ // Return whether the auto-rotate screen in system settings
+ // is turned on.
+ public boolean isAutoRotateScreen() {
+ return mAutoRotateScreen;
+ }
+
private class MyOrientationEventListener
extends OrientationEventListener {
public MyOrientationEventListener(Context context) {
@@ -317,6 +327,14 @@ public class CameraActivity extends ActivityBase
@Override
public void onResume() {
mPaused = false;
+ if (Settings.System.getInt(getContentResolver(),
+ Settings.System.ACCELEROMETER_ROTATION, 0) == 0) {// auto-rotate off
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
+ mAutoRotateScreen = false;
+ } else {
+ setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
+ mAutoRotateScreen = true;
+ }
mOrientationListener.enable();
mCurrentModule.onResumeBeforeSuper();
super.onResume();
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 60cb67896..33ebcd931 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -1133,7 +1133,15 @@ public class PhotoModule
}
// Set rotation and gps data.
- mJpegRotation = Util.getJpegRotation(mCameraId, mOrientation);
+ int orientation;
+ // We need to be consistent with the framework orientation (i.e. the
+ // orientation of the UI.) when the auto-rotate screen setting is on.
+ if (mActivity.isAutoRotateScreen()) {
+ orientation = (360 - mDisplayRotation) % 360;
+ } else {
+ orientation = mOrientation;
+ }
+ mJpegRotation = Util.getJpegRotation(mCameraId, orientation);
mParameters.setRotation(mJpegRotation);
Location loc = mLocationManager.getCurrentLocation();
Util.setGpsParameters(mParameters, loc);