Merge "Use correct groupKey API for notif groups" into tm-dev

This commit is contained in:
Steve Elliott
2022-04-28 19:10:18 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 24 deletions

View File

@@ -709,8 +709,8 @@ public class ShadeListBuilder implements Dumpable {
new ArraySet<>(groupsWithChildrenLostToStability); new ArraySet<>(groupsWithChildrenLostToStability);
// Any group which lost a child to filtering or promotion is exempt from having its summary // Any group which lost a child to filtering or promotion is exempt from having its summary
// promoted when it has no attached children. // promoted when it has no attached children.
getGroupsWithChildrenLostToFiltering(groupsExemptFromSummaryPromotion); addGroupsWithChildrenLostToFiltering(groupsExemptFromSummaryPromotion);
getGroupsWithChildrenLostToPromotion(shadeList, groupsExemptFromSummaryPromotion); addGroupsWithChildrenLostToPromotion(shadeList, groupsExemptFromSummaryPromotion);
// Iterate backwards, so that we can remove elements without affecting indices of // Iterate backwards, so that we can remove elements without affecting indices of
// yet-to-be-accessed entries. // yet-to-be-accessed entries.
@@ -865,7 +865,7 @@ public class ShadeListBuilder implements Dumpable {
* *
* These groups will be exempt from appearing without any children. * These groups will be exempt from appearing without any children.
*/ */
private void getGroupsWithChildrenLostToPromotion(List<ListEntry> shadeList, Set<String> out) { private void addGroupsWithChildrenLostToPromotion(List<ListEntry> shadeList, Set<String> out) {
for (int i = 0; i < shadeList.size(); i++) { for (int i = 0; i < shadeList.size(); i++) {
final ListEntry tle = shadeList.get(i); final ListEntry tle = shadeList.get(i);
if (tle.getAttachState().getPromoter() != null) { if (tle.getAttachState().getPromoter() != null) {
@@ -882,13 +882,13 @@ public class ShadeListBuilder implements Dumpable {
* *
* These groups will be exempt from appearing without any children. * These groups will be exempt from appearing without any children.
*/ */
private void getGroupsWithChildrenLostToFiltering(Set<String> out) { private void addGroupsWithChildrenLostToFiltering(Set<String> out) {
for (ListEntry tle : mAllEntries) { for (ListEntry tle : mAllEntries) {
StatusBarNotification sbn = tle.getRepresentativeEntry().getSbn(); StatusBarNotification sbn = tle.getRepresentativeEntry().getSbn();
if (sbn.isGroup() if (sbn.isGroup()
&& !sbn.getNotification().isGroupSummary() && !sbn.getNotification().isGroupSummary()
&& tle.getAttachState().getExcludingFilter() != null) { && tle.getAttachState().getExcludingFilter() != null) {
out.add(sbn.getGroup()); out.add(sbn.getGroupKey());
} }
} }
} }

View File

@@ -1488,25 +1488,6 @@ public class ShadeListBuilderTest extends SysuiTestCase {
); );
} }
@Test
public void testFinalizeFilteredChildrenPromotesSummary() {
// GIVEN a group with only one child was already drawn
addGroupSummary(0, PACKAGE_1, GROUP_1);
addGroupChild(1, PACKAGE_1, GROUP_1);
addGroupChild(2, PACKAGE_1, GROUP_1);
// WHEN the parent is filtered out at the finalize step
mFinalizeFilter.mIndicesToFilter.add(1);
mFinalizeFilter.mIndicesToFilter.add(2);
dispatchBuild();
// THEN the children should be promoted to the top level
verifyBuiltList(
notif(0)
);
}
@Test @Test
public void testFinalizeFilteredChildPromotesSibling() { public void testFinalizeFilteredChildPromotesSibling() {
// GIVEN a group with only one child was already drawn // GIVEN a group with only one child was already drawn