summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2015-09-24 13:19:25 +0200
committerSelim Cinek <cinek@google.com>2015-09-29 11:59:29 -0700
commit01db67d9f74b47b54a529f6773a824cc6bdfe627 (patch)
treee44f61d2581c47585cd3432f74515339f7cd88a1
parentdca3b2f74f7979e87e2654baf83df42483ef4388 (diff)
downloadbase-01db67d9f74b47b54a529f6773a824cc6bdfe627.tar.gz
Ambient display now comes up immediately when a notification comes in
Previously there was always a 1s delay which could even become a 5-8s delay if the Alarm was not delivered in time. Bug: 24355754 Change-Id: I1625c69719eee81403a1fcce1358d4d6c9fcf3e9
-rw-r--r--packages/SystemUI/res/values/config.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeService.java13
2 files changed, 12 insertions, 3 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 123ff7824c59..5d06768ecde2 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -243,7 +243,7 @@
<bool name="doze_pulse_on_notifications">true</bool>
<!-- Doze: when to pulse after a buzzworthy notification arrives -->
- <string name="doze_pulse_schedule" translatable="false">1s,10s,30s,60s</string>
+ <string name="doze_pulse_schedule" translatable="false">10s,30s,60s</string>
<!-- Doze: maximum number of times the notification pulse schedule can be reset -->
<integer name="doze_pulse_schedule_resets">2</integer>
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index 630d7350c1bc..39423f2a4b89 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -88,6 +88,7 @@ public class DozeService extends DreamService {
private boolean mPowerSaveActive;
private boolean mCarMode;
private long mNotificationPulseTime;
+ private long mLastScheduleResetTime;
private long mEarliestPulseDueToLight;
private int mScheduleResetsRemaining;
@@ -356,13 +357,21 @@ public class DozeService extends DreamService {
return;
}
final long pulseDuration = mDozeParameters.getPulseDuration(false /*pickup*/);
- if ((notificationTimeMs - mNotificationPulseTime) < pulseDuration) {
+ boolean pulseImmediately = System.currentTimeMillis() >= notificationTimeMs;
+ if ((notificationTimeMs - mLastScheduleResetTime) >= pulseDuration) {
+ mScheduleResetsRemaining--;
+ mLastScheduleResetTime = notificationTimeMs;
+ } else if (!pulseImmediately){
if (DEBUG) Log.d(mTag, "Recently updated, not resetting schedule");
return;
}
- mScheduleResetsRemaining--;
if (DEBUG) Log.d(mTag, "mScheduleResetsRemaining = " + mScheduleResetsRemaining);
mNotificationPulseTime = notificationTimeMs;
+ if (pulseImmediately) {
+ DozeLog.traceNotificationPulse(0);
+ requestPulse(DozeLog.PULSE_REASON_NOTIFICATION);
+ }
+ // schedule the rest of the pulses
rescheduleNotificationPulse(true /*predicate*/);
}