Accessibility window query APIs should respect root name space.
1. The window query API used to not-respect the root name space while traversing the parent relation i.e. a client was able to fetch the parent of a root name space node. 2. Children that are root name space were reported but their descendants not. Actually such children should not be reported since they are the root of a separate logical sub-tree. Such a tree is exposed by its root allowing its traversal. The accessibility APIs should be able to explore a virtual tree, i.e. one with a descendant which is root name space, only if an accessibility event from there was received. bug:5480096 Change-Id: I4c4d805aa2f6d4edba86eda213b5239bea83eed2
This commit is contained in:
@@ -4122,10 +4122,12 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
bounds.offset(locationOnScreen[0], locationOnScreen[1]);
|
||||
info.setBoundsInScreen(bounds);
|
||||
|
||||
ViewParent parent = getParent();
|
||||
if (parent instanceof View) {
|
||||
View parentView = (View) parent;
|
||||
info.setParent(parentView);
|
||||
if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
|
||||
ViewParent parent = getParent();
|
||||
if (parent instanceof View) {
|
||||
View parentView = (View) parent;
|
||||
info.setParent(parentView);
|
||||
}
|
||||
}
|
||||
|
||||
info.setPackageName(mContext.getPackageName());
|
||||
|
||||
@@ -2231,14 +2231,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
|
||||
@Override
|
||||
void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfoInternal(info);
|
||||
// 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++) {
|
||||
View child = mChildren[i];
|
||||
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
|
||||
if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE
|
||||
&& (child.mPrivateFlags & IS_ROOT_NAMESPACE) == 0) {
|
||||
info.addChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user