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

Commit 4dc9b4af authored by Lyn's avatar Lyn
Browse files

Rename NSSL bottomInset to imeInset

Bug: 327515087
Test: SystemUITests
Change-Id: I2b10fc6a46211efb66914ef081a5bcdc3971aabc
parent f070ae0e
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -205,7 +205,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private boolean mAnimateNextTopPaddingChange;
    private int mBottomPadding;
    @VisibleForTesting
    int mBottomInset = 0;
    // mImeInset=0 when IME is hidden
    int mImeInset = 0;
    private float mQsExpansionFraction;
    private final int mSplitShadeMinContentHeight;
    private String mLastUpdateSidePaddingDumpString;
@@ -396,7 +397,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                @Override
                public WindowInsets onProgress(WindowInsets windowInsets,
                        List<WindowInsetsAnimation> list) {
                    updateBottomInset(windowInsets);
                    updateImeInset(windowInsets);
                    return windowInsets;
                }

@@ -1788,8 +1789,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                + ((!isExpanded() && isPinnedHeadsUp(v)) ? mHeadsUpInset : getTopPadding());
    }

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

        if (mForcedScroll != null) {
            updateForcedScroll();
@@ -1810,7 +1811,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        }
        if (!mIsInsetAnimationRunning) {
            // update bottom inset e.g. after rotation
            updateBottomInset(insets);
            updateImeInset(insets);
        }
        return insets;
    }
@@ -2214,9 +2215,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

    private int getImeInset() {
        // The NotificationStackScrollLayout does not extend all the way to the bottom of the
        // display. Therefore, subtract that space from the mBottomInset, in order to only include
        // display. Therefore, subtract that space from the mImeInset, in order to only include
        // the portion of the bottom inset that actually overlaps the NotificationStackScrollLayout.
        return Math.max(0, mBottomInset
        return Math.max(0, mImeInset
                - (getRootView().getHeight() - getHeight() - getLocationOnScreen()[1]));
    }

+3 −3
Original line number Diff line number Diff line
@@ -931,14 +931,14 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

    @Test
    public void testWindowInsetAnimationProgress_updatesBottomInset() {
        int bottomImeInset = 100;
        int imeInset = 100;
        WindowInsets windowInsets = new WindowInsets.Builder()
                .setInsets(ime(), Insets.of(0, 0, 0, bottomImeInset)).build();
                .setInsets(ime(), Insets.of(0, 0, 0, imeInset)).build();
        ArrayList<WindowInsetsAnimation> windowInsetsAnimations = new ArrayList<>();
        mStackScrollerInternal
                .dispatchWindowInsetsAnimationProgress(windowInsets, windowInsetsAnimations);

        assertEquals(bottomImeInset, mStackScrollerInternal.mBottomInset);
        assertEquals(imeInset, mStackScrollerInternal.mImeInset);
    }

    @Test