OSDN Git Service

Send TIME_SET to manifest receivers, too
authorChristopher Tate <ctate@google.com>
Fri, 17 Feb 2017 22:33:52 +0000 (14:33 -0800)
committerChristopher Tate <ctate@google.com>
Fri, 17 Feb 2017 22:40:10 +0000 (14:40 -0800)
Also expand the slew window for minimizing the effects of time-set
flapping from 500ms to 1000ms.

Bug 35319393

Change-Id: I6d6df1e086115ebe12c0bc4b9d761a11a0267012

services/core/java/com/android/server/AlarmManagerService.java

index b1560e6..02223c1 100644 (file)
@@ -2458,9 +2458,9 @@ class AlarmManagerService extends SystemService {
                         expectedClockTime = lastTimeChangeClockTime
                                 + (nowELAPSED - mLastTimeChangeRealtime);
                     }
-                    if (lastTimeChangeClockTime == 0 || nowRTC < (expectedClockTime-500)
-                            || nowRTC > (expectedClockTime+500)) {
-                        // The change is by at least +/- 500 ms (or this is the first change),
+                    if (lastTimeChangeClockTime == 0 || nowRTC < (expectedClockTime-1000)
+                            || nowRTC > (expectedClockTime+1000)) {
+                        // The change is by at least +/- 1000 ms (or this is the first change),
                         // let's do it!
                         if (DEBUG_BATCH) {
                             Slog.v(TAG, "Time changed notification from kernel; rebatching");
@@ -2477,7 +2477,8 @@ class AlarmManagerService extends SystemService {
                         }
                         Intent intent = new Intent(Intent.ACTION_TIME_CHANGED);
                         intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
-                                | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
+                                | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
+                                | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
                         getContext().sendBroadcastAsUser(intent, UserHandle.ALL);
 
                         // The world has changed on us, so we need to re-evaluate alarms