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

Commit 8f72b3c7 authored by Adrian Roos's avatar Adrian Roos
Browse files

AOD: Fix possible NPE in DozeSensors

Fixes an NPE that can happen if the ProximitySensor callback
unregisters the proximity sensor.

Change-Id: I8df1cf98e5334b3ff35c19b30bb7e01d0ebcfd6a
Fixes: 63357752
Test: Squint at the code *really hard*
parent 1d8d34fa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -232,7 +232,9 @@ public class DozeSensors {
            mProxCallback.accept(mCurrentlyFar);

            long now = SystemClock.elapsedRealtime();
            if (!mCurrentlyFar) {
            if (mCurrentlyFar == null) {
                // Sensor has been unregistered by the proxCallback. Do nothing.
            } else if (!mCurrentlyFar) {
                mLastNear = now;
            } else if (mCurrentlyFar && now - mLastNear < COOLDOWN_TRIGGER) {
                // If the last near was very recent, we might be using more power for prox