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
This commit is contained in:
Selim Cinek
2021-05-26 19:12:12 +02:00
parent 48f518618e
commit b89445a694
2 changed files with 30 additions and 0 deletions

View File

@@ -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<Integer, Integer> 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);
}
}

View File

@@ -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() {