/** * Builds a {@link Tree tree} with {@link AccessibilityElement} based on the given root * {@link AccessibilityNodeInfo}. * * @param root * - the root {@link AccessibilityNodeInfo} on which the {@link Tree tree} is being built * @param visibleOnly * - if <code>true</code> only the visible nodes will be used; if <code>false</code> all nodes will be used * @return a {@link Tree tree} with {@link AccessibilityElement} based on the given root * {@link AccessibilityNodeInfo} */ public static Tree<AccessibilityElement> buildTree(AccessibilityNodeInfo root, boolean visibleOnly) { Node<AccessibilityElement> rootNode = buildNode(root, 0, visibleOnly); Tree<AccessibilityElement> builtTree = new Tree<AccessibilityElement>(rootNode); return builtTree; } }