Loading packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationListenerController.java +21 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package com.android.systemui.plugins; import android.app.NotificationChannel; import android.os.UserHandle; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; Loading @@ -30,13 +32,32 @@ public interface NotificationListenerController extends Plugin { void onListenerConnected(NotificationProvider provider); /** * @return whether plugin wants to skip the default callbacks. */ default boolean onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) { return false; } /** * @return whether plugin wants to skip the default callbacks. */ default boolean onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) { return false; } /** * Called when a notification channel is modified. * @param modificationType One of {@link #NOTIFICATION_CHANNEL_OR_GROUP_ADDED}, * {@link #NOTIFICATION_CHANNEL_OR_GROUP_UPDATED}, * {@link #NOTIFICATION_CHANNEL_OR_GROUP_DELETED}. * @return whether a plugin wants to skip the default callbacks. */ default boolean onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { return false; } default StatusBarNotification[] getActiveNotifications( StatusBarNotification[] activeNotifications) { return activeNotifications; Loading packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.people.widget; import android.app.NotificationChannel; import android.content.ComponentName; import android.content.Context; import android.os.ServiceManager; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.util.Log; Loading Loading @@ -130,6 +132,18 @@ public class PeopleSpaceWidgetManager { if (DEBUG) Log.d(TAG, "onNotificationsInitialized"); updateWidgets(); } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { if (DEBUG) Log.d(TAG, "onNotificationChannelModified"); if (channel.isConversation()) { updateWidgets(); } } }; } packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +22 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static com.android.systemui.statusbar.phone.StatusBar.DEBUG; import android.annotation.NonNull; import android.annotation.SuppressLint; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -158,6 +159,19 @@ public class NotificationListener extends NotificationListenerWithPlugins { } } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { if (DEBUG) Log.d(TAG, "onNotificationChannelModified"); if (!onPluginNotificationChannelModified(pkgName, user, channel, modificationType)) { mMainHandler.post(() -> { for (NotificationHandler handler : mNotificationHandlers) { handler.onNotificationChannelModified(pkgName, user, channel, modificationType); } }); } } @Override public void onSilentStatusBarIconsVisibilityChanged(boolean hideSilentStatusIcons) { for (NotificationSettingsListener listener : mSettingsListeners) { Loading Loading @@ -229,6 +243,14 @@ public class NotificationListener extends NotificationListenerWithPlugins { void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap, int reason); void onNotificationRankingUpdate(RankingMap rankingMap); /** Called after a notification channel is modified. */ default void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { } /** * Called after the listener has connected to NoMan and posted any current notifications. */ Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java +11 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.systemui.statusbar.notification.collection.coalescer; import static java.util.Objects.requireNonNull; import android.annotation.MainThread; import android.app.NotificationChannel; import android.os.UserHandle; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; Loading Loading @@ -158,6 +160,15 @@ public class GroupCoalescer implements Dumpable { public void onNotificationsInitialized() { mHandler.onNotificationsInitialized(); } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { mHandler.onNotificationChannelModified(pkgName, user, channel, modificationType); } }; private void maybeEmitBatch(StatusBarNotification sbn) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationListenerWithPlugins.java +18 −2 Original line number Diff line number Diff line Loading @@ -14,9 +14,11 @@ package com.android.systemui.statusbar.phone; import android.app.NotificationChannel; import android.content.ComponentName; import android.content.Context; import android.os.RemoteException; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; Loading Loading @@ -78,7 +80,7 @@ public class NotificationListenerWithPlugins extends NotificationListenerService /** * Called when listener receives a onNotificationPosted. * Returns true to indicate this callback should be skipped. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationPosted(StatusBarNotification sbn, final RankingMap rankingMap) { Loading @@ -92,7 +94,7 @@ public class NotificationListenerWithPlugins extends NotificationListenerService /** * Called when listener receives a onNotificationRemoved. * Returns true to indicate this callback should be skipped. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationRemoved(StatusBarNotification sbn, final RankingMap rankingMap) { Loading @@ -104,6 +106,20 @@ public class NotificationListenerWithPlugins extends NotificationListenerService return false; } /** * Called when listener receives a onNotificationChannelModified. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { for (NotificationListenerController plugin : mPlugins) { if (plugin.onNotificationChannelModified(pkgName, user, channel, modificationType)) { return true; } } return false; } public RankingMap onPluginRankingUpdate(RankingMap rankingMap) { return getCurrentRanking(); } Loading Loading
packages/SystemUI/plugin/src/com/android/systemui/plugins/NotificationListenerController.java +21 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package com.android.systemui.plugins; import android.app.NotificationChannel; import android.os.UserHandle; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; Loading @@ -30,13 +32,32 @@ public interface NotificationListenerController extends Plugin { void onListenerConnected(NotificationProvider provider); /** * @return whether plugin wants to skip the default callbacks. */ default boolean onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) { return false; } /** * @return whether plugin wants to skip the default callbacks. */ default boolean onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) { return false; } /** * Called when a notification channel is modified. * @param modificationType One of {@link #NOTIFICATION_CHANNEL_OR_GROUP_ADDED}, * {@link #NOTIFICATION_CHANNEL_OR_GROUP_UPDATED}, * {@link #NOTIFICATION_CHANNEL_OR_GROUP_DELETED}. * @return whether a plugin wants to skip the default callbacks. */ default boolean onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { return false; } default StatusBarNotification[] getActiveNotifications( StatusBarNotification[] activeNotifications) { return activeNotifications; Loading
packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,11 @@ package com.android.systemui.people.widget; import android.app.NotificationChannel; import android.content.ComponentName; import android.content.Context; import android.os.ServiceManager; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; import android.util.Log; Loading Loading @@ -130,6 +132,18 @@ public class PeopleSpaceWidgetManager { if (DEBUG) Log.d(TAG, "onNotificationsInitialized"); updateWidgets(); } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { if (DEBUG) Log.d(TAG, "onNotificationChannelModified"); if (channel.isConversation()) { updateWidgets(); } } }; }
packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +22 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static com.android.systemui.statusbar.phone.StatusBar.DEBUG; import android.annotation.NonNull; import android.annotation.SuppressLint; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -158,6 +159,19 @@ public class NotificationListener extends NotificationListenerWithPlugins { } } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { if (DEBUG) Log.d(TAG, "onNotificationChannelModified"); if (!onPluginNotificationChannelModified(pkgName, user, channel, modificationType)) { mMainHandler.post(() -> { for (NotificationHandler handler : mNotificationHandlers) { handler.onNotificationChannelModified(pkgName, user, channel, modificationType); } }); } } @Override public void onSilentStatusBarIconsVisibilityChanged(boolean hideSilentStatusIcons) { for (NotificationSettingsListener listener : mSettingsListeners) { Loading Loading @@ -229,6 +243,14 @@ public class NotificationListener extends NotificationListenerWithPlugins { void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap, int reason); void onNotificationRankingUpdate(RankingMap rankingMap); /** Called after a notification channel is modified. */ default void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { } /** * Called after the listener has connected to NoMan and posted any current notifications. */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coalescer/GroupCoalescer.java +11 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.systemui.statusbar.notification.collection.coalescer; import static java.util.Objects.requireNonNull; import android.annotation.MainThread; import android.app.NotificationChannel; import android.os.UserHandle; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; Loading Loading @@ -158,6 +160,15 @@ public class GroupCoalescer implements Dumpable { public void onNotificationsInitialized() { mHandler.onNotificationsInitialized(); } @Override public void onNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { mHandler.onNotificationChannelModified(pkgName, user, channel, modificationType); } }; private void maybeEmitBatch(StatusBarNotification sbn) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationListenerWithPlugins.java +18 −2 Original line number Diff line number Diff line Loading @@ -14,9 +14,11 @@ package com.android.systemui.statusbar.phone; import android.app.NotificationChannel; import android.content.ComponentName; import android.content.Context; import android.os.RemoteException; import android.os.UserHandle; import android.service.notification.NotificationListenerService; import android.service.notification.StatusBarNotification; Loading Loading @@ -78,7 +80,7 @@ public class NotificationListenerWithPlugins extends NotificationListenerService /** * Called when listener receives a onNotificationPosted. * Returns true to indicate this callback should be skipped. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationPosted(StatusBarNotification sbn, final RankingMap rankingMap) { Loading @@ -92,7 +94,7 @@ public class NotificationListenerWithPlugins extends NotificationListenerService /** * Called when listener receives a onNotificationRemoved. * Returns true to indicate this callback should be skipped. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationRemoved(StatusBarNotification sbn, final RankingMap rankingMap) { Loading @@ -104,6 +106,20 @@ public class NotificationListenerWithPlugins extends NotificationListenerService return false; } /** * Called when listener receives a onNotificationChannelModified. * Returns true if there's a plugin determining to skip the default callbacks. */ public boolean onPluginNotificationChannelModified( String pkgName, UserHandle user, NotificationChannel channel, int modificationType) { for (NotificationListenerController plugin : mPlugins) { if (plugin.onNotificationChannelModified(pkgName, user, channel, modificationType)) { return true; } } return false; } public RankingMap onPluginRankingUpdate(RankingMap rankingMap) { return getCurrentRanking(); } Loading