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

Commit 94db928d authored by Mike Lockwood's avatar Mike Lockwood
Browse files

PowerManager: Require proximity sensor value be less than Sensor.getMaximumRange()



This allows us to support binary proximity sensors that only return 0.0 and 1.0

Change-Id: Ifaf3a4e6fc720cb246ac3558e3e733b4b612c95b
Signed-off-by: default avatarMike Lockwood <lockwood@android.com>
parent 3f0476a4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2131,7 +2131,9 @@ class PowerManagerService extends IPowerManager.Stub
        long milliseconds = event.timestamp / 1000000;
        synchronized (mLocks) {
            float distance = event.values[0];
            if (distance >= 0.0 && distance < PROXIMITY_THRESHOLD) {
            // compare against getMaximumRange to support sensors that only return 0 or 1
            if (distance >= 0.0 && distance < PROXIMITY_THRESHOLD &&
                    distance < mProximitySensor.getMaximumRange()) {
                if (mSpew) {
                    Log.d(TAG, "onSensorChanged: proximity active, distance: " + distance);
                }