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

Commit 4262768f authored by Luca Stefani's avatar Luca Stefani
Browse files

PhoneWindowManager: Check if proposed rotation is in range

* Some OEMs *coughs OnePlus* decided it was a great idea to add a fourth kind of rotation ( flat )
* Of course Android doesn't know how to handle it, thus crashing in some usecases

Change-Id: I9c64adcbe557ce2954989af5d0beec57798ea689
parent 70ccfc70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -7970,7 +7970,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        synchronized (mLock) {
            int sensorRotation = mOrientationListener.getProposedRotation(); // may be -1
            if (sensorRotation < 0) {
            if (sensorRotation < 0 || sensorRotation > 3) {
                sensorRotation = lastRotation;
            }

+1 −1
Original line number Diff line number Diff line
@@ -1084,7 +1084,7 @@ public abstract class WindowOrientationListener {

        public int evaluateRotationChangeLocked() {
            unscheduleRotationEvaluationLocked();
            if (mDesiredRotation == mProposedRotation) {
            if (mDesiredRotation == mProposedRotation || mDesiredRotation > 3) {
                return -1;
            }
            final long now = SystemClock.elapsedRealtimeNanos();