diff options
| author | 2022-09-13 15:54:11 +0100 | |
|---|---|---|
| committer | 2022-10-06 10:57:52 +0100 | |
| commit | 92c74842612bee33a37c8f0ccdc2d0cf2423003e (patch) | |
| tree | 8ba23fea24ea525d4e586a1004af97cc1b2d3f0d | |
| parent | 4e528edd314d699697cdd594ecf83d600da00ca2 (diff) | |
Fix heads-up notification clipping in split shade
HUN was clipped when swiping up in split shade, mostly because of extra notifications top margin that's present only in split shade.
Test: show HUN in split shade, swipe up and see it not getting clipped till the edge of the screen
Fixes: 242051840
Change-Id: I923cec41839725d11c1b1a34e00aadf44283accc
2 files changed, 27 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index d7e86b6e2919..139606e4863e 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -2712,11 +2712,23 @@ public final class NotificationPanelViewController extends PanelViewController { // relative to NotificationStackScrollLayout int nsslLeft = left - mNotificationStackScrollLayoutController.getLeft(); int nsslRight = right - mNotificationStackScrollLayoutController.getLeft(); - int nsslTop = top - mNotificationStackScrollLayoutController.getTop(); + int nsslTop = getNotificationsClippingTopBounds(top); int nsslBottom = bottom - mNotificationStackScrollLayoutController.getTop(); int bottomRadius = mSplitShadeEnabled ? radius : 0; + int topRadius = mSplitShadeEnabled && mExpandingFromHeadsUp ? 0 : radius; mNotificationStackScrollLayoutController.setRoundedClippingBounds( - nsslLeft, nsslTop, nsslRight, nsslBottom, radius, bottomRadius); + nsslLeft, nsslTop, nsslRight, nsslBottom, topRadius, bottomRadius); + } + + private int getNotificationsClippingTopBounds(int qsTop) { + if (mSplitShadeEnabled && mExpandingFromHeadsUp) { + // in split shade nssl has extra top margin so clipping at top 0 is not enough, we need + // to set top clipping bound to negative value to allow HUN to go up to the top edge of + // the screen without clipping. + return -mAmbientState.getStackTopMargin(); + } else { + return qsTop - mNotificationStackScrollLayoutController.getTop(); + } } private float getQSEdgePosition() { 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 5fbaa515d5d7..97fe25ea58ad 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 @@ -1399,7 +1399,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable if (height < minExpansionHeight) { mClipRect.left = 0; mClipRect.right = getWidth(); - mClipRect.top = 0; + mClipRect.top = getNotificationsClippingTopBound(); mClipRect.bottom = (int) height; height = minExpansionHeight; setRequestedClipBounds(mClipRect); @@ -1460,6 +1460,17 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable notifyAppearChangedListeners(); } + private int getNotificationsClippingTopBound() { + if (isHeadsUpTransition()) { + // HUN in split shade can go higher than bottom of NSSL when swiping up so we want + // to give it extra clipping margin. Because clipping has rounded corners, we also + // need to account for that corner clipping. + return -mAmbientState.getStackTopMargin() - mCornerRadius; + } else { + return 0; + } + } + private void notifyAppearChangedListeners() { float appear; float expandAmount; @@ -1498,13 +1509,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable public void updateClipping() { boolean clipped = mRequestedClipBounds != null && !mInHeadsUpPinnedMode && !mHeadsUpAnimatingAway; - boolean clipToOutline = false; if (mIsClipped != clipped) { mIsClipped = clipped; } if (mAmbientState.isHiddenAtAll()) { - clipToOutline = false; invalidateOutline(); if (isFullyHidden()) { setClipBounds(null); @@ -1515,7 +1524,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable setClipBounds(null); } - setClipToOutline(clipToOutline); + setClipToOutline(false); } /** |