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
diff --git a/services/core/java/com/android/server/AlarmManagerService.java b/services/core/java/com/android/server/AlarmManagerService.java
index 5f57a76..4667172 100644
--- a/services/core/java/com/android/server/AlarmManagerService.java
+++ b/services/core/java/com/android/server/AlarmManagerService.java
@@ -111,8 +111,9 @@
     
     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);