core/commands/native_tap/android_ui_dump library

Parsing and matching for Android uiautomator dump output, used by fdb native-tap --text on Android.

Pure functions only: no process calls, so it is unit-testable without a device.

Classes

AndroidBounds
A [left,top][right,bottom] rectangle in physical pixels.
AndroidUiDumpInvalid
The dump is unusable. reason says why, e.g. the ERROR: could not get idle state. line uiautomator prints (with exit code 0) while the screen is animating.
AndroidUiDumpParse
Outcome of parseAndroidUiDump.
AndroidUiDumpParsed
The dump held a complete <hierarchy>; nodes are in document order.
AndroidUiMatch
A node that matched a label, and the node fdb taps for it.
AndroidUiNode
One <node> from a uiautomator window dump.

Functions

androidVisibleLabels(List<AndroidUiNode> nodes) → List<String>
Distinct non-empty labels (text, else content-desc) of nodes with on-screen bounds, in document order. Used to tell the caller what was on screen when nothing matched.
decodeXmlEntities(String s) → String
Decodes the XML entities uiautomator writes: &amp; &lt; &gt; &quot; &apos; and numeric references like &#10; / &#x1F600;. Unknown entities are left as they are.
findAndroidUiMatches(List<AndroidUiNode> nodes, String query) → List<AndroidUiMatch>
Finds the nodes matching query, in document order, in the first tier that has any match:
parseAndroidBounds(String? raw) → AndroidBounds?
Parses [l,t][r,b]. Returns null for anything else.
parseAndroidUiDump(String raw) → AndroidUiDumpParse
Parses raw uiautomator dump output.