Loading api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -5082,8 +5082,11 @@ package android.service.notification { method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int); method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String); method public void onNotificationsSeen(java.util.List<java.lang.String>); method public void onSuggestedReplySent(java.lang.String, java.lang.CharSequence, int); method public final void unsnoozeNotification(java.lang.String); field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService"; field public static final int SOURCE_FROM_APP = 0; // 0x0 field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1 } public final class NotificationStats implements android.os.Parcelable { Loading api/test-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -1162,8 +1162,11 @@ package android.service.notification { method public void onNotificationExpansionChanged(java.lang.String, boolean, boolean); method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String); method public void onNotificationsSeen(java.util.List<java.lang.String>); method public void onSuggestedReplySent(java.lang.String, java.lang.CharSequence, int); method public final void unsnoozeNotification(java.lang.String); field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService"; field public static final int SOURCE_FROM_APP = 0; // 0x0 field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1 } public abstract class NotificationListenerService extends android.app.Service { Loading core/java/android/service/notification/INotificationListener.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,5 @@ oneway interface INotificationListener void onNotificationsSeen(in List<String> keys); void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded); void onNotificationDirectReply(String key); void onSuggestedReplySent(String key, in CharSequence reply, int source); } core/java/android/service/notification/NotificationAssistantService.java +38 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.service.notification; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.annotation.TestApi; Loading @@ -33,6 +36,7 @@ import android.util.Log; import com.android.internal.os.SomeArgs; import java.lang.annotation.Retention; import java.util.List; /** Loading Loading @@ -63,6 +67,13 @@ import java.util.List; public abstract class NotificationAssistantService extends NotificationListenerService { private static final String TAG = "NotificationAssistants"; /** @hide */ @Retention(SOURCE) @IntDef({SOURCE_FROM_APP, SOURCE_FROM_ASSISTANT}) public @interface Source {} public static final int SOURCE_FROM_APP = 0; public static final int SOURCE_FROM_ASSISTANT = 1; /** * The {@link Intent} that must be declared as handled by the service. */ Loading Loading @@ -174,6 +185,14 @@ public abstract class NotificationAssistantService extends NotificationListenerS */ public void onNotificationDirectReply(String key) {} /** * Implement this to know when a suggested reply is sent. * @param key the notification key * @param reply the reply that is just sent * @param source the source of the reply, e.g. SOURCE_FROM_APP */ public void onSuggestedReplySent(String key, CharSequence reply, @Source int source) {} /** * Updates a notification. N.B. this won’t cause * an existing notification to alert, but might allow a future update to Loading Loading @@ -289,6 +308,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT, args) .sendToTarget(); } @Override public void onSuggestedReplySent(String key, CharSequence reply, int source) { SomeArgs args = SomeArgs.obtain(); args.arg1 = key; args.arg2 = reply; args.argi2 = source; mHandler.obtainMessage(MyHandler.MSG_ON_SUGGESTED_REPLY_SENT, args).sendToTarget(); } } private final class MyHandler extends Handler { Loading @@ -297,6 +325,7 @@ public abstract class NotificationAssistantService extends NotificationListenerS public static final int MSG_ON_NOTIFICATIONS_SEEN = 3; public static final int MSG_ON_NOTIFICATION_EXPANSION_CHANGED = 4; public static final int MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT = 5; public static final int MSG_ON_SUGGESTED_REPLY_SENT = 6; public MyHandler(Looper looper) { super(looper, null, false); Loading Loading @@ -357,6 +386,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS onNotificationDirectReply(key); break; } case MSG_ON_SUGGESTED_REPLY_SENT: { SomeArgs args = (SomeArgs) msg.obj; String key = (String) args.arg1; CharSequence reply = (CharSequence) args.arg2; int source = args.argi2; args.recycle(); onSuggestedReplySent(key, reply, source); break; } } } } Loading core/java/android/service/notification/NotificationListenerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1376,6 +1376,11 @@ public abstract class NotificationListenerService extends Service { // no-op in the listener } @Override public void onSuggestedReplySent(String key, CharSequence reply, int source) { // no-op in the listener } @Override public void onNotificationChannelModification(String pkgName, UserHandle user, NotificationChannel channel, Loading Loading
api/system-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -5082,8 +5082,11 @@ package android.service.notification { method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, android.service.notification.NotificationStats, int); method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String); method public void onNotificationsSeen(java.util.List<java.lang.String>); method public void onSuggestedReplySent(java.lang.String, java.lang.CharSequence, int); method public final void unsnoozeNotification(java.lang.String); field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService"; field public static final int SOURCE_FROM_APP = 0; // 0x0 field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1 } public final class NotificationStats implements android.os.Parcelable { Loading
api/test-current.txt +3 −0 Original line number Diff line number Diff line Loading @@ -1162,8 +1162,11 @@ package android.service.notification { method public void onNotificationExpansionChanged(java.lang.String, boolean, boolean); method public abstract void onNotificationSnoozedUntilContext(android.service.notification.StatusBarNotification, java.lang.String); method public void onNotificationsSeen(java.util.List<java.lang.String>); method public void onSuggestedReplySent(java.lang.String, java.lang.CharSequence, int); method public final void unsnoozeNotification(java.lang.String); field public static final java.lang.String SERVICE_INTERFACE = "android.service.notification.NotificationAssistantService"; field public static final int SOURCE_FROM_APP = 0; // 0x0 field public static final int SOURCE_FROM_ASSISTANT = 1; // 0x1 } public abstract class NotificationListenerService extends android.app.Service { Loading
core/java/android/service/notification/INotificationListener.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,5 @@ oneway interface INotificationListener void onNotificationsSeen(in List<String> keys); void onNotificationExpansionChanged(String key, boolean userAction, boolean expanded); void onNotificationDirectReply(String key); void onSuggestedReplySent(String key, in CharSequence reply, int source); }
core/java/android/service/notification/NotificationAssistantService.java +38 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package android.service.notification; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.annotation.TestApi; Loading @@ -33,6 +36,7 @@ import android.util.Log; import com.android.internal.os.SomeArgs; import java.lang.annotation.Retention; import java.util.List; /** Loading Loading @@ -63,6 +67,13 @@ import java.util.List; public abstract class NotificationAssistantService extends NotificationListenerService { private static final String TAG = "NotificationAssistants"; /** @hide */ @Retention(SOURCE) @IntDef({SOURCE_FROM_APP, SOURCE_FROM_ASSISTANT}) public @interface Source {} public static final int SOURCE_FROM_APP = 0; public static final int SOURCE_FROM_ASSISTANT = 1; /** * The {@link Intent} that must be declared as handled by the service. */ Loading Loading @@ -174,6 +185,14 @@ public abstract class NotificationAssistantService extends NotificationListenerS */ public void onNotificationDirectReply(String key) {} /** * Implement this to know when a suggested reply is sent. * @param key the notification key * @param reply the reply that is just sent * @param source the source of the reply, e.g. SOURCE_FROM_APP */ public void onSuggestedReplySent(String key, CharSequence reply, @Source int source) {} /** * Updates a notification. N.B. this won’t cause * an existing notification to alert, but might allow a future update to Loading Loading @@ -289,6 +308,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT, args) .sendToTarget(); } @Override public void onSuggestedReplySent(String key, CharSequence reply, int source) { SomeArgs args = SomeArgs.obtain(); args.arg1 = key; args.arg2 = reply; args.argi2 = source; mHandler.obtainMessage(MyHandler.MSG_ON_SUGGESTED_REPLY_SENT, args).sendToTarget(); } } private final class MyHandler extends Handler { Loading @@ -297,6 +325,7 @@ public abstract class NotificationAssistantService extends NotificationListenerS public static final int MSG_ON_NOTIFICATIONS_SEEN = 3; public static final int MSG_ON_NOTIFICATION_EXPANSION_CHANGED = 4; public static final int MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT = 5; public static final int MSG_ON_SUGGESTED_REPLY_SENT = 6; public MyHandler(Looper looper) { super(looper, null, false); Loading Loading @@ -357,6 +386,15 @@ public abstract class NotificationAssistantService extends NotificationListenerS onNotificationDirectReply(key); break; } case MSG_ON_SUGGESTED_REPLY_SENT: { SomeArgs args = (SomeArgs) msg.obj; String key = (String) args.arg1; CharSequence reply = (CharSequence) args.arg2; int source = args.argi2; args.recycle(); onSuggestedReplySent(key, reply, source); break; } } } } Loading
core/java/android/service/notification/NotificationListenerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -1376,6 +1376,11 @@ public abstract class NotificationListenerService extends Service { // no-op in the listener } @Override public void onSuggestedReplySent(String key, CharSequence reply, int source) { // no-op in the listener } @Override public void onNotificationChannelModification(String pkgName, UserHandle user, NotificationChannel channel, Loading