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
This commit is contained in:
Lyn Han
2021-05-06 13:11:18 -05:00
parent 22962c17df
commit 1b37f90770

View File

@@ -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;