Lines Matching refs:alarm

57  * This class handles all the state changes for alarm instances. You need to
58 * register all alarm instances with the state manager if you want them to
68 * This state is used when the alarm is activated, but doesn't need to display anything. It
69 * is in charge of changing the alarm instance state to a LOW_NOTIFICATION_STATE.
72 * This state is used to notify the user that the alarm will go off
87 * also increments the alarm time in the instance to reflect the new snooze time.
90 * The FIRED_STATE is used when the alarm is firing. It will start the AlarmService, and wait
91 * until the user interacts with the alarm via SNOOZED_STATE or DISMISS_STATE change. If the user
95 * The MISSED_STATE is used when the alarm already fired, but the user could not interact with
96 * it. At this point the alarm instance is dead and we check the parent alarm to see if we need
98 * that he/she missed the alarm and that stays for
102 * This is really a transient state that will properly delete the alarm instance. Use this state,
103 * whenever you want to get rid of the alarm instance. This state will also check the alarm
104 * parent to see if it should disable or schedule a new alarm instance.
110 // Intent action to show the alarm and dismiss the instance
113 // Intent action for an AlarmManager alarm serving only to set the next alarm indicators
116 // System intent action to notify AppWidget that we changed the alarm text.
120 public static final String ALARM_STATE_EXTRA = "intent.extra.alarm.state";
126 private static final String ALARM_GLOBAL_ID_EXTRA = "intent.extra.alarm.global.id";
128 // Intent category tags used to dismiss, snooze or delete an alarm
133 // Intent category tag used when schedule state change intents in alarm manager.
136 // Buffer time in seconds to fire alarm instead of marking it missed.
142 // Schedules alarm state transitions; can be mocked for testing purposes.
164 * Update the next alarm stored in framework. This value is also displayed in digital widgets
178 * Returns an alarm instance of an alarm that's going to fire next.
181 * @return an alarm instance that will fire earliest relative to current time.
198 * Used in pre-L devices, where "next alarm" is stored in system settings.
203 // Format the next alarm time if an alarm is scheduled.
213 LogUtils.i("Updated next alarm time to: \'" + time + '\'');
219 LogUtils.e("Unable to update next alarm to: \'" + time + '\'', se);
224 * Used in L and later devices where "next alarm" is stored in the Alarm Manager.
228 // Sets a surrogate alarm with alarm manager that provides the AlarmClockInfo for the
229 // alarm that is going to fire next. The operation is constructed such that it is ignored
239 LogUtils.i("Setting upcoming AlarmClockInfo for alarm: " + nextAlarm.mId);
242 // Create an intent that can be used to show or edit details of the next alarm.
256 * Used by dismissed and missed states, to update parent alarm. This will either
257 * disable, delete or reschedule parent alarm.
264 Alarm alarm = Alarm.getAlarm(cr, instance.mAlarmId);
265 if (alarm == null) {
270 if (!alarm.daysOfWeek.isRepeating()) {
271 if (alarm.deleteAfterUse) {
272 LogUtils.i("Deleting parent alarm: " + alarm.id);
273 Alarm.deleteAlarm(cr, alarm.id);
275 LogUtils.i("Disabling parent alarm: " + alarm.id);
276 alarm.enabled = false;
277 Alarm.updateAlarm(cr, alarm);
283 AlarmInstance nextRepeatedInstance = alarm.createInstanceAfter(getCurrentTime());
286 nextRepeatedInstance = alarm.createInstanceAfter(instance.getAlarmTime());
289 LogUtils.i("Creating new instance for repeating alarm " + alarm.id + " at " +
303 * @return intent that can be used to change an alarm instance state
310 // Out Of Memory killer. If clock is killed during that jump, firing an alarm can fail to
312 // firing alarm if needed, so no jump is needed.
324 * Schedule alarm instance state changes with {@link AlarmManager}.
348 * This will set the alarm instance to the SILENT_STATE and update
358 // Update alarm in db
370 * This will set the alarm instance to the LOW_NOTIFICATION_STATE and update
380 // Update alarm state in db
392 * This will set the alarm instance to the HIDE_NOTIFICATION_STATE and update
402 // Update alarm state in db
414 * This will set the alarm instance to the HIGH_NOTIFICATION_STATE and update
424 // Update alarm state in db
436 * This will set the alarm instance to the FIRED_STATE and update
446 // Update alarm state in db
465 // Instance not valid anymore, so find next alarm that will fire and notify system
470 * This will set the alarm instance to the SNOOZE_STATE and update
479 // Stop alarm if this instance is firing it
482 // Calculate the new snooze alarm time
487 // Update alarm state and new alarm time in db.
514 // Instance time changed, so find next alarm that will fire and notify system
519 * This will set the alarm instance to the MISSED_STATE and update
528 // Stop alarm if this instance is firing it
536 // Update alarm state
546 // Instance is not valid anymore, so find next alarm that will fire and notify system
551 * This will set the alarm instance to the PREDISMISSED_STATE and schedule an instance state
560 // Update alarm in db
579 * This just sets the alarm instance to DISMISSED_STATE.
589 * This will delete the alarm instance, update the application notifications, and schedule
596 LogUtils.i("Deleting instance " + instance.mId + " and updating parent alarm.");
609 // Instance is not valid anymore, so find next alarm that will fire and notify system
615 * alarm timers.
622 // Stop alarm if this instance is firing it
635 * have to correct the alarm instance state. This means we have to handle special cases as
643 * <li>If alarm was SNOOZED, then show the notification but don't update time</li>
657 final Alarm alarm = Alarm.getAlarm(cr, instance.mAlarmId);
672 // Keep alarm firing, unless it should be timed out
681 LogUtils.i("Cannot restore missed instance for one-time alarm");
692 // Make sure we re-enable the parent alarm of the instance
694 alarm.enabled = true;
695 Alarm.updateAlarm(cr, alarm);
711 // There is a chance that the TIME_SET occurred right when the alarm should go off, so
712 // we need to add a check to see if we should fire the alarm instead of marking it
738 // Alarm is still active, so initialize as a silent alarm
750 * the alarm itself. This should be used whenever modifying or deleting an alarm.
756 LogUtils.i("Deleting all instances of alarm: " + alarmId);
767 * Delete and unregister all instances unless they are snoozed. This is used whenever an alarm
771 LogUtils.i("Deleting all non-snooze instances of alarm: " + alarmId);
785 * Fix and update all alarm instance when a time change event occurs.
790 LogUtils.i("Fixing alarm instances");
808 final Alarm alarm = Alarm.getAlarm(contentResolver, instance.mAlarmId);
809 if (alarm == null) {
812 LogUtils.e("Found instance without matching alarm; deleting instance %s", instance);
815 final Calendar priorAlarmTime = alarm.getPreviousAlarmTime(instance.getAlarmTime());
819 final Calendar newAlarmTime = alarm.getNextAlarmTime(currentTime);
822 LogUtils.i("A time change has caused an existing alarm scheduled to fire at %s to" +
823 " be replaced by a new alarm scheduled to fire at %s", oldTime, newTime);
837 * Utility method to set alarm instance state via constants.
845 LogUtils.e("Null alarm instance while setting state to %d", state);
877 LogUtils.e("Trying to change to unknown alarm state: " + state);
967 * Creates an intent that can be used to set an AlarmManager alarm to set the next alarm
1007 // Treat alarm state change as high priority, use foreground broadcasts
1014 // Ensure the alarm fires even if the device is dozing.