Use node tree debugging

About node tree debugging

Accessibility services use a separate representation of your app's UI to
operate. As you debug, you might find it useful to view the hierarchy and
attributes of UI elements in the same way that accessibility services view them.
To accomplish this task, you can use node tree debugging. This tool
provides information about how an
AccessibilityService object, such as
TalkBack, views UI elements within your app.

In node tree debugging, a window's content is presented as a tree of
AccessibilityNodeInfo objects. Each node in
the tree may have a set of
AccessibilityAction
objects associated with it. Each AccessibilityAction object, in
turn, stores information about the interactions that it supports, such as
focusable or clickable.

Note: The object hierarchy provided by the node tree
debugging tool is simplified and may not map one-to-one with the corresponding
hierarchy of View objects within an app's UI.

Use node tree debugging

Note: Output from the logcat command can
be noisy. To filter the logcat output, consider using the
TreeDebug keyword.

Open your app.

Perform the gesture that you configured to print the node tree. The
hierarchy tree is displayed in the terminal window.

Interpret node tree debugging output

The following two examples use a single LinearLayout
with two child views, a CheckBox and a
Switch. The node tree debugging tool recognizes that
the LinearLayout element can be interpreted as a
FrameLayout.