OSDN Git Service

Adds hooks to DeskClock so that other programs may kill or
[android-x86/packages-apps-DeskClock.git] / src / com / android / deskclock / Alarms.java
index 92457ad..1e331a2 100644 (file)
@@ -44,6 +44,19 @@ public class Alarms {
     // from the alarm manager.
     public static final String ALARM_ALERT_ACTION = "com.android.deskclock.ALARM_ALERT";
 
+    // A public action sent by AlarmKlaxon when the alarm has stopped sounding
+    // for any reason (e.g. because it has been dismissed from AlarmAlertFullScreen,
+    // or killed due to an incoming phone call, etc).
+    public static final String ALARM_DONE_ACTION = "com.android.deskclock.ALARM_DONE";
+
+    // AlarmAlertFullScreen listens for this broadcast intent, so that other applications
+    // can snooze the alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION).
+    public static final String ALARM_SNOOZE_ACTION = "com.android.deskclock.ALARM_SNOOZE";
+
+    // AlarmAlertFullScreen listens for this broadcast intent, so that other applications
+    // can dismiss the alarm (after ALARM_ALERT_ACTION and before ALARM_DONE_ACTION).
+    public static final String ALARM_DISMISS_ACTION = "com.android.deskclock.ALARM_DISMISS";
+
     // This is a private action used by the AlarmKlaxon to update the UI to
     // show the alarm has been killed.
     public static final String ALARM_KILLED = "alarm_killed";
@@ -201,6 +214,15 @@ public class Alarms {
         long timeInMillis = calculateAlarm(alarm);
 
         if (alarm.enabled) {
+            // Disable the snooze if we just changed the snoozed alarm. This
+            // only does work if the snoozed alarm is the same as the given
+            // alarm.
+            // TODO: disableSnoozeAlert should have a better name.
+            disableSnoozeAlert(context, alarm.id);
+
+            // Disable the snooze if this alarm fires before the snoozed alarm.
+            // This works on every alarm since the user most likely intends to
+            // have the modified alarm fire next.
             clearSnoozeIfNeeded(context, timeInMillis);
         }