Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b97ad20c authored by Jeff Brown's avatar Jeff Brown Committed by The Android Automerger
Browse files

Revert "Do not use last app rotation as default."

This reverts commit 4bd149ef

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
parent e8f5276b
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -368,7 +368,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;
    
@@ -3723,17 +3722,8 @@ 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;
            }

            final int preferredRotation;
            if (mLidState == LID_OPEN && mLidOpenRotation >= 0) {