summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Michał Brzeziński <brzezinski@google.com> 2022-11-01 16:02:28 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-11-01 16:02:28 +0000
commitd2cb23038f48536f96c04466a8567c52758d611e (patch)
tree2247fc3d5fb518d20c813538345681f4759e6d4e
parentdc5d95dba02dd835951134afca8809de19ec8f75 (diff)
parent92c74842612bee33a37c8f0ccdc2d0cf2423003e (diff)
Merge "Fix heads-up notification clipping in split shade" into tm-qpr-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java16
2 files changed, 27 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
index 85edac80c3e5..962de9920395 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java
@@ -3041,11 +3041,23 @@ public final class NotificationPanelViewController {
// 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 df705c5afeef..c4ef28e889ca 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
@@ -1383,7 +1383,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);
@@ -1444,6 +1444,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;
@@ -1482,7 +1493,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
public void updateClipping() {
boolean clipped = mRequestedClipBounds != null && !mInHeadsUpPinnedMode
&& !mHeadsUpAnimatingAway;
- boolean clipToOutline = false;
if (mIsClipped != clipped) {
mIsClipped = clipped;
}
@@ -1498,7 +1508,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
setClipBounds(null);
}
- setClipToOutline(clipToOutline);
+ setClipToOutline(false);
}
/**