Using wrong virtual view id When prefetching accessibility nodes.
When getting an accessibility node info we also prefetch its predecessors,
siblings and descendants up to fifty. If a view has a node provider, i.e.
virtual descendants, and the id of the virtual descendant is not specified
we use a speacial constant to refer that the provider should create a node
for its hosting view. The bug was that we were not using the correct constant
when calling into the provider.
bug:17664111
Change-Id: I4f6b2333e1e7e3e2bb6b164c0752613417c60d16
diff --git a/core/java/android/view/AccessibilityInteractionController.java b/core/java/android/view/AccessibilityInteractionController.java
index a283b91..baa133d 100644
--- a/core/java/android/view/AccessibilityInteractionController.java
+++ b/core/java/android/view/AccessibilityInteractionController.java
@@ -889,7 +889,13 @@
}
}
} else {
- AccessibilityNodeInfo root = provider.createAccessibilityNodeInfo(virtualViewId);
+ final AccessibilityNodeInfo root;
+ if (virtualViewId != AccessibilityNodeInfo.UNDEFINED_ITEM_ID) {
+ root = provider.createAccessibilityNodeInfo(virtualViewId);
+ } else {
+ root = provider.createAccessibilityNodeInfo(
+ AccessibilityNodeProvider.HOST_VIEW_ID);
+ }
if (root != null) {
outInfos.add(root);
if ((fetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS) != 0) {