Skip to content

Commit 6e42470

Browse files
sganovAndroid (Google) Code Review
authored andcommitted
Merge "Accessibility window query APIs should respect root name space." into ics-mr1
2 parents 7f0c850 + 57f3b56 commit 6e42470

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

core/java/android/view/View.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,10 +4171,12 @@ void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
41714171
bounds.offset(locationOnScreen[0], locationOnScreen[1]);
41724172
info.setBoundsInScreen(bounds);
41734173

4174-
ViewParent parent = getParent();
4175-
if (parent instanceof View) {
4176-
View parentView = (View) parent;
4177-
info.setParent(parentView);
4174+
if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
4175+
ViewParent parent = getParent();
4176+
if (parent instanceof View) {
4177+
View parentView = (View) parent;
4178+
info.setParent(parentView);
4179+
}
41784180
}
41794181

41804182
info.setPackageName(mContext.getPackageName());

core/java/android/view/ViewGroup.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,14 +2229,10 @@ boolean dispatchPopulateAccessibilityEventInternal(AccessibilityEvent event) {
22292229
@Override
22302230
void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
22312231
super.onInitializeAccessibilityNodeInfoInternal(info);
2232-
// If the view is not the topmost one in the view hierarchy and it is
2233-
// marked as the logical root of a view hierarchy, do not go any deeper.
2234-
if ((!(getParent() instanceof ViewRootImpl)) && (mPrivateFlags & IS_ROOT_NAMESPACE) != 0) {
2235-
return;
2236-
}
22372232
for (int i = 0, count = mChildrenCount; i < count; i++) {
22382233
View child = mChildren[i];
2239-
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
2234+
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
2235+
&& (child.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
22402236
info.addChild(child);
22412237
}
22422238
}

0 commit comments

Comments
 (0)