From 24cd46f392baacec17adc90b4e30918e096bdfcf Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 2 Feb 2016 14:28:01 -0800 Subject: Send ALARM_CLOCK_CHANGED broadcast with REPLACE_PENDING Spammy behavior, including app bugs, has been seen in the field to induce situations where there were thousands of duplicate ALARM_CLOCK_CHANGED broadcasts in the queue awaiting delivery. They're relatively inexpensive to deliver but not free, and this has considerable impact on both the system's ability to issue broadcasts and the ability of this broadcast's subscribed receivers to do other work besides processing them. Bug 26910849 Change-Id: Ic91f25514a26d41a1b1b4cb44489d1575fe1867c --- services/core/java/com/android/server/AlarmManagerService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java index 5f57a7632db9..46671729a2ef 100644 --- a/services/core/java/com/android/server/AlarmManagerService.java +++ b/services/core/java/com/android/server/AlarmManagerService.java @@ -111,8 +111,9 @@ class AlarmManagerService extends SystemService { static final boolean WAKEUP_STATS = false; - private static final Intent NEXT_ALARM_CLOCK_CHANGED_INTENT = new Intent( - AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED); + private static final Intent NEXT_ALARM_CLOCK_CHANGED_INTENT = + new Intent(AlarmManager.ACTION_NEXT_ALARM_CLOCK_CHANGED) + .addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); final LocalLog mLog = new LocalLog(TAG); -- cgit v1.2.3-59-g8ed1b