Skip to content

Commit 0f862b4

Browse files
Jeff BrownAndroid (Google) Code Review
authored andcommitted
Revert "Do not use last app rotation as default."
This reverts commit 4bd149e 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
1 parent 4bd149e commit 0f862b4

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
361361
boolean mScreenOnEarly = false;
362362
boolean mScreenOnFully = false;
363363
boolean mOrientationSensorEnabled = false;
364-
int mLastSensorRotation = -1;
365364
int mCurrentAppOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
366365
boolean mHasSoftInput = false;
367366

@@ -3729,16 +3728,7 @@ public int rotationForOrientationLw(int orientation, int lastRotation) {
37293728
synchronized (mLock) {
37303729
int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1
37313730
if (sensorRotation < 0) {
3732-
// Sensor is disabled, device probably just turned off.
3733-
if (mLastSensorRotation >= 0) {
3734-
sensorRotation = mLastSensorRotation;
3735-
} else {
3736-
// Sensor has never been enabled. Last resort is to use lastRotation.
3737-
sensorRotation = lastRotation;
3738-
}
3739-
} else {
3740-
// Valid sensor data, save it away.
3741-
mLastSensorRotation = sensorRotation;
3731+
sensorRotation = lastRotation;
37423732
}
37433733

37443734
final int preferredRotation;

0 commit comments

Comments
 (0)