diff options
author | John Spurlock <jspurlock@google.com> | 2014-12-03 19:49:24 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-03 19:49:26 +0000 |
commit | cdf7f984870344de1b1237e2a7749a3e32b2b688 (patch) | |
tree | 0be0ce1946975ed9be84e86599feba9c4656bad6 /packages/SystemUI | |
parent | 932c33214729fe2d2b09f82ef60a72871f182654 (diff) | |
parent | f5d250deecc4ce79ef8a74f1c4eb76e268556115 (diff) | |
download | frameworks_base-cdf7f984870344de1b1237e2a7749a3e32b2b688.zip frameworks_base-cdf7f984870344de1b1237e2a7749a3e32b2b688.tar.gz frameworks_base-cdf7f984870344de1b1237e2a7749a3e32b2b688.tar.bz2 |
Merge "Doze: Fast path for pickup pulses." into lmp-mr1-dev
Diffstat (limited to 'packages/SystemUI')
5 files changed, 43 insertions, 18 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index 9a95b37..24830e8 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -251,12 +251,21 @@ <!-- Doze: duration to avoid false pickup gestures triggered by notification vibrations --> <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? --> <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> + <!-- 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? --> <integer name="doze_pulse_duration_visible">3000</integer> diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java index 7eb9c6e..1f3a830 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeLog.java @@ -153,7 +153,7 @@ public class DozeLog { sProxStats[pulseReason][near ? 0 : 1].append(); } - private static String pulseReasonToString(int pulseReason) { + public static String pulseReasonToString(int pulseReason) { switch (pulseReason) { case PULSE_REASON_INTENT: return "intent"; case PULSE_REASON_NOTIFICATION: return "notification"; diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java index 2341144..36995ff 100644 --- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java +++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java @@ -217,7 +217,9 @@ 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()) { + if (!mDozeParameters.getProxCheckBeforePulse() || + reason == DozeLog.PULSE_REASON_SENSOR_PICKUP + && mDozeParameters.getPickupPerformsProxCheck()) { // skip proximity check continuePulsing(reason); return; @@ -340,7 +342,8 @@ public class DozeService extends DreamService { if (DEBUG) Log.d(mTag, "No more schedule resets remaining"); 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"); return; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java index 3d4a1e0..6b167b4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java @@ -46,9 +46,12 @@ public class DozeParameters { public void dump(PrintWriter pw) { pw.println(" DozeParameters:"); pw.print(" getDisplayStateSupported(): "); pw.println(getDisplayStateSupported()); - pw.print(" getPulseDuration(): "); pw.println(getPulseDuration()); - pw.print(" getPulseInDuration(): "); pw.println(getPulseInDuration()); - pw.print(" getPulseInDelay(): "); pw.println(getPulseInDelay()); + 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(" getPulseInVisibleDuration(): "); pw.println(getPulseVisibleDuration()); pw.print(" getPulseOutDuration(): "); pw.println(getPulseOutDuration()); pw.print(" getPulseOnSigMotion(): "); pw.println(getPulseOnSigMotion()); @@ -60,22 +63,27 @@ public class DozeParameters { pw.print(" getPulseSchedule(): "); pw.println(getPulseSchedule()); pw.print(" getPulseScheduleResets(): "); pw.println(getPulseScheduleResets()); pw.print(" getPickupVibrationThreshold(): "); pw.println(getPickupVibrationThreshold()); + pw.print(" getPickupPerformsProxCheck(): "); pw.println(getPickupPerformsProxCheck()); } public boolean getDisplayStateSupported() { return getBoolean("doze.display.supported", R.bool.doze_display_state_supported); } - public int getPulseDuration() { - return getPulseInDuration() + getPulseVisibleDuration() + getPulseOutDuration(); + public int getPulseDuration(boolean pickup) { + return getPulseInDuration(pickup) + getPulseVisibleDuration() + getPulseOutDuration(); } - public int getPulseInDuration() { - return getInt("doze.pulse.duration.in", R.integer.doze_pulse_duration_in); + 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 getPulseInDelay() { - return getInt("doze.pulse.delay.in", R.integer.doze_pulse_delay_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 getPulseVisibleDuration() { @@ -106,6 +114,10 @@ public class DozeParameters { 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() { return getBoolean("doze.pulse.notifications", R.bool.doze_pulse_on_notifications); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java index 022e64e..3394a8d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeScrimController.java @@ -21,10 +21,8 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.NonNull; import android.content.Context; -import android.graphics.Color; import android.os.Handler; import android.util.Log; -import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; @@ -219,11 +217,14 @@ public class DozeScrimController { private final Runnable mPulseIn = new Runnable() { @Override 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; DozeLog.tracePulseStart(mPulseReason); - startScrimAnimation(true /* inFront */, 0f, mDozeParameters.getPulseInDuration(), - mPulseInInterpolator, mDozeParameters.getPulseInDelay(), mPulseInFinished); + final boolean pickup = mPulseReason == DozeLog.PULSE_REASON_SENSOR_PICKUP; + 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. pulseStarted(); |