Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3752e507 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Add support for snoozing notifications"

parents e9abd804 72f1cbb3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -34854,6 +34854,7 @@ package android.service.notification {
    method public static void requestRebind(android.content.ComponentName);
    method public final void requestUnbind();
    method public final void setNotificationsShown(java.lang.String[]);
    method public final void snoozeNotification(java.lang.String, long);
    field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4
    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
    field public static final int HINT_HOST_DISABLE_NOTIFICATION_EFFECTS = 2; // 0x2
+2 −0
Original line number Diff line number Diff line
@@ -37634,6 +37634,7 @@ package android.service.notification {
    method public final void requestUnbind();
    method public final void setNotificationsShown(java.lang.String[]);
    method public final void setOnNotificationPostedTrim(int);
    method public final void snoozeNotification(java.lang.String, long);
    method public void unregisterAsSystemService() throws android.os.RemoteException;
    field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4
    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
@@ -37695,6 +37696,7 @@ package android.service.notification {
    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
    field public static final int REASON_SNOOZED = 18; // 0x12
    field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
    field public static final int REASON_USER_STOPPED = 6; // 0x6
    field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationRankerService";
+1 −0
Original line number Diff line number Diff line
@@ -34935,6 +34935,7 @@ package android.service.notification {
    method public static void requestRebind(android.content.ComponentName);
    method public final void requestUnbind();
    method public final void setNotificationsShown(java.lang.String[]);
    method public final void snoozeNotification(java.lang.String, long);
    field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4
    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
    field public static final int HINT_HOST_DISABLE_NOTIFICATION_EFFECTS = 2; // 0x2
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ interface INotificationManager
    void cancelNotificationFromListener(in INotificationListener token, String pkg, String tag, int id);
    void cancelNotificationsFromListener(in INotificationListener token, in String[] keys);

    void snoozeNotificationFromListener(in INotificationListener token, String key, long until);

    void requestBindListener(in ComponentName component);
    void requestUnbindListener(in INotificationListener token);
    void requestBindProvider(in ComponentName component);
+22 −0
Original line number Diff line number Diff line
@@ -449,6 +449,28 @@ 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
     * 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.
     */
    public final void snoozeNotification(String key, long snoozeUntil) {
        if (!isBound()) return;
        try {
            getNotificationInterface().snoozeNotificationFromListener(mWrapper, key, snoozeUntil);
        } catch (android.os.RemoteException ex) {
            Log.v(TAG, "Unable to contact notification manager", ex);
        }
    }

    /**
     * Inform the notification manager that these notifications have been viewed by the
     * user. This should only be called when there is sufficient confidence that the user is
Loading