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

Commit e6b36756 authored by Christopher R. Palmer's avatar Christopher R. Palmer Committed by Steve Kondik
Browse files

doze: Make delay and duration of intent triggered dozes configurable

Devices that have IR sensors can trigger dozes due directly to user
action (gestures) and the user expects a more immediate response
to this actions because  the user may be looking directly at
the screen and expecting immediate feedback.

It makes sense to differentiate this from the pickup sensor values
and notification sensor values because of the different user focus
(directly acting on the phone).

Change-Id: I085701bb7e5c0e1feb632ce945d615c7ae4e24a5
parent bd1819d8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -260,12 +260,18 @@
    <!-- Doze: pulse parameter - how long does it take to fade in after a pickup? -->
    <integer name="doze_pulse_duration_in_pickup">300</integer>

    <!-- Doze: pulse parameter - how long does it take to fade in after an intent? -->
    <integer name="doze_pulse_duration_in_intent">300</integer>

    <!-- Doze: pulse parameter - delay to wait for the screen to wake up -->
    <integer name="doze_pulse_delay_in">200</integer>

    <!-- Doze: pulse parameter - delay to wait for the screen to wake up after a pickup -->
    <integer name="doze_pulse_delay_in_pickup">200</integer>

    <!-- Doze: pulse parameter - delay to wait for the screen to wake up after an intent -->
    <integer name="doze_pulse_delay_in_intent">200</integer>

    <!-- Doze: pulse parameter - once faded in, how long does it stay visible? -->
    <integer name="doze_pulse_duration_visible">3000</integer>

+1 −1
Original line number Diff line number Diff line
@@ -351,7 +351,7 @@ public class DozeService extends DreamService {
            if (DEBUG) Log.d(mTag, "No more schedule resets remaining");
            return;
        }
        final long pulseDuration = mDozeParameters.getPulseDuration(false /*pickup*/);
        final long pulseDuration = mDozeParameters.getPulseDuration(DozeLog.PULSE_REASON_NOTIFICATION);
        if ((notificationTimeMs - mNotificationPulseTime) < pulseDuration) {
            if (DEBUG) Log.d(mTag, "Recently updated, not resetting schedule");
            return;
+30 −16
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.MathUtils;

import com.android.systemui.doze.DozeLog;
import com.android.systemui.R;

import java.io.PrintWriter;
@@ -46,12 +47,15 @@ public class DozeParameters {
    public void dump(PrintWriter pw) {
        pw.println("  DozeParameters:");
        pw.print("    getDisplayStateSupported(): "); pw.println(getDisplayStateSupported());
        pw.print("    getPulseDuration(pickup=false): "); pw.println(getPulseDuration(false));
        pw.print("    getPulseDuration(pickup=true): "); pw.println(getPulseDuration(true));
        pw.print("    getPulseInDuration(pickup=false): "); pw.println(getPulseInDuration(false));
        pw.print("    getPulseInDuration(pickup=true): "); pw.println(getPulseInDuration(true));
        pw.print("    getPulseInDelay(pickup=false): "); pw.println(getPulseInDelay(false));
        pw.print("    getPulseInDelay(pickup=true): "); pw.println(getPulseInDelay(true));
        pw.print("    getPulseDuration(notification): "); pw.println(getPulseDuration(DozeLog.PULSE_REASON_NOTIFICATION));
        pw.print("    getPulseDuration(pickup): "); pw.println(getPulseDuration(DozeLog.PULSE_REASON_SENSOR_PICKUP));
        pw.print("    getPulseDuration(intent): "); pw.println(getPulseDuration(DozeLog.PULSE_REASON_INTENT));
        pw.print("    getPulseInDuration(notification): "); pw.println(getPulseInDuration(DozeLog.PULSE_REASON_NOTIFICATION));
        pw.print("    getPulseInDuration(pickup): "); pw.println(getPulseInDuration(DozeLog.PULSE_REASON_SENSOR_PICKUP));
        pw.print("    getPulseInDuration(intent): "); pw.println(getPulseInDuration(DozeLog.PULSE_REASON_INTENT));
        pw.print("    getPulseInDelay(notification): "); pw.println(getPulseInDelay(DozeLog.PULSE_REASON_NOTIFICATION));
        pw.print("    getPulseInDelay(pickup): "); pw.println(getPulseInDelay(DozeLog.PULSE_REASON_SENSOR_PICKUP));
        pw.print("    getPulseInDelay(intent): "); pw.println(getPulseInDelay(DozeLog.PULSE_REASON_INTENT));
        pw.print("    getPulseInVisibleDuration(): "); pw.println(getPulseVisibleDuration());
        pw.print("    getPulseOutDuration(): "); pw.println(getPulseOutDuration());
        pw.print("    getPulseOnSigMotion(): "); pw.println(getPulseOnSigMotion());
@@ -70,20 +74,30 @@ public class DozeParameters {
        return getBoolean("doze.display.supported", R.bool.doze_display_state_supported);
    }

    public int getPulseDuration(boolean pickup) {
        return getPulseInDuration(pickup) + getPulseVisibleDuration() + getPulseOutDuration();
    public int getPulseDuration(int reason) {
        return getPulseInDuration(reason) + getPulseVisibleDuration() + getPulseOutDuration();
    }

    public int getPulseInDuration(boolean pickup) {
        return pickup
                ? getInt("doze.pulse.duration.in.pickup", R.integer.doze_pulse_duration_in_pickup)
                : getInt("doze.pulse.duration.in", R.integer.doze_pulse_duration_in);
    public int getPulseInDuration(int reason) {
        switch(reason) {
        case DozeLog.PULSE_REASON_SENSOR_PICKUP:
                return getInt("doze.pulse.duration.in.pickup", R.integer.doze_pulse_duration_in_pickup);
        case DozeLog.PULSE_REASON_INTENT:
                return getInt("doze.pulse.duration.in.intent", R.integer.doze_pulse_duration_in_intent);
        default:
                return getInt("doze.pulse.duration.in", R.integer.doze_pulse_duration_in);
        }
    }

    public int getPulseInDelay(boolean pickup) {
        return pickup
                ? getInt("doze.pulse.delay.in.pickup", R.integer.doze_pulse_delay_in_pickup)
                : getInt("doze.pulse.delay.in", R.integer.doze_pulse_delay_in);
    public int getPulseInDelay(int reason) {
        switch(reason) {
        case DozeLog.PULSE_REASON_SENSOR_PICKUP:
                return getInt("doze.pulse.delay.in.pickup", R.integer.doze_pulse_delay_in_pickup);
        case DozeLog.PULSE_REASON_INTENT:
                return getInt("doze.pulse.delay.in.intent", R.integer.doze_pulse_delay_in_intent);
        default:
                return getInt("doze.pulse.delay.in", R.integer.doze_pulse_delay_in);
        }
    }

    public int getPulseVisibleDuration() {
+2 −2
Original line number Diff line number Diff line
@@ -224,9 +224,9 @@ public class DozeScrimController {
            DozeLog.tracePulseStart(mPulseReason);
            final boolean pickup = mPulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP;
            startScrimAnimation(true /* inFront */, 0f,
                    mDozeParameters.getPulseInDuration(pickup),
                    mDozeParameters.getPulseInDuration(mPulseReason),
                    pickup ? mPulseInInterpolatorPickup : mPulseInInterpolator,
                    mDozeParameters.getPulseInDelay(pickup),
                    mDozeParameters.getPulseInDelay(mPulseReason),
                    mPulseInFinished);

            // Signal that the pulse is ready to turn the screen on and draw.