Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b37f907 authored by Lyn Han's avatar Lyn Han
Browse files

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
parent 22962c17
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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;