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

Commit 19c84ea6 authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Fix requestLayout-during-layout problems"

parents 9a9f306c 3efa7b59
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -824,10 +824,12 @@ public final class ViewRootImpl implements ViewParent,

    @Override
    public void requestLayout() {
        if (!mHandlingLayoutInLayoutRequest) {
            checkThread();
            mLayoutRequested = true;
            scheduleTraversals();
        }
    }

    @Override
    public boolean isLayoutRequested() {
@@ -1712,7 +1714,7 @@ public final class ViewRootImpl implements ViewParent,
        boolean triggerGlobalLayoutListener = didLayout
                || attachInfo.mRecomputeGlobalAttributes;
        if (didLayout) {
            performLayout();
            performLayout(lp, desiredWindowWidth, desiredWindowHeight);

            // By this point all views have been sized and positionned
            // We can compute the transparent area
@@ -1920,7 +1922,8 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    private void performLayout() {
    private void performLayout(WindowManager.LayoutParams lp, int desiredWindowWidth,
            int desiredWindowHeight) {
        mLayoutRequested = false;
        mScrollMayChange = true;
        mInLayout = true;
@@ -1942,6 +1945,8 @@ public final class ViewRootImpl implements ViewParent,
                for (int i = 0; i < numViewsRequestingLayout; ++i) {
                    mLayoutRequesters.get(i).requestLayout();
                }
                measureHierarchy(host, lp, mView.getContext().getResources(),
                        desiredWindowWidth, desiredWindowHeight);
                // Now run layout one more time
                mInLayout = true;
                host.layout(0, 0, host.getMeasuredWidth(), host.getMeasuredHeight());