diff options
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 1 | ||||
-rw-r--r-- | src/com/android/camera/VideoModule.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/WideAnglePanoramaModule.java | 2 | ||||
-rw-r--r-- | src/com/android/camera/app/OrientationManager.java | 15 |
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); |