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

Commit 5181be04 authored by András Kurucz's avatar András Kurucz
Browse files

[flexiglass] Verify that NSSL#mQsExpansionFraction is not accessed

NSSL doesn't need to combine multiple sources to know the shade expansion fraction with flexiglass.

Bug: 296118689
Test: run sysui with, and without flexiglass
Flag: EXEMPT mechanical refactor
Change-Id: I0f7a1220a56a4184b38241ee610591497df1a15b
parent d2e98330
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -797,7 +797,7 @@ public class NotificationStackScrollLayout
                && !onKeyguard()
                && mUpcomingStatusBarState != StatusBarState.KEYGUARD
                // quick settings don't affect notifications when not in full screen
                && (mQsExpansionFraction != 1 || !mQsFullScreen)
                && (getQsExpansionFraction() != 1 || !mQsFullScreen)
                && !mScreenOffAnimationController.shouldHideNotificationsFooter()
                && !mIsRemoteInputActive;
    }
@@ -1528,7 +1528,7 @@ public class NotificationStackScrollLayout
        float fraction = mAmbientState.getExpansionFraction();
        // If we are on quick settings, we need to quickly hide it to show the bouncer to avoid an
        // overlap. Otherwise, we maintain the normal fraction for smoothness.
        if (mAmbientState.isBouncerInTransit() && mQsExpansionFraction > 0f) {
        if (mAmbientState.isBouncerInTransit() && getQsExpansionFraction() > 0f) {
            fraction = BouncerPanelExpansionCalculator.aboutToShowBouncerProgress(fraction);
        }
        final float stackY = MathUtils.lerp(0, endTopPosition, fraction);
@@ -1552,7 +1552,7 @@ public class NotificationStackScrollLayout
            }
            updateInterpolatedStackHeight(endHeight, fraction);
        } else {
            if (mQsExpansionFraction <= 0 && !shouldSkipHeightUpdate()) {
            if (getQsExpansionFraction() <= 0 && !shouldSkipHeightUpdate()) {
                final float endHeight = updateStackEndHeight(
                        getHeight(), getEmptyBottomMarginInternal(), getTopPadding());
                updateInterpolatedStackHeight(endHeight, fraction);
@@ -1705,7 +1705,7 @@ public class NotificationStackScrollLayout
                        stackHeight = (int) height;
                    } else {
                        stackHeight = (int) NotificationUtils.interpolate(stackStartPosition,
                                stackEndPosition, mQsExpansionFraction);
                                stackEndPosition, getQsExpansionFraction());
                    }
                }
            } else {
@@ -5271,17 +5271,22 @@ public class NotificationStackScrollLayout
        return mQsFullScreen;
    }

    private float getQsExpansionFraction() {
        SceneContainerFlag.assertInLegacyMode();
        return mQsExpansionFraction;
    }

    public void setQsExpansionFraction(float qsExpansionFraction) {
        SceneContainerFlag.assertInLegacyMode();
        boolean footerAffected = mQsExpansionFraction != qsExpansionFraction
                && (mQsExpansionFraction == 1 || qsExpansionFraction == 1);
        boolean footerAffected = getQsExpansionFraction() != qsExpansionFraction
                && (getQsExpansionFraction() == 1 || qsExpansionFraction == 1);
        mQsExpansionFraction = qsExpansionFraction;
        updateUseRoundedRectClipping();

        // If notifications are scrolled,
        // clear out scrollY by the time we push notifications offscreen
        if (getOwnScrollY() > 0) {
            setOwnScrollY((int) MathUtils.lerp(getOwnScrollY(), 0, mQsExpansionFraction));
            setOwnScrollY((int) MathUtils.lerp(getOwnScrollY(), 0, getQsExpansionFraction()));
        }
        if (!FooterViewRefactor.isEnabled() && footerAffected) {
            updateFooter();
@@ -5514,7 +5519,6 @@ public class NotificationStackScrollLayout
            println(pw, "suppressChildrenMeasureLayout", mSuppressChildrenMeasureAndLayout);
            println(pw, "scrollY", mAmbientState.getScrollY());
            println(pw, "showShelfOnly", mShouldShowShelfOnly);
            println(pw, "qsExpandFraction", mQsExpansionFraction);
            println(pw, "isCurrentUserSetup", mIsCurrentUserSetup);
            println(pw, "hideAmount", mAmbientState.getHideAmount());
            println(pw, "ambientStateSwipingUp", mAmbientState.isSwipingUp());
@@ -5550,6 +5554,7 @@ public class NotificationStackScrollLayout
                println(pw, "contentHeight", getContentHeight());
                println(pw, "topPadding", getTopPadding());
                println(pw, "maxTopPadding", getMaxTopPadding());
                println(pw, "qsExpandFraction", getQsExpansionFraction());
            }
        });
        pw.println();
@@ -5622,7 +5627,9 @@ public class NotificationStackScrollLayout
                    pw.println("mIsCurrentUserSetup: " + mIsCurrentUserSetup);
                    pw.println("onKeyguard: " + onKeyguard());
                    pw.println("mUpcomingStatusBarState: " + mUpcomingStatusBarState);
                    pw.println("mQsExpansionFraction: " + mQsExpansionFraction);
                    if (!SceneContainerFlag.isEnabled()) {
                        pw.println("QsExpansionFraction: " + getQsExpansionFraction());
                    }
                    pw.println("mQsFullScreen: " + mQsFullScreen);
                    pw.println(
                            "mScreenOffAnimationController"
@@ -6246,7 +6253,8 @@ public class NotificationStackScrollLayout
        if (SceneContainerFlag.isEnabled()) return;
        // We don't want to clip notifications when QS is expanded, because incoming heads up on
        // the bottom would be clipped otherwise
        boolean qsAllowsClipping = mQsExpansionFraction < 0.5f || mShouldUseSplitNotificationShade;
        boolean qsAllowsClipping =
                getQsExpansionFraction() < 0.5f || mShouldUseSplitNotificationShade;
        boolean clip = mIsExpanded && qsAllowsClipping;
        if (clip != mShouldUseRoundedRectClipping) {
            mShouldUseRoundedRectClipping = clip;
+4 −0
Original line number Diff line number Diff line
@@ -610,6 +610,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    @DisableSceneContainer
    public void testUpdateFooter_remoteInput() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -643,6 +644,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    @DisableSceneContainer
    public void testUpdateFooter_oneClearableNotification() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -659,6 +661,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    @DisableSceneContainer
    public void testUpdateFooter_withoutHistory() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);
@@ -692,6 +695,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    @DisableFlags({FooterViewRefactor.FLAG_NAME, NotifRedesignFooter.FLAG_NAME})
    @DisableSceneContainer
    public void testUpdateFooter_oneNonClearableNotification() {
        setBarStateForTest(StatusBarState.SHADE);
        mStackScroller.setCurrentUserSetup(true);