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

Commit 0a082e72 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix unnecessary onApplyWindowInsets

...such that we don't trigger another apply immediately after
the first frame.

Test: Launch calc, observe only one onApplyInsets
Bug: 148604688
Change-Id: I1b8c1735ca0b93869eb3bf8bd1fc078e6474e653
parent 46d77cf7
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -2206,8 +2206,9 @@ public final class ViewRootImpl implements ViewParent,
        return insets;
    }

    void dispatchApplyInsets(View host) {
    public void dispatchApplyInsets(View host) {
        Trace.traceBegin(Trace.TRACE_TAG_VIEW, "dispatchApplyInsets");
        mApplyInsetsRequested = false;
        WindowInsets insets = getWindowInsets(true /* forceConstruct */);
        final boolean dispatchCutout = (mWindowAttributes.layoutInDisplayCutoutMode
                == LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS);
@@ -2444,7 +2445,6 @@ public final class ViewRootImpl implements ViewParent,
        }

        if (mApplyInsetsRequested) {
            mApplyInsetsRequested = false;
            updateVisibleInsets();
            dispatchApplyInsets(host);
            if (mLayoutRequested) {
@@ -2621,7 +2621,6 @@ public final class ViewRootImpl implements ViewParent,
                if (contentInsetsChanged || mLastSystemUiVisibility !=
                        mAttachInfo.mSystemUiVisibility || mApplyInsetsRequested) {
                    mLastSystemUiVisibility = mAttachInfo.mSystemUiVisibility;
                    mApplyInsetsRequested = false;
                    dispatchApplyInsets(host);
                    // We applied insets so force contentInsetsChanged to ensure the
                    // hierarchy is measured below.