From c25977ad0dcc5a85c51d575ccbe22ef7f3d42209 Mon Sep 17 00:00:00 2001 From: Danning Chen Date: Sat, 6 Feb 2021 01:57:56 -0800 Subject: [PATCH] Expose onNotificationChannelModified() callback to NotificationAssistantService Change-Id: I71a72298ed1bbd905ed3b35b67964e1f113b7bc0 Test: manual - verify the new method is called in NAS Bug: 179520528 Bug: 163614153 --- .../android/service/notification/INotificationListener.aidl | 2 +- .../server/notification/NotificationManagerService.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/service/notification/INotificationListener.aidl b/core/java/android/service/notification/INotificationListener.aidl index 44daeff76997d..2b7cb1db174a1 100644 --- a/core/java/android/service/notification/INotificationListener.aidl +++ b/core/java/android/service/notification/INotificationListener.aidl @@ -41,7 +41,7 @@ oneway interface INotificationListener void onListenerHintsChanged(int hints); void onInterruptionFilterChanged(int interruptionFilter); - // companion device managers only + // companion device managers and assistants only void onNotificationChannelModification(String pkgName, in UserHandle user, in NotificationChannel channel, int modificationType); void onNotificationChannelGroupModification(String pkgName, in UserHandle user, in NotificationChannelGroup group, int modificationType); diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java index 6843733eea9fe..669dfc7f95485 100755 --- a/services/core/java/com/android/server/notification/NotificationManagerService.java +++ b/services/core/java/com/android/server/notification/NotificationManagerService.java @@ -10103,7 +10103,9 @@ public class NotificationManagerService extends SystemService { } BackgroundThread.getHandler().post(() -> { - if (info.isSystem || hasCompanionDevice(info)) { + if (info.isSystem + || hasCompanionDevice(info) + || mAssistants.isServiceTokenValidLocked(info.service)) { notifyNotificationChannelChanged( info, pkg, user, channel, modificationType); }