Don't retain the filtered list of notifications.
Previously the entire set of notifications was "leaked" until the next call to getNotificationsForCurrentUser(), which currently only happens for certain configuration changes (UiMode, density, fontscale). Bug: 143461605 Test: atest SystemUITests Test: sanity check: boot and switch night mode Change-Id: I39f2c96f848ab92a050aa4bda3ae203fbf99d915
This commit is contained in:
@@ -68,7 +68,6 @@ public class NotificationData {
|
||||
|
||||
private final ArrayMap<String, NotificationEntry> mEntries = new ArrayMap<>();
|
||||
private final ArrayList<NotificationEntry> mSortedAndFiltered = new ArrayList<>();
|
||||
private final ArrayList<NotificationEntry> mFilteredForUser = new ArrayList<>();
|
||||
|
||||
private final NotificationGroupManager mGroupManager =
|
||||
Dependency.get(NotificationGroupManager.class);
|
||||
@@ -166,20 +165,20 @@ public class NotificationData {
|
||||
}
|
||||
|
||||
public ArrayList<NotificationEntry> getNotificationsForCurrentUser() {
|
||||
mFilteredForUser.clear();
|
||||
|
||||
synchronized (mEntries) {
|
||||
final int len = mEntries.size();
|
||||
ArrayList<NotificationEntry> filteredForUser = new ArrayList<>(len);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
NotificationEntry entry = mEntries.valueAt(i);
|
||||
final StatusBarNotification sbn = entry.getSbn();
|
||||
if (!getEnvironment().isNotificationForCurrentProfiles(sbn)) {
|
||||
continue;
|
||||
}
|
||||
mFilteredForUser.add(entry);
|
||||
filteredForUser.add(entry);
|
||||
}
|
||||
return filteredForUser;
|
||||
}
|
||||
return mFilteredForUser;
|
||||
}
|
||||
|
||||
public NotificationEntry get(String key) {
|
||||
|
||||
Reference in New Issue
Block a user