DO NOT MERGE: Don't let NotificationEntryManager keep around old RankingMaps am: 323ce62057 am: 35c443bd0a

Change-Id: I6e2f964cc85caa430ca5aa28986fcb65e416a033
This commit is contained in:
Automerger Merge Worker
2019-12-11 22:17:33 +00:00
2 changed files with 4 additions and 4 deletions

View File

@@ -89,7 +89,6 @@ public class NotificationEntryManager implements
private NotificationRowBinder mNotificationRowBinder;
private NotificationPresenter mPresenter;
private NotificationListenerService.RankingMap mLatestRankingMap;
@VisibleForTesting
protected NotificationData mNotificationData;
@@ -168,8 +167,7 @@ public class NotificationEntryManager implements
/** Adds a {@link NotificationLifetimeExtender}. */
public void addNotificationLifetimeExtender(NotificationLifetimeExtender extender) {
mNotificationLifetimeExtenders.add(extender);
extender.setCallback(key -> removeNotification(key, mLatestRankingMap,
UNDEFINED_DISMISS_REASON));
extender.setCallback(key -> removeNotification(key, null, UNDEFINED_DISMISS_REASON));
}
public NotificationData getNotificationData() {
@@ -293,7 +291,6 @@ public class NotificationEntryManager implements
if (!forceRemove && !entryDismissed) {
for (NotificationLifetimeExtender extender : mNotificationLifetimeExtenders) {
if (extender.shouldExtendLifetime(entry)) {
mLatestRankingMap = ranking;
extendLifetime(entry, extender);
lifetimeExtended = true;
break;

View File

@@ -200,6 +200,9 @@ public class NotificationData {
removed = mEntries.remove(key);
}
if (removed == null) return null;
// NEM may pass us a null ranking map if removing a lifetime-extended notification,
// so use the most recent ranking
if (ranking == null) ranking = mRankingMap;
mGroupManager.onEntryRemoved(removed);
updateRankingAndSort(ranking);
return removed;