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

Commit 311a63af authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Add check for no children in VIew hosting virtual view tree.

1. For accessibility purposes View may report a virtual tree
   rooted at them to convey the logical structure they draw.
   These are usually custom Views. Such views cannot have
   children and this patch adds a check for that.

bug:6022217

Change-Id: I3795a613b4aef1a7ec5810db8584a11b648870f2
parent b6ad5b14
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -13055,11 +13055,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
            ViewDebug.trace(this, ViewDebug.HierarchyTraceType.REQUEST_LAYOUT);
        }
        if (getAccessibilityNodeProvider() != null) {
            throw new IllegalStateException("Views with AccessibilityNodeProvider"
                    + " can't have children.");
        }
        mPrivateFlags |= FORCE_LAYOUT;
        mPrivateFlags |= INVALIDATED;
+9 −0
Original line number Diff line number Diff line
@@ -2669,6 +2669,15 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        return child.draw(canvas, this, drawingTime);
    }

    @Override
    public void requestLayout() {
        if (mChildrenCount > 0 && getAccessibilityNodeProvider() != null) {
            throw new IllegalStateException("Views with AccessibilityNodeProvider"
                    + " can't have children.");
        }
        super.requestLayout();
    }

    /**
     * 
     * @param enabled True if children should be drawn with layers, false otherwise.