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

Commit 7a4928e2 authored by Manusaran Reddy Avula (xWF)'s avatar Manusaran Reddy Avula (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Don't skip calling requestLayout to the parent view"

This reverts commit efb8469b.

Reason for revert: Reverting to see if this is the culprit causing b/381578167 

Change-Id: I5f00160feb7ce1465087ab1fbff363e911948763
parent efb8469b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28277,7 +28277,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        mPrivateFlags |= PFLAG_FORCE_LAYOUT;
        mPrivateFlags |= PFLAG_INVALIDATED;
        if (mParent != null) {
        if (mParent != null && !mParent.isLayoutRequested()) {
            mParent.requestLayout();
        }
        if (mAttachInfo != null && mAttachInfo.mViewRequestingLayout == this) {
+0 −42
Original line number Diff line number Diff line
@@ -213,35 +213,6 @@ public class ViewGroupTest {
        assertTrue(autofillableViews.containsAll(Arrays.asList(viewA, viewC)));
    }

    @Test
    public void testMeasureCache() {
        final int spec1 = View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST);
        final int spec2 = View.MeasureSpec.makeMeasureSpec(50, View.MeasureSpec.AT_MOST);
        final Context context = getInstrumentation().getContext();
        final View child = new View(context);
        final TestView parent = new TestView(context, 0);
        parent.addView(child);

        child.setPadding(1, 2, 3, 4);
        parent.measure(spec1, spec1);
        assertEquals(4, parent.getMeasuredWidth());
        assertEquals(6, parent.getMeasuredHeight());

        child.setPadding(5, 6, 7, 8);
        parent.measure(spec2, spec2);
        assertEquals(12, parent.getMeasuredWidth());
        assertEquals(14, parent.getMeasuredHeight());

        // This ends the state of forceLayout.
        parent.layout(0, 0, 50, 50);

        // The cached values should be cleared after the new setPadding is called. And the measured
        // width and height should be up-to-date.
        parent.measure(spec1, spec1);
        assertEquals(12, parent.getMeasuredWidth());
        assertEquals(14, parent.getMeasuredHeight());
    }

    private static void getUnobscuredTouchableRegion(Region outRegion, View view) {
        outRegion.set(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
        final ViewParent parent = view.getParent();
@@ -269,19 +240,6 @@ public class ViewGroupTest {
        protected void onLayout(boolean changed, int l, int t, int r, int b) {
            // We don't layout this view.
        }

        @Override
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            int measuredWidth = 0;
            int measuredHeight = 0;
            final int count = getChildCount();
            for (int i = 0; i < count; i++) {
                final View child = getChildAt(i);
                measuredWidth += child.getPaddingLeft() + child.getPaddingRight();
                measuredHeight += child.getPaddingTop() + child.getPaddingBottom();
            }
            setMeasuredDimension(measuredWidth, measuredHeight);
        }
    }

    public static class AutofillableTestView extends TestView {