feat(alarms): notify before an alarm rings, with Dismiss

Two hours before a natural occurrence (AOSP DeskClock's lead), a silent
"Upcoming alarm" notification offers Dismiss, and the alarm's row shows
the same Dismiss as a chip. Dismissing is dismissUpcoming's own branches:
a repeating alarm skips that occurrence, a one-shot is switched off.

The notices are synced at the end of every reschedule, after the real
registration, and a third AlarmManager slot on its own request code
wakes when the next window opens. The sync is wrapped so a notification
failure can never stop a ring. Dismiss names the occurrence and is
refused once the alarm is ringing or has moved, so it can't get round
the dismiss challenge. No challenge is asked before the ring, as in
Google Clock.

Fixes #16
This commit is contained in:
makiolaj committed 2026-10-21 20:01:21 +02:00
1 parent 3f431a7f32
commit e43339c386
25 files changed
+785 -33

No files matched your search

+5
View File
@@ -10,6 +10,10 @@
<string name="channel_alarm_ring_description">The full-screen alarm while it is ringing. Turning this off does not silence an alarm.</string>
<string name="channel_alarm_snoozed_name">Snoozed alarms</string>
<string name="channel_alarm_snoozed_description">A quiet reminder that an alarm is snoozed, and when it comes back.</string>
<string name="channel_alarm_upcoming_name">Upcoming alarms</string>
<string name="channel_alarm_upcoming_description">A silent note up to two hours before an alarm rings, so you can dismiss it if you are already up. Turning this off does not affect the alarm.</string>
<string name="alarm_upcoming_title">Upcoming alarm</string>
<string name="alarm_upcoming_text_labelled">%1$s · %2$s</string>
<string name="alarm_notification_title">Alarm</string>
<string name="alarm_action_snooze">Snooze</string>
<string name="alarm_action_dismiss">Dismiss</string>
@@ -102,6 +106,7 @@
<string name="alarms_add">Add alarm</string>
<string name="alarms_empty_hint">Tap + to set your first alarm</string>
<string name="alarm_row_toggle">Alarm at %1$s</string>
<string name="alarm_row_dismiss_upcoming">Dismiss the alarm at %1$s</string>
<string name="alarm_next_imminent">in less than a minute</string>
<plurals name="alarm_next_in_minutes">
<item quantity="one">in %1$d min</item>