From c41110770474224f33a3596529df6f20d7f6fec0 Mon Sep 17 00:00:00 2001 From: Ned Burns Date: Fri, 3 Apr 2020 01:46:55 -0400 Subject: [PATCH] Emit onRankingApplied in NEM This was only being emitted in NotifCollection, and IconManager depended on both to work properly. Bug: 112656837 Test: manual Change-Id: I93f398dff31759f09f30f56849491f9ace3f8a01 --- .../notification/NotificationEntryManager.java | 15 ++++++++++++++- .../notifcollection/NotifCollectionListener.java | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java index d2f781d2e19ce..77376e5958197 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java @@ -539,7 +539,8 @@ public class NotificationEntryManager implements } } - private void addNotificationInternal(StatusBarNotification notification, + private void addNotificationInternal( + StatusBarNotification notification, RankingMap rankingMap) throws InflationException { String key = notification.getKey(); if (DEBUG) { @@ -579,6 +580,9 @@ public class NotificationEntryManager implements for (NotifCollectionListener listener : mNotifCollectionListeners) { listener.onEntryAdded(entry); } + for (NotifCollectionListener listener : mNotifCollectionListeners) { + listener.onRankingApplied(); + } } public void addNotification(StatusBarNotification notification, RankingMap ranking) { @@ -635,6 +639,9 @@ public class NotificationEntryManager implements for (NotificationEntryListener listener : mNotificationEntryListeners) { listener.onPostEntryUpdated(entry); } + for (NotifCollectionListener listener : mNotifCollectionListeners) { + listener.onRankingApplied(); + } } public void updateNotification(StatusBarNotification notification, RankingMap ranking) { @@ -693,6 +700,9 @@ public class NotificationEntryManager implements for (NotifCollectionListener listener : mNotifCollectionListeners) { listener.onRankingUpdate(rankingMap); } + for (NotifCollectionListener listener : mNotifCollectionListeners) { + listener.onRankingApplied(); + } } private void updateRankingOfPendingNotifications(@Nullable RankingMap rankingMap) { @@ -799,6 +809,9 @@ public class NotificationEntryManager implements */ public void updateRanking(RankingMap rankingMap, String reason) { updateRankingAndSort(rankingMap, reason); + for (NotifCollectionListener listener : mNotifCollectionListeners) { + listener.onRankingApplied(); + } } /** Resorts / filters the current notification set with the current RankingMap */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java index 0c0cded32db27..41ca52d5a6267 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/notifcollection/NotifCollectionListener.java @@ -74,7 +74,9 @@ public interface NotifCollectionListener { * non-lifetime-extended notification entries will have their ranking object updated. * * Ranking updates occur whenever a notification is added, updated, or removed, or when a - * standalone ranking is sent from the server. + * standalone ranking is sent from the server. If a non-standalone ranking is applied, the event + * that accompanied the ranking is emitted first (e.g. {@link #onEntryAdded}), followed by the + * ranking event. */ default void onRankingApplied() { }