From b89445a694229a184196759cbc75db2c92643562 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 26 May 2021 19:12:12 +0200 Subject: [PATCH] Fixed the clipping of the keyguard status bar during drag down It wasn't clipped at all, but now it is. Bug: 184946919 Test: drag down on lockscreen, observe no cliping Change-Id: I13ad278898d76bdd364bbfb3c7e8d599b21bcdae --- .../phone/KeyguardStatusBarView.java | 27 +++++++++++++++++++ .../NotificationPanelViewController.java | 3 +++ 2 files changed, 30 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java index 0c4bec2c2c65c..eef24200a882e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java @@ -116,6 +116,12 @@ public class KeyguardStatusBarView extends RelativeLayout implements // right and left padding applied to this view to account for cutouts and rounded corners private Pair mPadding = new Pair(0, 0); + /** + * The clipping on the top + */ + private int mTopClipping; + private final Rect mClipRect = new Rect(0, 0, 0, 0); + public KeyguardStatusBarView(Context context, AttributeSet attrs) { super(context, attrs); mUserManager = UserManager.get(getContext()); @@ -549,4 +555,25 @@ public class KeyguardStatusBarView extends RelativeLayout implements public void onSystemChromeAnimationUpdate(ValueAnimator anim) { mSystemIconsContainer.setAlpha((float) anim.getAnimatedValue()); } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + super.onLayout(changed, l, t, r, b); + updateClipping(); + } + + /** + * Set the clipping on the top of the view. + */ + public void setTopClipping(int topClipping) { + if (topClipping != mTopClipping) { + mTopClipping = topClipping; + updateClipping(); + } + } + + private void updateClipping() { + mClipRect.set(0, mTopClipping, getWidth(), getHeight()); + setClipBounds(mClipRect); + } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 9d8a9bfafe49c..c3fed55e42d97 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -2235,6 +2235,7 @@ public class NotificationPanelViewController extends PanelViewController { boolean visible) { // Fancy clipping for quick settings int radius = mScrimCornerRadius; + int statusBarClipTop = 0; if (!mShouldUseSplitNotificationShade) { // The padding on this area is large enough that we can use a cheaper clipping strategy mKeyguardStatusAreaClipBounds.set(left, top, right, bottom); @@ -2242,12 +2243,14 @@ public class NotificationPanelViewController extends PanelViewController { ? mKeyguardStatusAreaClipBounds : null); radius = (int) MathUtils.lerp(mScreenCornerRadius, mScrimCornerRadius, Math.min(top / (float) mScrimCornerRadius, 1f)); + statusBarClipTop = top - mKeyguardStatusBar.getTop(); } if (mQs != null) { mQs.setFancyClipping(top, bottom, radius, visible); } mScrimController.setNotificationsBounds(left, top, right, bottom); mScrimController.setScrimCornerRadius(radius); + mKeyguardStatusBar.setTopClipping(statusBarClipTop); } private float getQSEdgePosition() {