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

Commit fee9ea97 authored by Luca Stefani's avatar Luca Stefani
Browse files

WindowOrientationListener: 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 )

Change-Id: I54c6e6360e897fbc8445edabbf411807521c624b
parent 69f11ef3
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1047,8 +1047,14 @@ public abstract class WindowOrientationListener {
        @Override
        public void onSensorChanged(SensorEvent event) {
            int newRotation;

            int reportedRotation = (int) event.values[0];
            if (reportedRotation < 0 || reportedRotation > 3) {
                return;
            }

            synchronized (mLock) {
                mDesiredRotation = (int) event.values[0];
                mDesiredRotation = reportedRotation;
                newRotation = evaluateRotationChangeLocked();
            }
            if (newRotation >=0) {