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

Commit f46f7d42 authored by Nick Chameyev's avatar Nick Chameyev
Browse files

Fix split shade issues when going from portrait expanded quick settings

Fixes a couple of issues with the split shade when
starting from normal shade with expanded quick
settings to split shade:

* Notifications are not scrollable
  updateQsState() wasn't called when switching between
  normal shade <-> split shade. It calls setScrollingEnabled
  which is based on whether quick settings in full screen
  or not (basically are we in split shade or not).

* Footer is not visible
  There was a recent change that hides footer when
  quick settings expanded to avoid animation issues.
  We don't need this for split shade, so added a check
  so we don't hide them in split shade.

* Notifications are not collapsed into shelf
  Stack height was not updated when quick settings
  are expanded, so the end of the stack was outside
  of the screen bounds. Added exception for non-fullscreen
  quick settings to update the height.

* Notification stack is clipped incorrectly
  This is especially visible when swiping quickly,
  you can see that 'manage'/'clear all' buttons
  go outside of the shade background.
  Updated clipping calculation so notification background
  doesn't add corner radius to the coordinates by default
  and we add bottom margin to calculate the bottom
  part of the clipping rectangle.

Bug: 222699879
Test: expanding/closing quick settings and switching
  between splitshade/non-splitshade => checking that
  the shade is rendered correctly
Change-Id: Ieb9a8dddccf08f5b333a5065d78694278ca5ed55
parent 51697063
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class ScrimDrawable extends Drawable {
            drawConcave(canvas);
        } else if (mCornerRadiusEnabled && mCornerRadius > 0) {
            canvas.drawRoundRect(getBounds().left, getBounds().top, getBounds().right,
                    getBounds().bottom + mCornerRadius,
                    getBounds().bottom,
                    /* x radius*/ mCornerRadius, /* y radius*/ mCornerRadius, mPaint);
        } else {
            canvas.drawRect(getBounds().left, getBounds().top, getBounds().right,
+6 −2
Original line number Diff line number Diff line
@@ -689,7 +689,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        boolean showFooterView = (showDismissView || mController.getVisibleNotificationCount() > 0)
                && mIsCurrentUserSetup  // see: b/193149550
                && mStatusBarState != StatusBarState.KEYGUARD
                && mQsExpansionFraction != 1
                // quick settings don't affect notifications when not in full screen
                && (mQsExpansionFraction != 1 || !mQsFullScreen)
                && !mScreenOffAnimationController.shouldHideNotificationsFooter()
                && !mIsRemoteInputActive;
        boolean showHistory = mController.isHistoryEnabled();
@@ -799,6 +800,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        y = (int) (mAmbientState.getStackY() + mKeyguardNotificationAvailableSpace);
        drawDebugInfo(canvas, y, Color.RED, /* label= */
                "mAmbientState.getStackY() + mKeyguardNotificationAvailableSpace = " + y);

        drawDebugInfo(canvas, mRoundedRectClippingBottom, Color.DKGRAY,
                /* label= */ "mRoundedRectClippingBottom) = " + y);
    }

    private void drawDebugInfo(Canvas canvas, int y, int color, String label) {
@@ -1311,7 +1315,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        if (mOnStackYChanged != null) {
            mOnStackYChanged.accept(listenerNeedsAnimation);
        }
        if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) {
        if ((mQsExpansionFraction <= 0 || !mQsFullScreen) && !shouldSkipHeightUpdate()) {
            final float endHeight = updateStackEndHeight();
            updateStackHeight(endHeight, fraction);
        }
+13 −3
Original line number Diff line number Diff line
@@ -1098,6 +1098,8 @@ public class NotificationPanelViewController extends PanelViewController {

        if (splitNotificationShadeChanged) {
            updateClockAppearance();
            updateQsState();
            mNotificationStackScrollLayoutController.updateFooter();
        }
    }

@@ -2348,7 +2350,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private int calculateBottomQsClippingBound(int top) {
        if (mShouldUseSplitNotificationShade) {
            return top + mNotificationStackScrollLayoutController.getHeight()
                    - mSplitShadeNotificationsScrimMarginBottom;
                    + mSplitShadeNotificationsScrimMarginBottom;
        } else {
            return getView().getBottom();
        }
@@ -2466,7 +2468,12 @@ public class NotificationPanelViewController extends PanelViewController {
            // be visible, otherwise you can see the bounds once swiping up to see bouncer
            mScrimController.setNotificationsBounds(0, 0, 0, 0);
        } else {
            mScrimController.setNotificationsBounds(left, top, right, bottom);
            // Increase the height of the notifications scrim when not in split shade
            // (e.g. portrait tablet) so the rounded corners are not visible at the bottom,
            // in this case they are rendered off-screen
            final int notificationsScrimBottom =
                    mShouldUseSplitNotificationShade ? bottom : bottom + radius;
            mScrimController.setNotificationsBounds(left, top, right, notificationsScrimBottom);
        }

        if (mShouldUseSplitNotificationShade) {
@@ -2476,10 +2483,13 @@ public class NotificationPanelViewController extends PanelViewController {
        }

        mScrimController.setScrimCornerRadius(radius);

        // Convert global clipping coordinates to local ones,
        // relative to NotificationStackScrollLayout
        int nsslLeft = left - mNotificationStackScrollLayoutController.getLeft();
        int nsslRight = right - mNotificationStackScrollLayoutController.getLeft();
        int nsslTop = top - mNotificationStackScrollLayoutController.getTop();
        int nsslBottom = bottom;
        int nsslBottom = bottom - mNotificationStackScrollLayoutController.getTop();
        int bottomRadius = mShouldUseSplitNotificationShade ? radius : 0;
        mNotificationStackScrollLayoutController.setRoundedClippingBounds(
                nsslLeft, nsslTop, nsslRight, nsslBottom, radius, bottomRadius);