Fixed a bug where notifications could become orphaned
When a child got set not be a heads up after it was already removed (When for example it was clicked on shortly after it got posted) then it got orphaned leading to bad bugs like the next notification not being visible. This could happen often with WhatsApp who set the head up flags on the summary instead of the children. Change-Id: I52c8f5d9bc50080e4ece530255236d36f998372e Fixes: 28565942
This commit is contained in:
@@ -24,9 +24,12 @@ import com.android.systemui.statusbar.NotificationData;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -69,6 +72,7 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
|
||||
|
||||
public void onEntryRemoved(NotificationData.Entry removed) {
|
||||
onEntryRemovedInternal(removed, removed.notification);
|
||||
mIsolatedEntries.remove(removed.key);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -425,6 +429,19 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
|
||||
mHeadsUpManager = headsUpManager;
|
||||
}
|
||||
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
pw.println("GroupManager state:");
|
||||
pw.println(" number of groups: " + mGroupMap.size());
|
||||
for (Map.Entry<String, NotificationGroup> entry : mGroupMap.entrySet()) {
|
||||
pw.println("\n key: " + entry.getKey()); pw.println(entry.getValue());
|
||||
}
|
||||
pw.println("\n isolated entries: " + mIsolatedEntries.size());
|
||||
for (Map.Entry<String, StatusBarNotification> entry : mIsolatedEntries.entrySet()) {
|
||||
pw.print(" "); pw.print(entry.getKey());
|
||||
pw.print(", "); pw.println(entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public static class NotificationGroup {
|
||||
public final HashSet<NotificationData.Entry> children = new HashSet<>();
|
||||
public NotificationData.Entry summary;
|
||||
@@ -433,6 +450,16 @@ public class NotificationGroupManager implements HeadsUpManager.OnHeadsUpChanged
|
||||
* Is this notification group suppressed, i.e its summary is hidden
|
||||
*/
|
||||
public boolean suppressed;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String result = " summary:\n " + summary.notification;
|
||||
result += "\n children size: " + children.size();
|
||||
for (NotificationData.Entry child : children) {
|
||||
result += "\n " + child.notification;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnGroupChangeListener {
|
||||
|
||||
@@ -3128,6 +3128,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
} else {
|
||||
pw.println(" mHeadsUpManager: null");
|
||||
}
|
||||
if (mGroupManager != null) {
|
||||
mGroupManager.dump(fd, pw, args);
|
||||
} else {
|
||||
pw.println(" mGroupManager: null");
|
||||
}
|
||||
if (KeyguardUpdateMonitor.getInstance(mContext) != null) {
|
||||
KeyguardUpdateMonitor.getInstance(mContext).dump(fd, pw, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user