diff options
author | Daniel Sandler <dsandler@google.com> | 2011-02-22 14:54:17 -0500 |
---|---|---|
committer | Daniel Sandler <dsandler@google.com> | 2011-02-22 15:24:55 -0500 |
commit | 2ed6ad6aeca5f9829ea7dad4e092064ee4baad47 (patch) | |
tree | bccf80eaf081beef8e95d903f8a056f270bd8d1a /policy | |
parent | 2fad616237ce2db020eb6c0e03084ece291aee3c (diff) | |
download | frameworks_base-2ed6ad6aeca5f9829ea7dad4e092064ee4baad47.zip frameworks_base-2ed6ad6aeca5f9829ea7dad4e092064ee4baad47.tar.gz frameworks_base-2ed6ad6aeca5f9829ea7dad4e092064ee4baad47.tar.bz2 |
Fix the flipping orientation lock.
We were setting ACCELEROMETER_ROTATION to 0 before putting
in the proper USER_ROTATION value, and PhoneWindowManager's
content observer would eagerly rotate the screen to the last
locked orientation before re-rotating to the updated locked
rotation.
Now we set USER_ROTATION first. Additionally, the
content observer is now the only place we set
mUserRotation{,Mode} (previously we would race with it in
setUserRotationMode()).
Bug: 3425657
Change-Id: I04ba1a3631c6d985c2e406c4d148c39fb5c36216
Diffstat (limited to 'policy')
-rwxr-xr-x | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 156391e..8fd0f05 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2463,6 +2463,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { public int rotationForOrientationLw(int orientation, int lastRotation, boolean displayEnabled) { + if (false) { + Slog.v(TAG, "rotationForOrientationLw(orient=" + + orientation + ", last=" + lastRotation + + "); user=" + mUserRotation + " " + + ((mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) + ? "USER_ROTATION_LOCKED" : "") + ); + } + if (mPortraitRotation < 0) { // Initialize the rotation angles for each orientation once. Display d = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) @@ -2581,15 +2590,15 @@ public class PhoneWindowManager implements WindowManagerPolicy { // User rotation: to be used when all else fails in assigning an orientation to the device public void setUserRotationMode(int mode, int rot) { ContentResolver res = mContext.getContentResolver(); - mUserRotationMode = mode; + + // mUserRotationMode and mUserRotation will be assigned by the content observer if (mode == WindowManagerPolicy.USER_ROTATION_LOCKED) { - mUserRotation = rot; - Settings.System.putInt(res, - Settings.System.ACCELEROMETER_ROTATION, - 0); Settings.System.putInt(res, Settings.System.USER_ROTATION, rot); + Settings.System.putInt(res, + Settings.System.ACCELEROMETER_ROTATION, + 0); } else { Settings.System.putInt(res, Settings.System.ACCELEROMETER_ROTATION, @@ -2907,7 +2916,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { pw.print(" mDeskDockRotation="); pw.println(mDeskDockRotation); pw.print(prefix); pw.print("mUserRotationMode="); pw.print(mUserRotationMode); pw.print(" mUserRotation="); pw.print(mUserRotation); - pw.print("mAllowAllRotations="); pw.println(mAllowAllRotations); + pw.print(" mAllowAllRotations="); pw.println(mAllowAllRotations); pw.print(prefix); pw.print("mAccelerometerDefault="); pw.print(mAccelerometerDefault); pw.print(" mCurrentAppOrientation="); pw.println(mCurrentAppOrientation); pw.print(prefix); pw.print("mCarDockEnablesAccelerometer="); |