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
This commit is contained in:
Luca Stefani
2019-01-05 16:40:12 +01:00
parent 69f11ef333
commit fee9ea9768

View File

@@ -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) {