From 2234aaedb691705cfb7049e4d2411b728d3d48de Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Wed, 24 Nov 2021 03:48:33 +0000 Subject: [PATCH] New Pipeline: Numerous bug and crash fixes: * Fix RemoteInputView crash by no longer clearing the row. This was never done in the legacy pipeline, and the number of components in the system which apparently depend on this terrible beahavior seems to be all of them. * Fix ConcurrentModificationException in GroupExpansionManagerImpl due to iterating over the expanded groups to remove them. * Improve the ListDumper to also include the group's summary * Fix the ENR.addChildAt NodeController method to actually use the index * Expand the ensureRemovedFromTransientContainer() logic to apply to all expandable views, not just section headers. Fixes: 205097513 Test: manual Change-Id: I996a2d6e7f09653afc960e859db6ae72beeb04b0 --- .../notification/collection/ListDumper.java | 15 +++++++++++++-- .../coordinator/PreparationCoordinator.java | 2 +- .../render/GroupExpansionManagerImpl.java | 3 ++- .../row/ExpandableNotificationRowController.java | 2 +- .../stack/NotificationStackScrollLayout.java | 2 +- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java index 52c5c3e08118e..6be8a491eeadd 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/ListDumper.java @@ -55,15 +55,26 @@ public class ListDumper { interactionTracker.hasUserInteractedWith(entry.getKey())); if (entry instanceof GroupEntry) { GroupEntry ge = (GroupEntry) entry; + NotificationEntry summary = ge.getSummary(); + if (summary != null) { + dumpEntry(summary, + topEntryIndex + ":*", + childEntryIndent, + sb, + true, + includeRecordKeeping, + interactionTracker.hasUserInteractedWith(summary.getKey())); + } List children = ge.getChildren(); for (int childIndex = 0; childIndex < children.size(); childIndex++) { - dumpEntry(children.get(childIndex), + NotificationEntry child = children.get(childIndex); + dumpEntry(child, topEntryIndex + "." + childIndex, childEntryIndent, sb, true, includeRecordKeeping, - interactionTracker.hasUserInteractedWith(entry.getKey())); + interactionTracker.hasUserInteractedWith(child.getKey())); } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java index 644f248fca008..b5d4635ebf609 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/PreparationCoordinator.java @@ -373,7 +373,7 @@ public class PreparationCoordinator implements Coordinator { private void freeNotifViews(NotificationEntry entry) { mViewBarn.removeViewForEntry(entry); - entry.setRow(null); + // TODO: clear the entry's row here, or even better, stop setting the row on the entry! mInflationStates.put(entry, STATE_UNINFLATED); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java index b9aa26f75c9b7..86d263af88ea4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/render/GroupExpansionManagerImpl.java @@ -25,6 +25,7 @@ import com.android.systemui.statusbar.notification.collection.listbuilder.OnBefo import java.io.FileDescriptor; import java.io.PrintWriter; +import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -91,7 +92,7 @@ public class GroupExpansionManagerImpl implements GroupExpansionManager, Coordin @Override public void collapseGroups() { - for (NotificationEntry entry : mExpandedGroups) { + for (NotificationEntry entry : new ArrayList<>(mExpandedGroups)) { setGroupExpanded(entry, false); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java index 0b29ae57510cf..59ea0ea6d57b1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowController.java @@ -241,7 +241,7 @@ public class ExpandableNotificationRowController implements NodeController { public void addChildAt(NodeController child, int index) { ExpandableNotificationRow childView = (ExpandableNotificationRow) child.getView(); - mView.addChildNotification((ExpandableNotificationRow) child.getView()); + mView.addChildNotification((ExpandableNotificationRow) child.getView(), index); mListContainer.notifyGroupChildAdded(childView); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java index a97a54a50da5b..a10d30935567a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java @@ -4642,7 +4642,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } private void ensureRemovedFromTransientContainer(View v) { - if (v.getParent() == this && v instanceof SectionHeaderView) { + if (v.getParent() == this && v instanceof ExpandableView) { ExpandableView expandableView = (ExpandableView) v; ViewGroup transientContainer = expandableView.getTransientContainer(); // If the child is animating away, it will still have a parent, so