From a18fcc15ea588959dc91794dfbb4cb4ee75d5816 Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Thu, 23 Sep 2021 16:05:12 -0400 Subject: [PATCH] Do not count suppressed group summaries when checking for notifications. This fixes a bug where a group summary of a bubble (which may not itself be a bubble) is counted as a notification for the purposes of determining if the "Clear All" button (or footer generally) should be shown, even though that notification is not shown or counted when determining if the empty shade view should be displayed. Fixes: 195822405 Test: NotificationStackScrollerControllerTest Test: Clear all notifications, go/use-bubbles, post 4 bubbles, read all 4 bubbles, expand shade Change-Id: I080d5c5ab6f6f48d9dd0f3e46ba48da4ca1e6e60 --- .../stack/NotificationStackScrollLayoutController.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java index faba48f82cb3b..b1efa4fbbf347 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java @@ -171,6 +171,7 @@ public class NotificationStackScrollLayoutController { private final NotificationLockscreenUserManager mLockscreenUserManager; // TODO: StatusBar should be encapsulated behind a Controller private final StatusBar mStatusBar; + private final NotificationGroupManagerLegacy mLegacyGroupManager; private final SectionHeaderController mSilentHeaderController; private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; @@ -651,6 +652,8 @@ public class NotificationStackScrollLayoutController { mStatusBar.requestNotificationUpdate("onGroupsChanged"); } }); + mLegacyGroupManager = featureFlags.isNewNotifPipelineRenderingEnabled() + ? null : legacyGroupManager; mSilentHeaderController = silentHeaderController; mFeatureFlags = featureFlags; mNotifPipeline = notifPipeline; @@ -1193,7 +1196,11 @@ public class NotificationStackScrollLayoutController { final boolean inSection = NotificationStackScrollLayout.matchesSelection(row, selection); if (matchClearable && inSection) { - return true; + if (mLegacyGroupManager == null + || !mLegacyGroupManager.isSummaryOfSuppressedGroup( + row.getEntry().getSbn())) { + return true; + } } } return false;