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

Commit 9af5fe52 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Rename NSSL bottomInset to imeInset" into main

parents 4567de59 4dc9b4af
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;
                }

@@ -1792,8 +1793,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();
@@ -1814,7 +1815,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        }
        if (!mIsInsetAnimationRunning) {
            // update bottom inset e.g. after rotation
            updateBottomInset(insets);
            updateImeInset(insets);
        }
        return insets;
    }
@@ -2218,9 +2219,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