Loading core/java/android/app/Notification.java +4 −4 Original line number Diff line number Diff line Loading @@ -2702,11 +2702,11 @@ public class Notification implements Parcelable } /** * Specifies the time at which this notification should be canceled, if it is not already * canceled. * Specifies a duration in milliseconds after which this notification should be canceled, * if it is not already canceled. */ public Builder setTimeout(long when) { mN.mTimeout = when; public Builder setTimeout(long durationMs) { mN.mTimeout = durationMs; return this; } Loading core/java/android/service/notification/NotificationListenerService.java +4 −4 Original line number Diff line number Diff line Loading @@ -547,20 +547,20 @@ public abstract class NotificationListenerService extends Service { * Inform the notification manager about snoozing a specific notification. * <p> * Use this if your listener has a user interface that allows the user to snooze a notification * until a given time. It should be called after the user snoozes a single notification using * for a time. It should be called after the user snoozes a single notification using * your UI; upon being informed, the notification manager will actually remove the notification * and you will get an {@link #onNotificationRemoved(StatusBarNotification)} callback. When the * snoozing period expires, you will get a * {@link #onNotificationPosted(StatusBarNotification, RankingMap)} callback for the * notification. * @param key The key of the notification to snooze * @param snoozeUntil A time in the future, in milliseconds. * @param durationMs A duration to snooze the notification for, in milliseconds. */ public final void snoozeNotification(String key, long snoozeUntil) { public final void snoozeNotification(String key, long durationMs) { if (!isBound()) return; try { getNotificationInterface().snoozeNotificationUntilFromListener( mWrapper, key, snoozeUntil); mWrapper, key, durationMs); } catch (android.os.RemoteException ex) { Log.v(TAG, "Unable to contact notification manager", ex); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −3 Original line number Diff line number Diff line Loading @@ -5742,9 +5742,8 @@ public class StatusBar extends SystemUI implements DemoMode, if (snoozeOption.criterion != null) { mNotificationListener.snoozeNotification(sbn.getKey(), snoozeOption.criterion.getId()); } else { GregorianCalendar snoozeUntil = new GregorianCalendar(); snoozeUntil.add(Calendar.MINUTE, snoozeOption.snoozeForMinutes); mNotificationListener.snoozeNotification(sbn.getKey(), snoozeUntil.getTimeInMillis()); mNotificationListener.snoozeNotification(sbn.getKey(), snoozeOption.snoozeForMinutes * 60 * 1000); } } Loading services/core/java/com/android/server/notification/NotificationManagerService.java +10 −10 Original line number Diff line number Diff line Loading @@ -2029,11 +2029,11 @@ public class NotificationManagerService extends SystemService { */ @Override public void snoozeNotificationUntilFromListener(INotificationListener token, String key, long snoozeUntil) { long duration) { long identity = Binder.clearCallingIdentity(); try { final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token); snoozeNotificationInt(key, snoozeUntil, null, info); snoozeNotificationInt(key, duration, null, info); } finally { Binder.restoreCallingIdentity(identity); } Loading Loading @@ -3409,7 +3409,7 @@ public class NotificationManagerService extends SystemService { @VisibleForTesting void scheduleTimeoutLocked(NotificationRecord record) { if (record.getNotification().getTimeout() > System.currentTimeMillis()) { if (record.getNotification().getTimeout() > 0) { final PendingIntent pi = PendingIntent.getBroadcast(getContext(), REQUEST_CODE_TIMEOUT, new Intent(ACTION_NOTIFICATION_TIMEOUT) Loading @@ -3418,8 +3418,8 @@ public class NotificationManagerService extends SystemService { .addFlags(Intent.FLAG_RECEIVER_FOREGROUND) .putExtra(EXTRA_KEY, record.getKey()), PendingIntent.FLAG_UPDATE_CURRENT); mAlarmManager.setExactAndAllowWhileIdle( AlarmManager.RTC_WAKEUP, record.getNotification().getTimeout(), pi); mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + record.getNotification().getTimeout(), pi); } } Loading Loading @@ -4185,16 +4185,16 @@ public class NotificationManagerService extends SystemService { } } void snoozeNotificationInt(String key, long until, String snoozeCriterionId, void snoozeNotificationInt(String key, long duration, String snoozeCriterionId, ManagedServiceInfo listener) { String listenerName = listener == null ? null : listener.component.toShortString(); if (until < System.currentTimeMillis() && snoozeCriterionId == null) { if (duration <= 0 && snoozeCriterionId == null) { return; } if (DBG) { Slog.d(TAG, String.format("snooze event(%s, %d, %s, %s)", key, until, snoozeCriterionId, listenerName)); Slog.d(TAG, String.format("snooze event(%s, %d, %s, %s)", key, duration, snoozeCriterionId, listenerName)); } // Needs to post so that it can cancel notifications not yet enqueued. mHandler.post(new Runnable() { Loading @@ -4215,7 +4215,7 @@ public class NotificationManagerService extends SystemService { snoozeCriterionId); mSnoozeHelper.snooze(r); } else { mSnoozeHelper.snooze(r, until); mSnoozeHelper.snooze(r, duration); } savePolicyFile(); } Loading services/core/java/com/android/server/notification/SnoozeHelper.java +6 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Binder; import android.os.SystemClock; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; Loading Loading @@ -125,9 +126,9 @@ public class SnoozeHelper { /** * Snoozes a notification and schedules an alarm to repost at that time. */ protected void snooze(NotificationRecord record, long until) { protected void snooze(NotificationRecord record, long duration) { snooze(record); scheduleRepost(record.sbn.getPackageName(), record.getKey(), record.getUserId(), until); scheduleRepost(record.sbn.getPackageName(), record.getKey(), record.getUserId(), duration); } /** Loading Loading @@ -291,13 +292,14 @@ public class SnoozeHelper { PendingIntent.FLAG_UPDATE_CURRENT); } private void scheduleRepost(String pkg, String key, int userId, long time) { private void scheduleRepost(String pkg, String key, int userId, long duration) { long identity = Binder.clearCallingIdentity(); try { final PendingIntent pi = createPendingIntent(pkg, key, userId); mAm.cancel(pi); long time = SystemClock.elapsedRealtime() + duration; if (DEBUG) Slog.d(TAG, "Scheduling evaluate for " + new Date(time)); mAm.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, time, pi); mAm.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, time, pi); } finally { Binder.restoreCallingIdentity(identity); } Loading Loading
core/java/android/app/Notification.java +4 −4 Original line number Diff line number Diff line Loading @@ -2702,11 +2702,11 @@ public class Notification implements Parcelable } /** * Specifies the time at which this notification should be canceled, if it is not already * canceled. * Specifies a duration in milliseconds after which this notification should be canceled, * if it is not already canceled. */ public Builder setTimeout(long when) { mN.mTimeout = when; public Builder setTimeout(long durationMs) { mN.mTimeout = durationMs; return this; } Loading
core/java/android/service/notification/NotificationListenerService.java +4 −4 Original line number Diff line number Diff line Loading @@ -547,20 +547,20 @@ public abstract class NotificationListenerService extends Service { * Inform the notification manager about snoozing a specific notification. * <p> * Use this if your listener has a user interface that allows the user to snooze a notification * until a given time. It should be called after the user snoozes a single notification using * for a time. It should be called after the user snoozes a single notification using * your UI; upon being informed, the notification manager will actually remove the notification * and you will get an {@link #onNotificationRemoved(StatusBarNotification)} callback. When the * snoozing period expires, you will get a * {@link #onNotificationPosted(StatusBarNotification, RankingMap)} callback for the * notification. * @param key The key of the notification to snooze * @param snoozeUntil A time in the future, in milliseconds. * @param durationMs A duration to snooze the notification for, in milliseconds. */ public final void snoozeNotification(String key, long snoozeUntil) { public final void snoozeNotification(String key, long durationMs) { if (!isBound()) return; try { getNotificationInterface().snoozeNotificationUntilFromListener( mWrapper, key, snoozeUntil); mWrapper, key, durationMs); } catch (android.os.RemoteException ex) { Log.v(TAG, "Unable to contact notification manager", ex); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +2 −3 Original line number Diff line number Diff line Loading @@ -5742,9 +5742,8 @@ public class StatusBar extends SystemUI implements DemoMode, if (snoozeOption.criterion != null) { mNotificationListener.snoozeNotification(sbn.getKey(), snoozeOption.criterion.getId()); } else { GregorianCalendar snoozeUntil = new GregorianCalendar(); snoozeUntil.add(Calendar.MINUTE, snoozeOption.snoozeForMinutes); mNotificationListener.snoozeNotification(sbn.getKey(), snoozeUntil.getTimeInMillis()); mNotificationListener.snoozeNotification(sbn.getKey(), snoozeOption.snoozeForMinutes * 60 * 1000); } } Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +10 −10 Original line number Diff line number Diff line Loading @@ -2029,11 +2029,11 @@ public class NotificationManagerService extends SystemService { */ @Override public void snoozeNotificationUntilFromListener(INotificationListener token, String key, long snoozeUntil) { long duration) { long identity = Binder.clearCallingIdentity(); try { final ManagedServiceInfo info = mListeners.checkServiceTokenLocked(token); snoozeNotificationInt(key, snoozeUntil, null, info); snoozeNotificationInt(key, duration, null, info); } finally { Binder.restoreCallingIdentity(identity); } Loading Loading @@ -3409,7 +3409,7 @@ public class NotificationManagerService extends SystemService { @VisibleForTesting void scheduleTimeoutLocked(NotificationRecord record) { if (record.getNotification().getTimeout() > System.currentTimeMillis()) { if (record.getNotification().getTimeout() > 0) { final PendingIntent pi = PendingIntent.getBroadcast(getContext(), REQUEST_CODE_TIMEOUT, new Intent(ACTION_NOTIFICATION_TIMEOUT) Loading @@ -3418,8 +3418,8 @@ public class NotificationManagerService extends SystemService { .addFlags(Intent.FLAG_RECEIVER_FOREGROUND) .putExtra(EXTRA_KEY, record.getKey()), PendingIntent.FLAG_UPDATE_CURRENT); mAlarmManager.setExactAndAllowWhileIdle( AlarmManager.RTC_WAKEUP, record.getNotification().getTimeout(), pi); mAlarmManager.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + record.getNotification().getTimeout(), pi); } } Loading Loading @@ -4185,16 +4185,16 @@ public class NotificationManagerService extends SystemService { } } void snoozeNotificationInt(String key, long until, String snoozeCriterionId, void snoozeNotificationInt(String key, long duration, String snoozeCriterionId, ManagedServiceInfo listener) { String listenerName = listener == null ? null : listener.component.toShortString(); if (until < System.currentTimeMillis() && snoozeCriterionId == null) { if (duration <= 0 && snoozeCriterionId == null) { return; } if (DBG) { Slog.d(TAG, String.format("snooze event(%s, %d, %s, %s)", key, until, snoozeCriterionId, listenerName)); Slog.d(TAG, String.format("snooze event(%s, %d, %s, %s)", key, duration, snoozeCriterionId, listenerName)); } // Needs to post so that it can cancel notifications not yet enqueued. mHandler.post(new Runnable() { Loading @@ -4215,7 +4215,7 @@ public class NotificationManagerService extends SystemService { snoozeCriterionId); mSnoozeHelper.snooze(r); } else { mSnoozeHelper.snooze(r, until); mSnoozeHelper.snooze(r, duration); } savePolicyFile(); } Loading
services/core/java/com/android/server/notification/SnoozeHelper.java +6 −4 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.net.Uri; import android.os.Binder; import android.os.SystemClock; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; Loading Loading @@ -125,9 +126,9 @@ public class SnoozeHelper { /** * Snoozes a notification and schedules an alarm to repost at that time. */ protected void snooze(NotificationRecord record, long until) { protected void snooze(NotificationRecord record, long duration) { snooze(record); scheduleRepost(record.sbn.getPackageName(), record.getKey(), record.getUserId(), until); scheduleRepost(record.sbn.getPackageName(), record.getKey(), record.getUserId(), duration); } /** Loading Loading @@ -291,13 +292,14 @@ public class SnoozeHelper { PendingIntent.FLAG_UPDATE_CURRENT); } private void scheduleRepost(String pkg, String key, int userId, long time) { private void scheduleRepost(String pkg, String key, int userId, long duration) { long identity = Binder.clearCallingIdentity(); try { final PendingIntent pi = createPendingIntent(pkg, key, userId); mAm.cancel(pi); long time = SystemClock.elapsedRealtime() + duration; if (DEBUG) Slog.d(TAG, "Scheduling evaluate for " + new Date(time)); mAm.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, time, pi); mAm.setExactAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP, time, pi); } finally { Binder.restoreCallingIdentity(identity); } Loading