From 1b37f907700b1cb682ab46c013a9fdaa2dc85ca4 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Thu, 6 May 2021 13:11:18 -0500 Subject: [PATCH] Fix bug where lockscreen notification is minimized and not dismissable This happened because - recently we started counting MediaHeaderView as part of maxDisplayedNotifications on lockscreen - causing the last notification that should have shown on lockscreen to restrict itself to shelf height, and later be replaced with the shelf during layout; the shelf is not dismissable. The fix is to - ignore MediaHeaderView when counting shown notifications - still include MediaHeaderView in contentHeight calculations Fixes: 187304623 Test: have MediaHeaderView and many notifications on lockscreen and swipe away all of them individually Change-Id: I4e122b9321856880a5a09e03df61698eaf6b5f54 --- .../notification/stack/NotificationStackScrollLayout.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 506d8a185adca..120f9732f5552 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 @@ -2068,6 +2068,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable int height = 0; float previousPaddingRequest = mPaddingBetweenElements; int numShownItems = 0; + int numShownNotifs = 0; boolean finish = false; int maxDisplayedNotifications = mMaxDisplayedNotifications; ExpandableView previousView = null; @@ -2077,7 +2078,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (expandableView.getVisibility() != View.GONE && !expandableView.hasNoContentHeight() && !footerViewOnLockScreen) { boolean limitReached = maxDisplayedNotifications != -1 - && numShownItems >= maxDisplayedNotifications; + && numShownNotifs >= maxDisplayedNotifications; final float viewHeight; if (limitReached) { viewHeight = mShelf.getIntrinsicHeight(); @@ -2090,7 +2091,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } height += calculateGapHeight(previousView, expandableView, numShownItems); height += viewHeight; + numShownItems++; + if (!(expandableView instanceof MediaHeaderView)) { + numShownNotifs++; + } previousView = expandableView; if (finish) { break;