diff options
| author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-02-22 16:45:02 -0800 |
|---|---|---|
| committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-02-22 16:45:10 -0800 |
| commit | 311a63af40e76925e21dcf273749dcab9d598ddd (patch) | |
| tree | 5916bfb34ff0b8742113d14c282bc0b80414df01 /core/java/android/view/ViewGroup.java | |
| parent | b6ad5b14cbb09f8a10c3155895337c773e7a850b (diff) | |
| download | frameworks_base-311a63af40e76925e21dcf273749dcab9d598ddd.zip frameworks_base-311a63af40e76925e21dcf273749dcab9d598ddd.tar.gz frameworks_base-311a63af40e76925e21dcf273749dcab9d598ddd.tar.bz2 | |
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
Diffstat (limited to 'core/java/android/view/ViewGroup.java')
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index c68d77d..2848e88 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -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. |
