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

Commit 6aa02884 authored by András Kurucz's avatar András Kurucz
Browse files

[Flexiglass] Deprecate NSSL.updateTopPadding

Bug: 332574413
Test: check notification placement in various scenarios
Flag: com.android.systemui.scene_container
Change-Id: I381a9eeb8521dec1c039b8e0a7d1b754033b1e3a
parent 6d8b1bb7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -511,10 +511,12 @@ public class AmbientState implements Dumpable {
    }

    public int getTopPadding() {
        SceneContainerFlag.assertInLegacyMode();
        return mTopPadding;
    }

    public void setTopPadding(int topPadding) {
        SceneContainerFlag.assertInLegacyMode();
        mTopPadding = topPadding;
    }

+32 −24
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ public class NotificationStackScrollLayout
            return; // the rest of the fields are not important in Flexiglass
        }

        y = getTopPadding();
        y = mAmbientState.getTopPadding();
        drawDebugInfo(canvas, y, Color.RED, /* label= */ "getTopPadding() = " + y);

        y = getLayoutHeight();
@@ -1231,9 +1231,11 @@ public class NotificationStackScrollLayout

    @Override
    public void setStackTop(float stackTop) {
        if (mAmbientState.getStackTop() != stackTop) {
            mAmbientState.setStackTop(stackTop);
        // TODO(b/332574413): replace the following with using stackTop
        updateTopPadding(stackTop, isAddOrRemoveAnimationPending());
            onTopPaddingChanged(/* animate = */ isAddOrRemoveAnimationPending());
            setExpandedHeight(mExpandedHeight);
        }
    }

    @Override
@@ -1386,12 +1388,15 @@ public class NotificationStackScrollLayout
    }

    public int getTopPadding() {
        // TODO(b/332574413) replace all usages of getTopPadding()
        if (SceneContainerFlag.isEnabled()) {
            return (int) mAmbientState.getStackTop();
        } else {
            return mAmbientState.getTopPadding();
        }
    }

    private void setTopPadding(int topPadding, boolean animate) {
        if (getTopPadding() != topPadding) {
            mAmbientState.setTopPadding(topPadding);
    private void onTopPaddingChanged(boolean animate) {
        boolean shouldAnimate = animate || mAnimateNextTopPaddingChange;
        updateAlgorithmHeightAndPadding();
        updateContentHeight();
@@ -1408,7 +1413,6 @@ public class NotificationStackScrollLayout
        notifyHeightChangeListener(null, shouldAnimate);
        mAnimateNextTopPaddingChange = false;
    }
    }

    /**
     * Apply expansion fraction to the y position and height of the notifications panel.
@@ -2708,6 +2712,7 @@ public class NotificationStackScrollLayout
     * @param animate  whether to animate the change
     */
    public void updateTopPadding(float qsHeight, boolean animate) {
        SceneContainerFlag.assertInLegacyMode();
        int topPadding = (int) qsHeight;
        int minStackHeight = getLayoutMinHeightInternal();
        if (topPadding + minStackHeight > getHeight()) {
@@ -2715,7 +2720,10 @@ public class NotificationStackScrollLayout
        } else {
            mTopPaddingOverflow = 0;
        }
        setTopPadding(topPadding, animate && !mKeyguardBypassEnabled);
        if (mAmbientState.getTopPadding() != topPadding) {
            mAmbientState.setTopPadding(topPadding);
            onTopPaddingChanged(/* animate = */ animate && !mKeyguardBypassEnabled);
        }
        setExpandedHeight(mExpandedHeight);
    }

+1 −0
Original line number Diff line number Diff line
@@ -1328,6 +1328,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
    }

    public int getTopPadding() {
        SceneContainerFlag.assertInLegacyMode();
        return mView.getTopPadding();
    }