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

Commit f919bb1a authored by Christopher R. Palmer's avatar Christopher R. Palmer Committed by Gerrit Code Review
Browse files

base: Fix proximity check on power key

To test, enable "Settings >> Display >> Prevent accidental wakeup",
hold your hand over the proximity sensor and turn your phone on.

Prior to this change, it will wake up the phone and after the change
it will not.

Change-Id: Ied300108cebb31dedf228e85510abebb3e8a4152
parent 208d62d7
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -6071,15 +6071,24 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    }

    private void wakeUpFromPowerKey(long eventTime) {
        wakeUp(eventTime, mAllowTheaterModeWakeFromPowerKey);
        wakeUp(eventTime, mAllowTheaterModeWakeFromPowerKey, true);
    }

    private boolean wakeUp(long wakeTime, boolean wakeInTheaterMode) {
        return wakeUp(wakeTime, wakeInTheaterMode, false);
    }

    private boolean wakeUp(long wakeTime, boolean wakeInTheaterMode,
            boolean withProximityCheck) {
        if (!wakeInTheaterMode && isTheaterModeEnabled()) {
            return false;
        }

        if (withProximityCheck) {
            mPowerManager.wakeUpWithProximityCheck(wakeTime);
        } else {
            mPowerManager.wakeUp(wakeTime);
        }
        return true;
    }