summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2013-09-06 21:46:25 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-06 21:46:25 +0000
commit56ad83f797ab09af240d1f67d63e55dd602160c1 (patch)
tree85ca68a4a1439234f48841f4fa332a676a825427 /src
parent080f868350a0f8c7666f5f5935db1e2b0a75f7f1 (diff)
parentce2b94917098f211cacaaebaa0f6b40021d3e3fa (diff)
downloadandroid_packages_apps_Snap-56ad83f797ab09af240d1f67d63e55dd602160c1.tar.gz
android_packages_apps_Snap-56ad83f797ab09af240d1f67d63e55dd602160c1.tar.bz2
android_packages_apps_Snap-56ad83f797ab09af240d1f67d63e55dd602160c1.zip
Merge "Respect system auto-rotate setting." into gb-ub-photos-carlsbad
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/CameraActivity.java1
-rw-r--r--src/com/android/camera/VideoModule.java2
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java2
-rw-r--r--src/com/android/camera/app/OrientationManager.java15
4 files changed, 15 insertions, 5 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index f82477c68..7b127fa4d 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -785,6 +785,7 @@ public class CameraActivity extends Activity
@Override
public void onResume() {
+ // TODO: Handle this in OrientationManager.
if (Settings.System.getInt(getContentResolver(),
Settings.System.ACCELEROMETER_ROTATION, 0) == 0) {// auto-rotate off
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
diff --git a/src/com/android/camera/VideoModule.java b/src/com/android/camera/VideoModule.java
index 53cb43ae0..291c74cc5 100644
--- a/src/com/android/camera/VideoModule.java
+++ b/src/com/android/camera/VideoModule.java
@@ -683,6 +683,7 @@ public class VideoModule implements CameraModule,
keepScreenOnAwhile();
+ mOrientationManager.resume();
// Initialize location service.
boolean recordLocation = RecordLocationPreference.get(mPreferences,
mContentResolver);
@@ -817,6 +818,7 @@ public class VideoModule implements CameraModule,
resetScreenOn();
if (mLocationManager != null) mLocationManager.recordLocation(false);
+ mOrientationManager.pause();
mHandler.removeMessages(CHECK_DISPLAY_ROTATION);
mHandler.removeMessages(SWITCH_CAMERA);
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 1756e4c70..053e99df7 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -759,6 +759,7 @@ public class WideAnglePanoramaModule
public void onPauseBeforeSuper() {
mPaused = true;
if (mLocationManager != null) mLocationManager.recordLocation(false);
+ mOrientationManager.pause();
}
@Override
@@ -851,6 +852,7 @@ public class WideAnglePanoramaModule
}
keepScreenOnAwhile();
+ mOrientationManager.resume();
// Initialize location service.
boolean recordLocation = RecordLocationPreference.get(mPreferences,
mContentResolver);
diff --git a/src/com/android/camera/app/OrientationManager.java b/src/com/android/camera/app/OrientationManager.java
index 7bf924218..ef03a0163 100644
--- a/src/com/android/camera/app/OrientationManager.java
+++ b/src/com/android/camera/app/OrientationManager.java
@@ -68,9 +68,12 @@ public class OrientationManager {
// the framework orientation, we always set the compensation value to 0.
////////////////////////////////////////////////////////////////////////////
- // Lock the framework orientation to the current device orientation
+ /**
+ * Lock the framework orientation to the current device orientation
+ * rotates. No effect if the system setting of auto-rotation is off.
+ */
public void lockOrientation() {
- if (mOrientationLocked) return;
+ if (mOrientationLocked || mRotationLockedSetting) return;
mOrientationLocked = true;
if (ApiHelper.HAS_ORIENTATION_LOCK) {
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
@@ -79,10 +82,12 @@ public class OrientationManager {
}
}
- // Unlock the framework orientation, so it can change when the device
- // rotates.
+ /**
+ * Unlock the framework orientation, so it can change when the device
+ * rotates. No effect if the system setting of auto-rotation is off.
+ */
public void unlockOrientation() {
- if (!mOrientationLocked) return;
+ if (!mOrientationLocked || mRotationLockedSetting) return;
mOrientationLocked = false;
Log.d(TAG, "unlock orientation");
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);