Merge "Accessibility window query APIs should respect root name space." into ics-mr1

This commit is contained in:
Svetoslav Ganov
2011-11-02 10:13:55 -07:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 10 deletions

View File

@@ -4171,10 +4171,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());

View File

@@ -2229,14 +2229,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);
}
}