From 0f862b432e9879790e22cab7dae18caffec0812f Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 27 Sep 2012 21:11:01 -0700 Subject: Revert "Do not use last app rotation as default." This reverts commit 4bd149ef83c8e3e2ffb61885e71f44df9a9ccfa7 This change introduced a regression in the device rotation policy. Suppose you hold the device in landscape orientation then put it flat on a table. At this time, the accelerometer has no information about which way the device is oriented so the sensor expresses no preference over the orientation. Now switch to an application that forces portrait. Then go back to the original app that auto-rotates. We should remain portrait from this point onwards unless the device is picked up and we have accelerometer information from which to establish a new preferred orientation. Bug: 7173556 Change-Id: I3684af3369e4ea55042081e19d96773c4d4bbe76 --- .../com/android/internal/policy/impl/PhoneWindowManager.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'policy') diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 718512b..215f597 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -361,7 +361,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { boolean mScreenOnEarly = false; boolean mScreenOnFully = false; boolean mOrientationSensorEnabled = false; - int mLastSensorRotation = -1; int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; boolean mHasSoftInput = false; @@ -3729,16 +3728,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { synchronized (mLock) { int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1 if (sensorRotation < 0) { - // Sensor is disabled, device probably just turned off. - if (mLastSensorRotation >= 0) { - sensorRotation = mLastSensorRotation; - } else { - // Sensor has never been enabled. Last resort is to use lastRotation. - sensorRotation = lastRotation; - } - } else { - // Valid sensor data, save it away. - mLastSensorRotation = sensorRotation; + sensorRotation = lastRotation; } final int preferredRotation; -- cgit v1.1