am 2bf7a17b: am 491b8f3b: Pull the change from DeskClock into AlarmClock.
Merge commit '2bf7a17be05fe433e1126da6689e3e9c1eed9e99'
* commit '2bf7a17be05fe433e1126da6689e3e9c1eed9e99':
Pull the change from DeskClock into AlarmClock.
diff --git a/src/com/android/alarmclock/AlarmAlertFullScreen.java b/src/com/android/alarmclock/AlarmAlertFullScreen.java
index 08c13f0..490426e 100644
--- a/src/com/android/alarmclock/AlarmAlertFullScreen.java
+++ b/src/com/android/alarmclock/AlarmAlertFullScreen.java
@@ -177,7 +177,8 @@
getString(R.string.alarm_notify_snooze_text,
Alarms.formatTime(this, c)), broadcast);
n.deleteIntent = broadcast;
- n.flags |= Notification.FLAG_AUTO_CANCEL;
+ n.flags |= Notification.FLAG_AUTO_CANCEL
+ | Notification.FLAG_ONGOING_EVENT;
nm.notify(mAlarm.id, n);
String displayTime = getString(R.string.alarm_alert_snooze_set,
diff --git a/src/com/android/alarmclock/AlarmReceiver.java b/src/com/android/alarmclock/AlarmReceiver.java
index 97374ef..f1d5d43 100644
--- a/src/com/android/alarmclock/AlarmReceiver.java
+++ b/src/com/android/alarmclock/AlarmReceiver.java
@@ -42,13 +42,7 @@
@Override
public void onReceive(Context context, Intent intent) {
- // Take care of the easy intents first.
- if (Alarms.CLEAR_NOTIFICATION.equals(intent.getAction())) {
- // If this is the "Clear All Notifications" intent, stop the alarm
- // service and return.
- context.stopService(new Intent(Alarms.ALARM_ALERT_ACTION));
- return;
- } else if (Alarms.ALARM_KILLED.equals(intent.getAction())) {
+ if (Alarms.ALARM_KILLED.equals(intent.getAction())) {
// The alarm has been killed, update the notification
updateNotification(context, (Alarm)
intent.getParcelableExtra(Alarms.ALARM_INTENT_EXTRA),
@@ -149,17 +143,12 @@
n.setLatestEventInfo(context, label,
context.getString(R.string.alarm_notify_text),
pendingNotify);
- n.flags |= Notification.FLAG_SHOW_LIGHTS;
+ n.flags |= Notification.FLAG_SHOW_LIGHTS
+ | Notification.FLAG_ONGOING_EVENT;
n.ledARGB = 0xFF00FF00;
n.ledOnMS = 500;
n.ledOffMS = 500;
- // Set the deleteIntent for when the user clicks "Clear All
- // Notifications"
- Intent clearAll = new Intent(context, AlarmReceiver.class);
- clearAll.setAction(Alarms.CLEAR_NOTIFICATION);
- n.deleteIntent = PendingIntent.getBroadcast(context, 0, clearAll, 0);
-
// Send the notification using the alarm id to easily identify the
// correct notification.
NotificationManager nm = getNotificationManager(context);
@@ -197,6 +186,10 @@
context.getString(R.string.alarm_alert_alert_silenced, timeout),
intent);
n.flags |= Notification.FLAG_AUTO_CANCEL;
+ // We have to cancel the original notification since it is in the
+ // ongoing section and we want the "killed" notification to be a plain
+ // notification.
+ nm.cancel(alarm.id);
nm.notify(alarm.id, n);
}
}
diff --git a/src/com/android/alarmclock/Alarms.java b/src/com/android/alarmclock/Alarms.java
index 63a67d7..ffbd129 100644
--- a/src/com/android/alarmclock/Alarms.java
+++ b/src/com/android/alarmclock/Alarms.java
@@ -43,9 +43,6 @@
// from the alarm manager.
public static final String ALARM_ALERT_ACTION = "com.android.alarmclock.ALARM_ALERT";
- // This is a private action used when the user clears all notifications.
- public static final String CLEAR_NOTIFICATION = "clear_notification";
-
// 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";