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

Commit eb21e52b authored by Michal Brzezinski's avatar Michal Brzezinski
Browse files

Fixing scrims jumping when media player state changes

The issue was caused by mKeyguardStatusAreaClipBounds not being emptied when no longer needed.

In portrait when media is appearing or disappearing in QQS, we animate notification scrim to its new position. This animation was dependent on mKeyguardStatusAreaClipBounds (now renamed to mLastQsClipBounds) that was changed only in folded mode. In unfolded animation was using old values from that field which were never updated. Solution is to always keep last clips bounds updated and use it when animating media visibility also on large screen portrait.

Fixes: 234129271
Test: Have media running -> fold then unfold back -> open shade in portrait and remove media player from QQS -> notification scrim should animate nicely
Change-Id: I930456ac79095eda55e098e02abf96b45dec1214
parent bd68fac9
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -573,7 +573,7 @@ public final class NotificationPanelViewController {

    /** Whether the current animator is resetting the pulse expansion after a drag down. */
    private boolean mIsPulseExpansionResetAnimator;
    private final Rect mKeyguardStatusAreaClipBounds = new Rect();
    private final Rect mLastQsClipBounds = new Rect();
    private final Region mQsInterceptRegion = new Region();
    /** Alpha of the views which only show on the keyguard but not in shade / shade locked. */
    private float mKeyguardOnlyContentAlpha = 1.0f;
@@ -2806,7 +2806,7 @@ public final class NotificationPanelViewController {
     */
    private void applyQSClippingBounds(int left, int top, int right, int bottom,
            boolean qsVisible) {
        if (!mAnimateNextNotificationBounds || mKeyguardStatusAreaClipBounds.isEmpty()) {
        if (!mAnimateNextNotificationBounds || mLastQsClipBounds.isEmpty()) {
            if (mQsClippingAnimation != null) {
                // update the end position of the animator
                mQsClippingAnimationEndBounds.set(left, top, right, bottom);
@@ -2815,10 +2815,10 @@ public final class NotificationPanelViewController {
            }
        } else {
            mQsClippingAnimationEndBounds.set(left, top, right, bottom);
            final int startLeft = mKeyguardStatusAreaClipBounds.left;
            final int startTop = mKeyguardStatusAreaClipBounds.top;
            final int startRight = mKeyguardStatusAreaClipBounds.right;
            final int startBottom = mKeyguardStatusAreaClipBounds.bottom;
            final int startLeft = mLastQsClipBounds.left;
            final int startTop = mLastQsClipBounds.top;
            final int startRight = mLastQsClipBounds.right;
            final int startBottom = mLastQsClipBounds.bottom;
            if (mQsClippingAnimation != null) {
                mQsClippingAnimation.cancel();
            }
@@ -2855,12 +2855,10 @@ public final class NotificationPanelViewController {

    private void applyQSClippingImmediately(int left, int top, int right, int bottom,
            boolean qsVisible) {
        // Fancy clipping for quick settings
        int radius = mScrimCornerRadius;
        boolean clipStatusView = false;
        mLastQsClipBounds.set(left, top, right, bottom);
        if (mIsFullWidth) {
            // The padding on this area is large enough that we can use a cheaper clipping strategy
            mKeyguardStatusAreaClipBounds.set(left, top, right, bottom);
            clipStatusView = qsVisible;
            float screenCornerRadius = mRecordingController.isRecording() ? 0 : mScreenCornerRadius;
            radius = (int) MathUtils.lerp(screenCornerRadius, mScrimCornerRadius,
@@ -2895,8 +2893,8 @@ public final class NotificationPanelViewController {
                    radius,
                    qsVisible && !mSplitShadeEnabled);
        }
        mKeyguardStatusViewController.setClipBounds(
                clipStatusView ? mKeyguardStatusAreaClipBounds : null);
        // The padding on this area is large enough that we can use a cheaper clipping strategy
        mKeyguardStatusViewController.setClipBounds(clipStatusView ? mLastQsClipBounds : null);
        if (!qsVisible && mSplitShadeEnabled) {
            // On the lockscreen when qs isn't visible, we don't want the bounds of the shade to
            // be visible, otherwise you can see the bounds once swiping up to see bouncer