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

Commit 791c388b authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge changes Icc598e07,Ic9265fc6,I48f03b64,I9d4609bd into main

* changes:
  [flexiglass] Verify that NSSL#mImeInset is not used
  [flexiglass] Verify that NSSL#mMaxTopPadding is not accessed
  [flexiglass] Verify that NSSL#mContentHeight is not accessed
  [flexiglass] Migrate NSSL#isInContentBounds(float y)
parents 56e0cbcd 96b499c4
Loading
Loading
Loading
Loading
+28 −10
Original line number Diff line number Diff line
@@ -678,8 +678,10 @@ public class NotificationStackScrollLayout
        mGroupMembershipManager = Dependency.get(GroupMembershipManager.class);
        mGroupExpansionManager = Dependency.get(GroupExpansionManager.class);
        setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
        if (!SceneContainerFlag.isEnabled()) {
            setWindowInsetsAnimationCallback(mInsetsCallback);
        }
    }

    /**
     * Set the overexpansion of the panel to be applied to the view.
@@ -1694,7 +1696,7 @@ public class NotificationStackScrollLayout
            } else if (mQsFullScreen) {
                int stackStartPosition =
                        getContentHeight() - getTopPadding() + getIntrinsicPadding();
                int stackEndPosition = mMaxTopPadding + mShelf.getIntrinsicHeight();
                int stackEndPosition = getMaxTopPadding() + mShelf.getIntrinsicHeight();
                if (stackStartPosition <= stackEndPosition) {
                    stackHeight = stackEndPosition;
                } else {
@@ -2086,6 +2088,7 @@ public class NotificationStackScrollLayout
    }

    private void updateImeInset(WindowInsets windowInsets) {
        SceneContainerFlag.assertInLegacyMode();
        mImeInset = windowInsets.getInsets(WindowInsets.Type.ime()).bottom;

        if (mFooterView != null && mFooterView.getViewState() != null) {
@@ -2112,7 +2115,7 @@ public class NotificationStackScrollLayout
        if (cutout != null) {
            mWaterfallTopInset = cutout.getWaterfallInsets().top;
        }
        if (!mIsInsetAnimationRunning) {
        if (!SceneContainerFlag.isEnabled() && !mIsInsetAnimationRunning) {
            // update bottom inset e.g. after rotation
            updateImeInset(insets);
        }
@@ -2513,6 +2516,7 @@ public class NotificationStackScrollLayout
    }

    private int getImeInset() {
        SceneContainerFlag.assertInLegacyMode();
        // The NotificationStackScrollLayout does not extend all the way to the bottom of the
        // display. Therefore, subtract that space from the mImeInset, in order to only include
        // the portion of the bottom inset that actually overlaps the NotificationStackScrollLayout.
@@ -2851,11 +2855,6 @@ public class NotificationStackScrollLayout
        setExpandedHeight(mExpandedHeight);
    }

    public void setMaxTopPadding(int maxTopPadding) {
        SceneContainerFlag.assertInLegacyMode();
        mMaxTopPadding = maxTopPadding;
    }

    public int getLayoutMinHeight() {
        SceneContainerFlag.assertInLegacyMode();
        return getLayoutMinHeightInternal();
@@ -3639,8 +3638,12 @@ public class NotificationStackScrollLayout
     * @return Whether a y coordinate is inside the content.
     */
    public boolean isInContentBounds(float y) {
        if (SceneContainerFlag.isEnabled()) {
            return y < mAmbientState.getStackCutoff();
        } else {
            return y < getHeight() - getEmptyBottomMarginInternal();
        }
    }

    private float getTouchSlop(MotionEvent event) {
        // Adjust the touch slop if another gesture may be being performed.
@@ -5510,7 +5513,6 @@ public class NotificationStackScrollLayout
            println(pw, "alpha", getAlpha());
            println(pw, "suppressChildrenMeasureLayout", mSuppressChildrenMeasureAndLayout);
            println(pw, "scrollY", mAmbientState.getScrollY());
            println(pw, "maxTopPadding", mMaxTopPadding);
            println(pw, "showShelfOnly", mShouldShowShelfOnly);
            println(pw, "qsExpandFraction", mQsExpansionFraction);
            println(pw, "isCurrentUserSetup", mIsCurrentUserSetup);
@@ -5547,6 +5549,7 @@ public class NotificationStackScrollLayout
                println(pw, "intrinsicContentHeight", getIntrinsicContentHeight());
                println(pw, "contentHeight", getContentHeight());
                println(pw, "topPadding", getTopPadding());
                println(pw, "maxTopPadding", getMaxTopPadding());
            }
        });
        pw.println();
@@ -6953,10 +6956,12 @@ public class NotificationStackScrollLayout

    /** Use {@link ScrollViewFields#intrinsicStackHeight}, when SceneContainerFlag is enabled. */
    private int getContentHeight() {
        SceneContainerFlag.assertInLegacyMode();
        return mContentHeight;
    }

    private void setContentHeight(int contentHeight) {
        SceneContainerFlag.assertInLegacyMode();
        mContentHeight = contentHeight;
    }

@@ -6965,10 +6970,23 @@ public class NotificationStackScrollLayout
     * @return the height of the content ignoring the footer.
     */
    public float getIntrinsicContentHeight() {
        SceneContainerFlag.assertInLegacyMode();
        return mIntrinsicContentHeight;
    }

    private void setIntrinsicContentHeight(float intrinsicContentHeight) {
        SceneContainerFlag.assertInLegacyMode();
        mIntrinsicContentHeight = intrinsicContentHeight;
    }

    private int getMaxTopPadding() {
        SceneContainerFlag.assertInLegacyMode();
        return mMaxTopPadding;
    }

    /** Not used with SceneContainerFlag, because we rely on the placeholder for placement. */
    public void setMaxTopPadding(int maxTopPadding) {
        SceneContainerFlag.assertInLegacyMode();
        mMaxTopPadding = maxTopPadding;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -1207,6 +1207,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
    }

    @Test
    @DisableSceneContainer
    public void testWindowInsetAnimationProgress_updatesBottomInset() {
        int imeInset = 100;
        WindowInsets windowInsets = new WindowInsets.Builder()