From 93b2182a2e1a42ef60d3c0fa79fbdc4b27875685 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Wed, 27 Jul 2011 15:42:53 -0700 Subject: [PATCH] AccessibilityNodeInfo reports no children for the topmost view in the tree. 1. My previous change to restrain AccessibilityNodeInfo to report children if it is root namespace did not take into account that the tompost view i.e. the decor view actually is a root namespace. Adding check to allow the info to report children of rthe topmost view but do not do so if a descendant is flagged as root namespace. bug:5086988 Change-Id: Ib82b8ebe5a2c287ab1c5333d130ec50eb9ced78c --- core/java/android/view/ViewGroup.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 697636ec73808..c89e0397b0f66 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2162,7 +2162,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); - if ((mPrivateFlags & IS_ROOT_NAMESPACE) != 0) { + // If the view is not the topmost one in the view hierarchy and it is + // marked as the logical root of a view hierarchy, do not go any deeper. + if ((!(getParent() instanceof ViewRootImpl)) && (mPrivateFlags & IS_ROOT_NAMESPACE) != 0) { return; } for (int i = 0, count = mChildrenCount; i < count; i++) {