VisualTree
Register the native Android VisualTree tool suite to inspect the view hierarchy, capture screenshots, and manage diagnostic overlays.
Install
Published artifact: ai.ansight:ansight-tools-visualtree-android.
dependencies {
debugImplementation("ai.ansight:ansight-tools-visualtree-android:1.0.2-preview.1")
}
Register the Suite
import ai.ansight.runtime.AnsightOptions
import ai.ansight.tools.visualtree.withVisualTreeTools
val options = AnsightOptions.createBuilder()
.withVisualTreeTools()
.withReadOnlyToolAccess()
.build()
Registration API
withVisualTreeTools(): registers the visual tree, screenshot, and diagnostic overlay suite.AndroidVisualTreeTools.create(): creates the suite tools for lower-level registration.withReadOnlyToolAccess(): exposes visual tree, screenshot, node inspection, and read-only overlay tools.withReadWriteToolAccess(): also exposes overlay creation and update.withAllToolAccess(): also exposes overlay removal and clearing.
Specific Concerns
- The tools inspect the active Android view hierarchy.
- Screenshot capture exports rendered UI content.
ui.get_screenshotstreams bytes over the binary transfer channel.- Overlay deletion tools are delete-scoped on Android.
Important: Calling screenshot tools will result in an FPS drop while the current frame is captured, encoded, and transferred. Avoid screenshot-heavy investigations during performance measurements unless visual evidence is required.
Tool Matrix
| Name | Id | Scope | Description | Security |
|---|---|---|---|---|
Get Visual Tree | ui.get_visual_tree | Read | Returns the current visual hierarchy for the requested source. | High |
Get Screenshot | ui.get_screenshot | Read | Captures a screenshot and streams bytes over binary transfer. | High |
Inspect Node | ui.inspect_node | Read | Returns one node from the current visual tree. | High |
Show Overlay | ui.show_overlay | Write | Shows a rectangular diagnostic overlay. | Critical |
Get Overlay | ui.get_overlay | Read | Returns one diagnostic overlay. | High |
Query Overlays | ui.query_overlays | Read | Lists active diagnostic overlays. | High |
Update Overlay | ui.update_overlay | Write | Updates a diagnostic overlay. | Critical |
Remove Overlay | ui.remove_overlay | Delete | Removes a diagnostic overlay. | Critical |
Clear Overlays | ui.clear_overlays | Delete | Clears diagnostic overlays. | Critical |
Tool Details
Use read tools for inspection and screenshots. Use write tools to draw or update overlays. Use delete tools only when the session needs to remove overlays remotely.