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

Commit e42ee92f authored by Lyn Han's avatar Lyn Han
Browse files

Scroll notifications fullscreen

NSSL lets NPVC know if mOwnScrollY changed
Then NPVC updates background scrim position

Bug: 172289889
Test: manual
Change-Id: I0e2599849df5d44021e401a4d62b378f66d1c713
parent f5cded5a
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -431,6 +431,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private DismissAllAnimationListener mDismissAllAnimationListener;
    private NotificationRemoteInputManager mRemoteInputManager;
    private ShadeController mShadeController;
    private Runnable mOnStackYChanged;

    private final DisplayMetrics mDisplayMetrics = Dependency.get(DisplayMetrics.class);
    private final LockscreenGestureLogger mLockscreenGestureLogger =
@@ -1142,14 +1143,22 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
     */
    private void updateStackPosition() {
        // Consider interpolating from an mExpansionStartY for use on lockscreen and AOD
        mAmbientState.setStackY(
                MathUtils.lerp(0, mTopPadding, mAmbientState.getExpansionFraction()));
        final float stackY = MathUtils.lerp(0, mTopPadding, mAmbientState.getExpansionFraction());
        mAmbientState.setStackY(stackY);
        if (mOnStackYChanged != null) {
            mOnStackYChanged.run();
        }

        final float shadeBottom = getHeight() - getEmptyBottomMargin();
        mAmbientState.setStackEndHeight(shadeBottom - mTopPadding);
        mAmbientState.setStackHeight(
                MathUtils.lerp(0, shadeBottom - mTopPadding, mAmbientState.getExpansionFraction()));
    }

    void setOnStackYChanged(Runnable onStackYChanged) {
        mOnStackYChanged = onStackYChanged;
    }

    /**
     * Update the height of the panel.
     *
@@ -4533,7 +4542,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            // We still want to call the normal scrolled changed for accessibility reasons
            onScrollChanged(mScrollX, ownScrollY, mScrollX, mOwnScrollY);
            mOwnScrollY = ownScrollY;
            updateChildren();
            updateOnScrollChange();
            updateStackPosition();
        }
    }

+4 −0
Original line number Diff line number Diff line
@@ -971,6 +971,10 @@ public class NotificationStackScrollLayoutController {
        mView.setQsExpansionFraction(expansionFraction);
    }

    public void setOnStackYChanged(Runnable onStackYChanged) {
        mView.setOnStackYChanged(onStackYChanged);
    }

    public float calculateAppearFractionBypass() {
        return mView.calculateAppearFractionBypass();
    }
+2 −1
Original line number Diff line number Diff line
@@ -151,7 +151,8 @@ public class StackScrollAlgorithm {

    private void updateClipping(StackScrollAlgorithmState algorithmState,
            AmbientState ambientState) {
        float drawStart = !ambientState.isOnKeyguard() ? ambientState.getStackY() : 0;
        float drawStart = !ambientState.isOnKeyguard()
                ? ambientState.getStackY() - ambientState.getScrollY() : 0;
        float clipStart = 0;
        int childCount = algorithmState.visibleChildren.size();
        boolean firstHeadsUp = true;
+19 −7
Original line number Diff line number Diff line
@@ -525,6 +525,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private NotificationShelfController mNotificationShelfController;
    private int mScrimCornerRadius;
    private int mScreenCornerRadius;
    private int mNotificationScrimPadding;

    private final QuickAccessWalletClient mQuickAccessWalletClient;
    private final Executor mUiExecutor;
@@ -812,6 +813,8 @@ public class NotificationPanelViewController extends PanelViewController {
                R.dimen.notification_scrim_corner_radius);
        mScreenCornerRadius = mResources.getDimensionPixelSize(
                com.android.internal.R.dimen.rounded_corner_radius);
        mNotificationScrimPadding = mResources.getDimensionPixelSize(
                R.dimen.notification_side_paddings);
    }

    private void updateViewControllers(KeyguardStatusView keyguardStatusView,
@@ -2043,29 +2046,37 @@ public class NotificationPanelViewController extends PanelViewController {
        mMediaHierarchyManager.setQsExpansion(qsExpansionFraction);
        int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction);
        mScrimController.setQsPosition(qsExpansionFraction, qsPanelBottomY);
        setNotificationBounds(qsExpansionFraction, qsPanelBottomY);
        mNotificationStackScrollLayoutController.setQsExpansionFraction(qsExpansionFraction);
        mDepthController.setQsPanelExpansion(qsExpansionFraction);
    }

    private Runnable mOnStackYChanged = () -> {
        if (mQs != null) {
            setNotificationBounds();
        }
    };

    /**
     * Updates scrim bounds, QS clipping, and KSV clipping as well based on the bounds of the shade
     * and QS state.
     *
     * @param qsFraction QS expansion fraction, from getQsExpansionFraction().
     * @param qsPanelBottomY Absolute y position of the bottom of QS as it's being pulled.
     */
    private void setNotificationBounds(float qsFraction, int qsPanelBottomY) {
    private void setNotificationBounds() {
        int top = 0;
        int bottom = 0;
        int left = 0;
        int right = 0;
        boolean visible = (qsFraction > 0 || qsPanelBottomY > 0)

        final int qsPanelBottomY = calculateQsBottomPosition(getQsExpansionFraction());
        final boolean visible = (getQsExpansionFraction() > 0 || qsPanelBottomY > 0)
                && !mShouldUseSplitNotificationShade;
        final float notificationTop = mAmbientState.getStackY()
                - mNotificationScrimPadding
                - mAmbientState.getScrollY();
        setQsExpansionEnabled(mAmbientState.getScrollY() == 0);

        int radius = mScrimCornerRadius;
        if (visible || !mShouldUseSplitNotificationShade) {
            if (!mShouldUseSplitNotificationShade) {
                float notificationTop = mAmbientState.getStackY() - mQsNotificationTopPadding;
                top = (int) Math.min(qsPanelBottomY, notificationTop);
                bottom = getView().getBottom();
                left = getView().getLeft();
@@ -3060,6 +3071,7 @@ public class NotificationPanelViewController extends PanelViewController {
            // The expandedHeight is always the full panel Height when bypassing
            expandedHeight = getMaxPanelHeightNonBypass();
        }
        mNotificationStackScrollLayoutController.setOnStackYChanged(mOnStackYChanged);
        mNotificationStackScrollLayoutController.setExpandedHeight(expandedHeight);
        updateKeyguardBottomAreaAlpha();
        updateBigClockAlpha();