* commit '06eaac4463015d9ff93c694603bb9398b065f502': Doze: Fast path for pickup pulses.
This commit is contained in:
@@ -251,12 +251,21 @@
|
|||||||
<!-- Doze: duration to avoid false pickup gestures triggered by notification vibrations -->
|
<!-- Doze: duration to avoid false pickup gestures triggered by notification vibrations -->
|
||||||
<integer name="doze_pickup_vibration_threshold">2000</integer>
|
<integer name="doze_pickup_vibration_threshold">2000</integer>
|
||||||
|
|
||||||
|
<!-- Doze: can we assume the pickup sensor includes a proximity check? -->
|
||||||
|
<bool name="doze_pickup_performs_proximity_check">false</bool>
|
||||||
|
|
||||||
<!-- Doze: pulse parameter - how long does it take to fade in? -->
|
<!-- Doze: pulse parameter - how long does it take to fade in? -->
|
||||||
<integer name="doze_pulse_duration_in">900</integer>
|
<integer name="doze_pulse_duration_in">900</integer>
|
||||||
|
|
||||||
<!-- Doze: pulse parameter - delay for fading so the screen can wake up before -->
|
<!-- 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 - delay to wait for the screen to wake up -->
|
||||||
<integer name="doze_pulse_delay_in">200</integer>
|
<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 - once faded in, how long does it stay visible? -->
|
<!-- Doze: pulse parameter - once faded in, how long does it stay visible? -->
|
||||||
<integer name="doze_pulse_duration_visible">3000</integer>
|
<integer name="doze_pulse_duration_visible">3000</integer>
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ public class DozeLog {
|
|||||||
sProxStats[pulseReason][near ? 0 : 1].append();
|
sProxStats[pulseReason][near ? 0 : 1].append();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String pulseReasonToString(int pulseReason) {
|
public static String pulseReasonToString(int pulseReason) {
|
||||||
switch (pulseReason) {
|
switch (pulseReason) {
|
||||||
case PULSE_REASON_INTENT: return "intent";
|
case PULSE_REASON_INTENT: return "intent";
|
||||||
case PULSE_REASON_NOTIFICATION: return "notification";
|
case PULSE_REASON_NOTIFICATION: return "notification";
|
||||||
|
|||||||
@@ -217,7 +217,9 @@ public class DozeService extends DreamService {
|
|||||||
// Here we need a wakelock to stay awake until the pulse is finished.
|
// Here we need a wakelock to stay awake until the pulse is finished.
|
||||||
mWakeLock.acquire();
|
mWakeLock.acquire();
|
||||||
mPulsing = true;
|
mPulsing = true;
|
||||||
if (!mDozeParameters.getProxCheckBeforePulse()) {
|
if (!mDozeParameters.getProxCheckBeforePulse() ||
|
||||||
|
reason == DozeLog.PULSE_REASON_SENSOR_PICKUP
|
||||||
|
&& mDozeParameters.getPickupPerformsProxCheck()) {
|
||||||
// skip proximity check
|
// skip proximity check
|
||||||
continuePulsing(reason);
|
continuePulsing(reason);
|
||||||
return;
|
return;
|
||||||
@@ -340,7 +342,8 @@ public class DozeService extends DreamService {
|
|||||||
if (DEBUG) Log.d(mTag, "No more schedule resets remaining");
|
if (DEBUG) Log.d(mTag, "No more schedule resets remaining");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((notificationTimeMs - mNotificationPulseTime) < mDozeParameters.getPulseDuration()) {
|
final long pulseDuration = mDozeParameters.getPulseDuration(false /*pickup*/);
|
||||||
|
if ((notificationTimeMs - mNotificationPulseTime) < pulseDuration) {
|
||||||
if (DEBUG) Log.d(mTag, "Recently updated, not resetting schedule");
|
if (DEBUG) Log.d(mTag, "Recently updated, not resetting schedule");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,9 +46,12 @@ public class DozeParameters {
|
|||||||
public void dump(PrintWriter pw) {
|
public void dump(PrintWriter pw) {
|
||||||
pw.println(" DozeParameters:");
|
pw.println(" DozeParameters:");
|
||||||
pw.print(" getDisplayStateSupported(): "); pw.println(getDisplayStateSupported());
|
pw.print(" getDisplayStateSupported(): "); pw.println(getDisplayStateSupported());
|
||||||
pw.print(" getPulseDuration(): "); pw.println(getPulseDuration());
|
pw.print(" getPulseDuration(pickup=false): "); pw.println(getPulseDuration(false));
|
||||||
pw.print(" getPulseInDuration(): "); pw.println(getPulseInDuration());
|
pw.print(" getPulseDuration(pickup=true): "); pw.println(getPulseDuration(true));
|
||||||
pw.print(" getPulseInDelay(): "); pw.println(getPulseInDelay());
|
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(" getPulseInVisibleDuration(): "); pw.println(getPulseVisibleDuration());
|
pw.print(" getPulseInVisibleDuration(): "); pw.println(getPulseVisibleDuration());
|
||||||
pw.print(" getPulseOutDuration(): "); pw.println(getPulseOutDuration());
|
pw.print(" getPulseOutDuration(): "); pw.println(getPulseOutDuration());
|
||||||
pw.print(" getPulseOnSigMotion(): "); pw.println(getPulseOnSigMotion());
|
pw.print(" getPulseOnSigMotion(): "); pw.println(getPulseOnSigMotion());
|
||||||
@@ -60,22 +63,27 @@ public class DozeParameters {
|
|||||||
pw.print(" getPulseSchedule(): "); pw.println(getPulseSchedule());
|
pw.print(" getPulseSchedule(): "); pw.println(getPulseSchedule());
|
||||||
pw.print(" getPulseScheduleResets(): "); pw.println(getPulseScheduleResets());
|
pw.print(" getPulseScheduleResets(): "); pw.println(getPulseScheduleResets());
|
||||||
pw.print(" getPickupVibrationThreshold(): "); pw.println(getPickupVibrationThreshold());
|
pw.print(" getPickupVibrationThreshold(): "); pw.println(getPickupVibrationThreshold());
|
||||||
|
pw.print(" getPickupPerformsProxCheck(): "); pw.println(getPickupPerformsProxCheck());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getDisplayStateSupported() {
|
public boolean getDisplayStateSupported() {
|
||||||
return getBoolean("doze.display.supported", R.bool.doze_display_state_supported);
|
return getBoolean("doze.display.supported", R.bool.doze_display_state_supported);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPulseDuration() {
|
public int getPulseDuration(boolean pickup) {
|
||||||
return getPulseInDuration() + getPulseVisibleDuration() + getPulseOutDuration();
|
return getPulseInDuration(pickup) + getPulseVisibleDuration() + getPulseOutDuration();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPulseInDuration() {
|
public int getPulseInDuration(boolean pickup) {
|
||||||
return getInt("doze.pulse.duration.in", R.integer.doze_pulse_duration_in);
|
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 getPulseInDelay() {
|
public int getPulseInDelay(boolean pickup) {
|
||||||
return getInt("doze.pulse.delay.in", R.integer.doze_pulse_delay_in);
|
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 getPulseVisibleDuration() {
|
public int getPulseVisibleDuration() {
|
||||||
@@ -106,6 +114,10 @@ public class DozeParameters {
|
|||||||
return getBoolean("doze.pulse.proxcheck", R.bool.doze_proximity_check_before_pulse);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getPulseOnNotifications() {
|
public boolean getPulseOnNotifications() {
|
||||||
return getBoolean("doze.pulse.notifications", R.bool.doze_pulse_on_notifications);
|
return getBoolean("doze.pulse.notifications", R.bool.doze_pulse_on_notifications);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,8 @@ import android.animation.AnimatorListenerAdapter;
|
|||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.animation.Animation;
|
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
@@ -219,11 +217,14 @@ public class DozeScrimController {
|
|||||||
private final Runnable mPulseIn = new Runnable() {
|
private final Runnable mPulseIn = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing);
|
if (DEBUG) Log.d(TAG, "Pulse in, mDozing=" + mDozing + " mPulseReason="
|
||||||
|
+ DozeLog.pulseReasonToString(mPulseReason));
|
||||||
if (!mDozing) return;
|
if (!mDozing) return;
|
||||||
DozeLog.tracePulseStart(mPulseReason);
|
DozeLog.tracePulseStart(mPulseReason);
|
||||||
startScrimAnimation(true /* inFront */, 0f, mDozeParameters.getPulseInDuration(),
|
final boolean pickup = mPulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP;
|
||||||
mPulseInInterpolator, mDozeParameters.getPulseInDelay(), mPulseInFinished);
|
startScrimAnimation(true /* inFront */, 0f, mDozeParameters.getPulseInDuration(pickup),
|
||||||
|
mPulseInInterpolator, mDozeParameters.getPulseInDelay(pickup),
|
||||||
|
mPulseInFinished);
|
||||||
|
|
||||||
// Signal that the pulse is ready to turn the screen on and draw.
|
// Signal that the pulse is ready to turn the screen on and draw.
|
||||||
pulseStarted();
|
pulseStarted();
|
||||||
|
|||||||
Reference in New Issue
Block a user