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

Commit ad788884 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Rotation lock fix for sensor{Landscape,Portrait} activities."

parents 70564141 e7e5ac25
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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;