diff options
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9794944..f6649fd 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2570,6 +2570,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private int getCurrentLandscapeRotation(int lastRotation) { + // if the user has locked rotation, we ignore the sensor + if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) { + if (isLandscapeOrSeascape(mUserRotation)) { + return mUserRotation; + } else { + // it seems odd to obey the sensor at all if rotation lock is enabled + return mLandscapeRotation; + } + } + int sensorRotation = mOrientationListener.getCurrentRotation(lastRotation); if (isLandscapeOrSeascape(sensorRotation)) { return sensorRotation; @@ -2587,6 +2597,16 @@ public class PhoneWindowManager implements WindowManagerPolicy { } private int getCurrentPortraitRotation(int lastRotation) { + // if the user has locked rotation, we ignore the sensor + if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) { + if (isAnyPortrait(mUserRotation)) { + return mUserRotation; + } else { + // it seems odd to obey the sensor at all if rotation lock is enabled + return mPortraitRotation; + } + } + int sensorRotation = mOrientationListener.getCurrentRotation(lastRotation); if (isAnyPortrait(sensorRotation)) { return sensorRotation; |