setQueryFromAppProcessEnabled

Connects this node to the View's root so that operations on this node can query the entire AccessibilityNodeInfoCompat tree and perform accessibility actions on nodes.

Testing or debugging tools should create this AccessibilityNodeInfoCompat node using onInitializeAccessibilityNodeInfo or AccessibilityNodeProviderCompat and call this method, then navigate and interact with the node tree by calling methods on the node. Calling this method more than once on the same node is a no-op. After calling this method, all nodes linked to this node (children, ancestors, etc.) are also queryable.

Here "query" refers to the following node operations:

This is intended for short-lived inspections from testing or debugging tools in the app process, as operations on this node tree will only succeed as long as the associated view hierarchy remains attached to a window. AccessibilityNodeInfoCompat objects can quickly become out of sync with their corresponding View objects; if you wish to inspect a changed or different view hierarchy then create a new node from any view in that hierarchy and call this method on that new node, instead of disabling &re-enabling the connection on the previous node.

Compatibility:

  • API <34: No-op

Parameters

view

The view that generated this node, or any view in the same view-root hierarchy.

enabled

Whether to enable (true) or disable (false) querying from the app process.

Throws

If called from an AccessibilityService, or if provided a View that is not attached to a window.