[Defy Android Development] YetAnotherForumUser:
History repeats itself, or the ever-returning alarm clock bug

Those of you who've been around these threads for a while might remember I found some bugs in the default alarm clock apps in CM10 and CM10.1. The CM10 alarm clock (or rather the alarm function in 'DeskClock') mishandled the AlarmManager (for which I made a patch and reported a bug at AOSP). The CM10.1 DeskClock only sounded the alarm once, after which it remained silent until the phone was rebooted.

The latter bug - or at least a variation on it - is still alive and kicking in the current iteration of DeskClock. It spams the alarm list with copies of the same alarm event...

# dumpsys alarm
Current Alarm Manager state:

Realtime wakeup (now=2013-05-03 18:37:04):
RTC_WAKEUP #23: Alarm{414bd2f0 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{412d4b78: PendingIntentRecord{414621d8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #22: Alarm{414a3260 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{414a7360: PendingIntentRecord{4160b7a8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #21: Alarm{40e78088 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40e04530: PendingIntentRecord{40e81960 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #20: Alarm{40dd1808 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40dff228: PendingIntentRecord{40ddc640 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #19: Alarm{40ed4188 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{41357908: PendingIntentRecord{40ed40e8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #18: Alarm{40d97188 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40dfe380: PendingIntentRecord{40d3c360 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #17: Alarm{413b64b0 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{411ac3d0: PendingIntentRecord{413b6410 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #16: Alarm{413caa38 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{411a1bd0: PendingIntentRecord{413ca8d0 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #15: Alarm{40fe7888 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40ddc278: PendingIntentRecord{41009188 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #14: Alarm{41347970 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{414b4c90: PendingIntentRecord{412e4040 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #13: Alarm{40e35708 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{411c29e8: PendingIntentRecord{40e35668 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #12: Alarm{411d96b0 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{41185530: PendingIntentRecord{4115c0d8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #11: Alarm{4160f148 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{4160f138: PendingIntentRecord{4160f098 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #10: Alarm{411690f0 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{4116f730: PendingIntentRecord{4116e340 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #9: Alarm{41414628 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40ed9ca8: PendingIntentRecord{41414588 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #8: Alarm{40d2f878 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40d12cf0: PendingIntentRecord{40d2f7d8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #7: Alarm{414a2200 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{41399370: PendingIntentRecord{413e19d8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #6: Alarm{411a7008 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{4147a920: PendingIntentRecord{4118a5e0 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #5: Alarm{4156e8f0 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40de2e18: PendingIntentRecord{4156e850 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #4: Alarm{41005840 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{40fa5fb0: PendingIntentRecord{410057a0 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #3: Alarm{41025ec8 type 0 com.android.deskclock}
type=0 when=+1d14h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{4146b338: PendingIntentRecord{41025dd8 com.android.deskclock broadcastIntent}}
RTC_WAKEUP #2: Alarm{414e5c80 type 0 com.android.providers.calendar}
type=0 when=+20h30m30s199ms repeatInterval=0 count=0
operation=PendingIntent{414e5c70: PendingIntentRecord{414e5bd0 com.android.providers.calendar broadcastIntent}}
RTC_WAKEUP #1: Alarm{40e0f1b0 type 0 com.google.android.gms}
type=0 when=+7h22m55s907ms repeatInterval=86400000 count=1
operation=PendingIntent{40f1e2c8: PendingIntentRecord{40e0f0c0 com.google.android.gms startService}}
RTC_WAKEUP #0: Alarm{412e65e0 type 0 com.google.android.gms}
type=0 when=+2h54m51s186ms repeatInterval=0 count=0
operation=PendingIntent{40d254b0: PendingIntentRecord{40e29058 com.google.android.gms broadcastIntent}}
RTC #1: Alarm{41646b08 type 1 android}
type=1 when=+17h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{41053a88: PendingIntentRecord{41036e88 android broadcastIntent}}
RTC #0: Alarm{40ef9ff0 type 1 com.android.calendar}
type=1 when=+5h22m55s907ms repeatInterval=0 count=0
operation=PendingIntent{4112c0c8: PendingIntentRecord{40f2e560 com.android.calendar broadcastIntent}}

...and it regularly 'forgets' to sound the alarm. When the alarm does not sound a quick check of [FONT="Monospace, Courier New"]dumpsys alarm[/FONT] shows no entries for com.android.deskclock, neither active nor expired.

I'll try to make a patch for this bug as I do tend to use the alarm clock. It surprises me that nobody else has ever reported anything on these issues, as far as I can tell these bugs should occur on all CM10.1 installations.