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

Commit 042e4856 authored by Ethan Chen's avatar Ethan Chen Committed by Steve Kondik
Browse files

doze: Separate proximity check by reason

* Devices that pulse by intent typically check the proximity sensor as
  part of sensor wakeup. Allow pulse by intent to control proximity
  check separate from pulse by sensor wakeup.

Change-Id: I9955013b864746c52ee576ff0f4de3672bf7fe0e
parent 6ee17f52
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -239,6 +239,9 @@
    <!-- Doze: check proximity sensor before pulsing? -->
    <bool name="doze_proximity_check_before_pulse">true</bool>

    <!-- Doze: check proximity sensor before pulsing from intent? -->
    <bool name="doze_proximity_check_before_pulse_intent">false</bool>

    <!-- Doze: should notifications be used as a pulse signal? -->
    <bool name="doze_pulse_on_notifications">true</bool>

+1 −2
Original line number Diff line number Diff line
@@ -217,8 +217,7 @@ public class DozeService extends DreamService {
            // Here we need a wakelock to stay awake until the pulse is finished.
            mWakeLock.acquire();
            mPulsing = true;
            if (!mDozeParameters.getProxCheckBeforePulse() ||
                    reason == DozeLog.PULSE_REASON_INTENT) {
            if (!mDozeParameters.getProxCheckBeforePulse(reason)) {
                // skip proximity check
                continuePulsing(reason);
                return;
+11 −3
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ public class DozeParameters {
        pw.print("    getVibrateOnSigMotion(): "); pw.println(getVibrateOnSigMotion());
        pw.print("    getPulseOnPickup(): "); pw.println(getPulseOnPickup());
        pw.print("    getVibrateOnPickup(): "); pw.println(getVibrateOnPickup());
        pw.print("    getProxCheckBeforePulse(): "); pw.println(getProxCheckBeforePulse());
        pw.print("    getProxCheckBeforePulse(pickup): "); pw.println(getProxCheckBeforePulse(DozeLog.PULSE_REASON_SENSOR_PICKUP));
        pw.print("    getProxCheckBeforePulse(intent): "); pw.println(getProxCheckBeforePulse(DozeLog.PULSE_REASON_INTENT));
        pw.print("    getPulseOnNotifications(): "); pw.println(getPulseOnNotifications());
        pw.print("    getPulseSchedule(): "); pw.println(getPulseSchedule());
        pw.print("    getPulseScheduleResets(): "); pw.println(getPulseScheduleResets());
@@ -124,9 +125,16 @@ public class DozeParameters {
        return SystemProperties.getBoolean("doze.vibrate.pickup", false);
    }

    public boolean getProxCheckBeforePulse() {
    public boolean getProxCheckBeforePulse(int reason) {
        switch(reason) {
        case DozeLog.PULSE_REASON_SENSOR_PICKUP:
                return getBoolean("doze.pulse.proxcheck.pickup", R.bool.doze_proximity_check_before_pulse);
        case DozeLog.PULSE_REASON_INTENT:
                return getBoolean("doze.pulse.proxcheck.intent", R.bool.doze_proximity_check_before_pulse_intent);
        default:
                return getBoolean("doze.pulse.proxcheck", R.bool.doze_proximity_check_before_pulse);
        }
    }

    public boolean getPickupPerformsProxCheck() {
        return getBoolean("doze.pickup.proxcheck", R.bool.doze_pickup_performs_proximity_check);