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

Commit 0ebff769 authored by András Kurucz's avatar András Kurucz
Browse files

[flexiglass] Verify that NSSL#mContentHeight is not accessed

NSSL#mContentHeight is replaced by ScrollViewFields#.intrinsicStackHeight when flexiglass is enabled.

Bug: 296118689
Test: run sysui with, and without flexiglass
Flag: EXEMPT mechanical refactor
Change-Id: I6e15cd9a703f76406c86ac77a331ff7cad5ac435
parent 8dfc9321
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -596,10 +596,12 @@ public class AmbientState implements Dumpable {
    }

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

    public float getContentHeight() {
        SceneContainerFlag.assertInLegacyMode();
        return mContentHeight;
    }

+27 −13
Original line number Diff line number Diff line
@@ -904,7 +904,7 @@ public class NotificationStackScrollLayout
        drawDebugInfo(canvas, y, Color.YELLOW,
                /* label= */ "mAmbientState.getStackY() + mIntrinsicContentHeight = " + y);

        y = mContentHeight;
        y = getContentHeight();
        drawDebugInfo(canvas, y, Color.MAGENTA,
                /* label= */ "mContentHeight = " + y);

@@ -1692,7 +1692,8 @@ public class NotificationStackScrollLayout
            if (mShouldShowShelfOnly) {
                stackHeight = getTopPadding() + mShelf.getIntrinsicHeight();
            } else if (mQsFullScreen) {
                int stackStartPosition = mContentHeight - getTopPadding() + getIntrinsicPadding();
                int stackStartPosition =
                        getContentHeight() - getTopPadding() + getIntrinsicPadding();
                int stackEndPosition = mMaxTopPadding + mShelf.getIntrinsicHeight();
                if (stackStartPosition <= stackEndPosition) {
                    stackHeight = stackEndPosition;
@@ -2506,7 +2507,7 @@ public class NotificationStackScrollLayout
        }
        // In current design, it only use the top HUN to treat all of HUNs
        // although there are more than one HUNs
        int contentHeight = mContentHeight;
        int contentHeight = getContentHeight();
        if (!isExpanded() && mInHeadsUpPinnedMode) {
            contentHeight = mHeadsUpInset + getTopHeadsUpPinnedHeight();
        }
@@ -2646,13 +2647,12 @@ public class NotificationStackScrollLayout

        // The topPadding can be bigger than the regular padding when qs is expanded, in that
        // state the maxPanelHeight and the contentHeight should be bigger

        mContentHeight =
                (int) (height + Math.max(getIntrinsicPadding(), getTopPadding()) + mBottomPadding);
        setContentHeight(
                (int) (height + Math.max(getIntrinsicPadding(), getTopPadding()) + mBottomPadding));
        updateScrollability();
        clampScrollPosition();
        updateStackPosition();
        mAmbientState.setContentHeight(mContentHeight);
        mAmbientState.setContentHeight(getContentHeight());
    }

    @Override
@@ -4356,9 +4356,9 @@ public class NotificationStackScrollLayout
            // it is based on notifications bottom, which is lower on split shade.
            // Here we prefer to use at least a minimum height defined for split shade.
            // Otherwise the expansion motion is too fast.
            contentHeight = Math.max(mSplitShadeMinContentHeight, mContentHeight);
            contentHeight = Math.max(mSplitShadeMinContentHeight, getContentHeight());
        } else {
            contentHeight = mContentHeight;
            contentHeight = getContentHeight();
        }
        return Math.max(mMaxLayoutHeight - contentHeight, 0);
    }
@@ -5526,11 +5526,7 @@ public class NotificationStackScrollLayout
            println(pw, "ambientStateSwipingUp", mAmbientState.isSwipingUp());
            println(pw, "maxDisplayedNotifications", mMaxDisplayedNotifications);
            println(pw, "intrinsicContentHeight", mIntrinsicContentHeight);
            println(pw, "contentHeight", mContentHeight);
            println(pw, "intrinsicPadding", mIntrinsicPadding);
            if (!SceneContainerFlag.isEnabled()) {
                println(pw, "topPadding", getTopPadding());
            }
            println(pw, "bottomPadding", mBottomPadding);
            dumpRoundedRectClipping(pw);
            println(pw, "requestedClipBounds", mRequestedClipBounds);
@@ -5555,6 +5551,11 @@ public class NotificationStackScrollLayout
            println(pw, "isSmallLandscapeLockscreenEnabled", mIsSmallLandscapeLockscreenEnabled);
            mNotificationStackSizeCalculator.dump(pw, args);
            mScrollViewFields.dump(pw);
            if (!SceneContainerFlag.isEnabled()) {
                // fields which will be removed with SceneContainer
                println(pw, "contentHeight", getContentHeight());
                println(pw, "topPadding", getTopPadding());
            }
        });
        pw.println();
        pw.println("Contents:");
@@ -6955,4 +6956,17 @@ public class NotificationStackScrollLayout
        void onAnimationEnd(
                List<ExpandableNotificationRow> viewsToRemove, @SelectedRows int selectedRows);
    }

    // -------------------- Getters / Setters for the SceneContainer refactor ----------------------

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

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