[Defy Android Development] YetAnotherForumUser:
As a follow-up on my bug report about com.android.deskclock I can add that the bug still manifests itself after changing to the AOSP 4.2.2 version of DeskClock.apk (the version included in Quarx' latest experimental distribution).

The bug probably lies with the use of PendingIntent.FLAG_CANCEL_CURRENT instead of PendingIntent.FLAG_REPLACE_CURRENT in src/com/android/deskclock/Alarms.java in the DeskClock app. I don't have time to check this at the moment but I'll give it a go at some later moment.

This is the state of the alarm table on my phone after first adding, then deleting an alarm scheduled to go off in about 37 minutes:

Realtime wakeup (now=2013-03-03 12:22:34):
RTC_WAKEUP #12: Alarm{40e920d8 type 0 com.google.android.gsf}
type=0 when=+6d5h6m27s211ms repeatInterval=571535000 count=0
operation=PendingIntent{40eaf000: PendingIntentRecord{40e93330 com.google.android.gsf broadcastIntent}}
RTC_WAKEUP #11: Alarm{41554ae0 type 0 com.android.providers.calendar}
type=0 when=+20h48m18s937ms repeatInterval=0 count=0
operation=PendingIntent{410760d8: PendingIntentRecord{41554a40 com.android.providers.calendar broadcastIntent}}
RTC_WAKEUP #10: Alarm{41334a98 type 0 com.android.deskclock}
type=0 when=+19h7m25s359ms repeatInterval=0 count=0
operation=PendingIntent{412f57b8: PendingIntentRecord{413349a8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #9: Alarm{41567e38 type 0 com.android.vending}
type=0 when=+14h20m45s144ms repeatInterval=0 count=0
operation=PendingIntent{41567e28: PendingIntentRecord{4140f690 com.android.vending startService}}
RTC_WAKEUP #8: Alarm{413ce0c0 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40f18190: PendingIntentRecord{413cdfe8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #7: Alarm{41360100 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40f8e518: PendingIntentRecord{41360060 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #6: Alarm{415685d8 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40e95bc0: PendingIntentRecord{41568538 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #5: Alarm{40e26638 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40efb930: PendingIntentRecord{41490330 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #4: Alarm{40deb7d8 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{41099d98: PendingIntentRecord{411a4bb8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #3: Alarm{4134ce30 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40eda6e0: PendingIntentRecord{4134cd90 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #2: Alarm{414be4d8 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40ef3010: PendingIntentRecord{414be438 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #1: Alarm{4158dbe8 type 0 com.android.deskclock}
type=0 when=+37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{41426f60: PendingIntentRecord{4158db68 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #0: Alarm{410061c8 type 0 com.sgiggle.production}
type=0 when=+1m39s374ms repeatInterval=480000 count=1
operation=PendingIntent{4103bdd8: PendingIntentRecord{40e03e08 com.sgiggle.production startService}}
RTC #1: Alarm{4118ff30 type 1 android}
type=1 when=+11h37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{411cbfb8: PendingIntentRecord{411bdfc8 android broadcastIntent}}
RTC #0: Alarm{40e763c0 type 1 com.android.calendar}
type=1 when=+11h37m25s359ms repeatInterval=0 count=0
operation=PendingIntent{40ffde40: PendingIntentRecord{411d3890 com.android.calendar broadcastIntent}}

Notice that there are still scheduled RTC_WAKEUP events for com.android.deskclock around the scheduled alarm time, even though that alarm has been deleted from the alarm list. Also notice that there are 8 scheduled RTC_WAKEUP events at exactly the same moment. What seems to happen is that every time com.android.deskclock interacts with the alarm table it 'updates' all scheduled events. Because it uses FLAG_CANCEL_CURRENT instead of FLAG_REPLACE_CURRENT the AlarmManager does not know that those updates are meant to replace pending events so it adds them instead, accumulating alarms in the process.

That is the theory, more later.

BTW, force-killing deskclock cancels all pending alarms for that origin. It is not necessary to stop/start zygote as I implied in the previous bug report.