Repository navigation
Conversation
Adds agentic Android control as an opt-in feature on a clean foundation,
superseding the earlier scrcpy-mcp experiment (never merged to main).
Targets UI elements via the accessibility tree, not vision-derived
coordinates — those proved unreliable (an eyeball guess missed the real
icon center by ~100px; the prior POC tapped the wrong row). See ADR-024.
Architecture:
- Control via the pure-Rust adb_client crate — no adb binary required;
connects through the adb server or directly to a device's adbd over TCP.
- Gated behind an `android` Cargo feature, off by default, so the default
build never pulls adb_client's rustls/rsa/image dependency tree.
- Provider-agnostic: one control path serves a managed emulator and a BYO
device; only provisioning differs.
Added:
- crates/xpressclaw-core/src/android: AndroidDevice (via_server/via_tcp),
screenshot, ui_dump, find_element, tap, tap_text, with a regex-free
uiautomator parser and unit tests.
- error: Android variant.
- xpressclaw android {screenshot,tap,tap-text,dump,shell}, feature-gated.
- docs/adr/ADR-024-android-device-control.md.
Verified by core --features android parser tests, and live against an
emulator through the built binary: `xpressclaw android tap-text Photos`
resolved (663,1549) and opened Photos; a default build excludes the
subcommand.
Builds on the adb_client control work: surfaces Android in the Connectors grid and adds an SDK preflight, both behind the `android` feature. Connector (device-link — a deliberate UX bend, see ADR-024): an AndroidConnector in the Connectors grid whose config is the adb target (serial/tcp). validate_config and health probe device reachability via adb_client — the analog of Telegram's getMe. It is not an event source/sink and rejects send; tap/screenshot stay on the MCP/agent path. Registered in the connector registry, feature-gated. Doctor: `xpressclaw android doctor` reports the managed-emulator SDK preflight (SDK root, emulator, cmdline/platform-tools, system images, AVDs, hardware accel) via android::sdk::detect(). Mirrors the spirit of setup.rs's check_docker/check_ollama; a setup-route version is the planned follow-up. Frontend: Android tile in the connectors grid using the official bugdroid (Font Awesome), rendered filled + monochrome at 40px, bottom-aligned in a uniform icon row; other tiles unchanged (outline strokes). Config form takes device serial or direct tcp. Verified: cargo build --features android (core + cli + server); frontend npm run build; android doctor reports the live SDK correctly.
Surfaces the managed-emulator SDK check the canonical way, alongside
check_docker / check_ollama in routes/setup.rs, instead of CLI-only.
GET /api/setup/check-android-sdk returns { feature_enabled, ready, sdk }
from android::sdk::detect() when built with the `android` feature, or
{ feature_enabled: false } otherwise — so the UI gets a clean answer, not a
404. Shares the detect() core fn with the CLI `android doctor`.
Plumbs the `android` feature across crates: xpressclaw-server gains it
(enabling xpressclaw-core/android), and the CLI's android feature now enables
the server's too.
Verified: cargo check -p xpressclaw-cli with and without --features android.
Sets android::sdk::DEFAULT_SYSTEM_IMAGE to google_apis_playstore so user-facing managed emulators get the Play Store + Google sign-in. Trades away `adb root` (production `user` build), which the control path doesn't need — tap/screenshot/uiautomator work without it. Single source of truth, consumed by the `doctor` hints (and future provisioning). ADR-024 updated.
Adds the shared host-side control surface used by BOTH the agent and a human:
the same /v1/android/* endpoints back an agent tool call and a human's click,
driving one device. See ADR-024.
- server: /v1/android/{status,screenshot,dump,tap,tap-text,swipe,input-text,key}
(feature-gated), calling AndroidDevice over adb_client off-thread; device
resolved from the configured android connector, default emulator-5554.
- core: AndroidDevice gains swipe / input_text / key_event.
- frontend: an /android collaborative live-view page — polls the screen and
forwards clicks/keys to the same endpoints, so a human can step in while the
agent works. Sidebar entry added.
Verified: cargo build -p xpressclaw-server --features android (and default);
frontend npm run build.
Completes the agent half of Android control. A standalone Python MCP server (harnesses/base/mcp_android.py) exposes android_screenshot / tap_text / tap / swipe / type / key / dump as MCP tools and proxies them to the server's /v1/android/* endpoints — no adb in the container (that was the scrcpy-mcp trap). Screenshot returns MCP image content so the agent sees the screen; tap_text is steered as the preferred targeting tool (accessibility tree, not pixel guesses). Wired as a feature-gated default MCP server: default_mcp_servers() adds the `android` stdio server only when built with the `android` feature, so an android-featured runtime hands agents the tools (a default build does not). Baked into the base harness image (Dockerfile COPY). Agent and human now drive the same device through the same /v1/android/* endpoints. Verified: python -m py_compile (3.11) on the shim; cargo check -p xpressclaw-core --features android.
The modal in ProfileTab.svelte sent `model` at the request top level alongside an `llm` block that omitted model. The PATCH handler in routes/agents.rs ran two branches in sequence on the same request: a legacy migration branch wrote top-level model into llm.model, then a full-replacement branch set agent.llm = req.llm — clobbering the model the previous branch had just written. The response also returned has_api_key: bool instead of the value, so after each PATCH the modal's local llmApiKey reset to '' and the next Apply sent api_key: null, wiping the stored key on disk. Align the modal with the post-refactor data model (0b83c91): model lives inside AgentLlmConfig, so send it inside the llm block as one unit. Drop the now-dead top-level `model` field from UpdateAgentConfigRequest and from the frontend's PATCH type. Save Changes stops touching model — the modal's Apply path owns it. PATCH response returns api_key (matching GET /api/setup/config) so the modal's local state stays accurate across saves. Legacy YAMLs with top-level agent.model still migrate into llm.model via Config::migrate_legacy_fields() on load — that path is untouched. New test_update_config_llm_block_round_trips_model_and_key locks in the contract (10/10 agent route tests passing).
The Profile → Change modal had no way to verify credentials or discover
available models — users typed model names blind and only learned a key
or base_url was wrong by sending a chat message and watching it fail.
Lift the same flow the first-time setup wizard already uses into the
modal: a Validate button next to the API Key field (openai/anthropic
only, matching setup), a status line for the result, and a model select
populated from the upstream's /v1/models response on success. The
existing /api/setup/validate-key endpoint already returns { valid,
error?, models: [{id}] }, so no backend changes — just wire the modal
to it.
If the agent already had a model that isn't in the fetched list (e.g.
relay-specific tags), the stored value is preserved as a "(custom)"
option at the top of the dropdown so it's not silently dropped. Below
the validate-success threshold, the field stays a free-text input — the
old behavior — so ollama and unvalidated openai-compatible endpoints
still work.
Validation state (button status, model list) resets when the modal
opens and when the provider changes, so users don't see stale
checkmarks from a prior session.
…id-device-control
The Test button hard-coded `"android" => true` (a config shape check) and set status "connected" regardless of whether the device answered — a guaranteed false positive (it reported connected with the emulator powered off). Now it runs a real reachability probe via adb_client (echo, off-thread) and sets connected/error from the actual result, with a real error message. Status is still point-in-time (set on Test or at startup), not a live poll; a background refresh is a separate follow-up.
Fixes the agent crash where a full-res screenshot (~2.4MB base64) overflowed the Claude Agent SDK's ~1MB CLI stdout buffer and reset the session, and makes the accessibility tree the agent's primary way to perceive the screen. - core: ScreenElement + AndroidDevice::screen_elements() — compact JSON of interactable/labeled nodes with real device-pixel coordinates (a few KB), so the agent picks tap targets by element instead of eyeballing pixels off an image (which reintroduces the scaling bug). - core: AndroidDevice::screenshot_scaled() — downscale to 1568px longest side (the resolution vision APIs downscale to anyway, so no model-visible loss) and JPEG-encode, ~200-400KB. Adds the `image` crate (already transitive via adb_client) under the android feature. - server: GET /v1/android/elements; /v1/android/screenshot now returns scaled JPEG, tunable via ?max= and ?q=. - shim: android_screen_map tool, steered as the primary perception path; screenshot is framed as a visual aid (not for coordinates) and uses the server's content-type. - harness: max_buffer_size=10MB on ClaudeAgentOptions as belt-and-suspenders so a large tool result can't crash and reset the session. Verified: core --features android parser tests; server builds with and without the feature; agent drove the emulator from the screen map in chat without the buffer crash.
Adds the Android analog of DockerManager's "installed? / running? / if not,
spawn it", surfaced the same way check_docker / start_docker are.
- core: android::emulator — is_running (a device up & booted, via adb_client),
emulator_binary (locate the SDK binary), start (launch an AVD detached, the
analog of start_docker_desktop).
- server: /api/setup/check-android-sdk now also reports {available, installed,
can_start} like check_docker; new POST /api/setup/start-android spawns an AVD
(defaults to the first available), mirroring start_docker.
- frontend: the /android page gates on device availability — when none is up it
shows a "Start emulator" prompt (and polls until booted), or an SDK-not-ready
hint, instead of a dead live view. Same shape as the Docker start modal.
Feature-gated behind `android`; default builds report feature_enabled:false.
Verified: cargo build -p xpressclaw-server --features android and default;
frontend npm run build.
Drops bespoke bits that diverged from how the codebase already handles
external dependencies, in favor of the established patterns.
- check_android_sdk: remove the invented `feature_enabled` field and the
redundant `ready` alias; return {available, installed, can_start, sdk} —
the same shape as check_docker. (`sdk` stays: the /android page needs its
`avds` to know which AVD to boot; Docker has no equivalent sub-resource.)
Both dropped fields were unused.
- test_connector: remove the android_reachable helper and the special-cased
android early-return. Android now uses the uniform `"android" => true`
shape-check arm like every other connector type; real device reachability
already lives in AndroidConnector::validate_config (run at registry start),
so the route-level probe was duplicate logic that also broke the uniform
structure.
Verified: cargo build -p xpressclaw-server --features android and default.
Add two control primitives across the full stack (core AndroidDevice, /v1/android/* endpoints, MCP shim, CLI), mirroring the existing tap/key plumbing. open_app launches by package via the launcher intent; long_press is a zero-distance swipe.
Accessibility-first agent role: read the screen map first, prefer open_app > tap_text > tap, never guess pixels off a screenshot. Registered as a built-in preset with a smartphone icon in the setup wizard.
Flip Status to Accepted, fold in the vision-spike evidence, align to the house ADR style, and correct wording that implied we built accessibility from scratch.
uiautomator XML-encodes text/content-desc (& -> &, etc.), so 'tap-text "Network & internet"' never matched and the screen map emitted raw entities. Added xml_decode applied in attr(), and rewrote find_node_bounds to compare the decoded value instead of raw-substring-matching the XML.
The CLI exposed only a subset of the control/perception primitives. Add swipe, type, and key (already in core/server/MCP) plus screen-map (compact JSON, mirrors /elements), so CLI/server/MCP now cover the same surface.
The Tauri app runs the CLI as a sidecar, so the desktop app's Android capability comes from which CLI it bundles. Add an --android flag (mirroring the existing --skip-* pattern) that builds the sidecar CLI --features android, so the installer ships the /v1/android/* endpoints. No Tauri-crate feature needed.
Two bugs in the collaborative live view. (1) The frame poll ran on a fixed 700ms interval, but each screenshot takes ~1.1s — so <img src> was swapped mid-load every tick, cancelling the in-flight load, and the image never updated (looked frozen until re-navigate). Replaced with a load-gated loop: fetch the next frame only after the current finishes (img onload/onerror) plus a short gap; it adapts to latency, never overlaps, and idles when the window is hidden. (2) handleClick mapped clicks against the downscaled JPEG's naturalWidth (~706) instead of device pixels (1080), so taps landed ~1.5x off toward the top-left. Expose the device resolution via /v1/android/status (new AndroidDevice::screen_size, from wm size) and scale clicks to it.
Adds AndroidDevice::screen_size + parse_wm_size (prefers Override over Physical), /v1/android/status now returns {reachable,width,height}, and FRAME_GAP_MS=400 (~1.5s/frame).
Move the Android live view out of the workflows tab into a persistent right rail beside the chat. A thin rail on the right edge shows an Android icon — only when the feature is compiled in (detected by probing /v1/android/status; 404 = absent). Clicking it spawns a ~320px live-view panel next to the chat; click again to collapse. Open/closed persists in localStorage. The view is extracted into lib/AndroidLiveView.svelte: the device is drawn in a bezel frame that hugs the screen (panel background around it, no black bars), with proper SVG icons for back/home/recents. Removed the /android route and its workflows-tab link. Rail 48px, panel 320px; detectAndroid retries only until a definitive 200/404.
Drag on the preview to swipe the device. The image's onclick becomes a pointerdown/pointerup pair: a short press is still a tap, but a drag past a small threshold sends /v1/android/swipe (start→end in device pixels, duration = the actual drag time, clamped 50–800ms). Pointer capture keeps the gesture alive if it ends outside the image; draggable=false + preventDefault + touch-none stop the browser from ghost-dragging the image instead of swiping. Backend /v1/android/swipe already existed; this is purely the frontend gesture.
Closes three injection paths and a broken feature gate found reviewing the android device-control branch. - emulator::start validates the AVD name against [A-Za-z0-9._-] before it reaches `cmd /c start`; cmd.exe re-parses the command line with its own quoting, so an unvalidated name could run arbitrary commands on the host. - input_text single-quotes its argument (new sh_quote helper) so quotes, `;`, `$`, and backticks in typed text are literal input, not device-shell metacharacters. Spaces still map to %s inside the quotes. - open_app validates the package name against [A-Za-z0-9._], closing device shell injection and the spoofed launch-failure check. - the right-rail feature probe now requires an application/json content-type, not just r.ok: on builds without the android feature the request falls through to the SPA fallback (200 + index.html) and the rail wrongly showed for everyone.
Second batch from the branch review — the two halves of the feature no longer disagree, and failures stop being swallowed. - test_connector now runs the android connector's real validate_config (a live adb reachability probe) via a new registry::validate_connector_config helper, instead of returning unconditional "connected". An offline device or wrong serial reports failure. - check_android_sdk probes the SAME device the control plane drives (resolve_target, now shared pub(crate) from routes::android) rather than a hardcoded emulator-5554, and only offers can_start for the managed emulator. A BYO tcp device that's merely offline no longer triggers a pointless emulator boot the control plane never talks to. Drops the duplicated serial literal in favor of emulator::DEFAULT_SERIAL. - emulator::start spawns the binary directly (no `cmd /c start` shell layer, which also removes the injection surface) so launch failures are real spawn errors, and redirects the emulator's stdout/stderr to a temp log file instead of /dev/null so bad-AVD / no-acceleration diagnostics are recoverable. Detaches via CREATE_NO_WINDOW on Windows (Tauri sidecar pattern). - the live view surfaces HTTP errors: post() reports a 4xx/5xx from tap/swipe/key/input-text instead of leaving lastAction claiming success, and the emulator-start flow shows start failures and boot-timeout instead of silently reverting to "no device".
Last two correctness findings from the branch review. - toDevice clamps taps/swipes to [0, deviceW/H-1]. With setPointerCapture a drag can end past the letterboxed frame edge, which previously posted negative or beyond-screen device coordinates that `input tap`/`swipe` reject or misplace. - screenshot_scaled only shrinks now. image::resize fits the bounds in both directions, so a frame already smaller than max_dim (e.g. a 720x1280 AVD) was being upscaled — a bigger, blurrier payload every frame, the opposite of the function's purpose. Guard: resize only when the longest side exceeds max_dim.
Adds a second mode for the Android live view alongside the in-app right rail: a "pop out" control that opens it in a separate window — a native OS window in the desktop app, a browser popup on the web. - AndroidLiveView gains `detachable` + `ondetach` props and renders a pop-out button in its header when detachable. The component is otherwise unchanged and fully self-contained (it only talks to /v1/android/*), so it drops straight into a standalone route with no new state wiring. - New /android route renders the view full-window. The layout treats /android (like /setup) as chromeless — no sidebar, rail, or modals — so a detached window shows only the device. - detachAndroid opens the window: a Tauri WebviewWindow in the desktop app (reusing an existing one by label, else creating it), window.open on the web. Detaching collapses the in-app panel (the view moves out, it isn't cloned). - Grants the three Tauri permissions runtime window creation needs (core:webview:allow-create-webview-window, core:window:allow-create, core:window:allow-set-focus) and adds @tauri-apps/api for the WebviewWindow API.
The detach feature (54ec328) added @tauri-apps/api with a ^2 range, which resolved to 2.11.1 while the Rust `tauri` crate is 2.10.3. The Tauri CLI refuses to bundle when the npm package and crate differ on major/minor, so the installer build failed. Pin to ~2.10.0 (resolves 2.10.1) so it tracks the crate's minor.
… client) The five minor findings from the branch review that were below the top 10. - Live view: route post()'s follow-up refresh through frameTimer so it replaces rather than races the self-driving frame loop. - check_android_sdk: move sdk::detect() (it shells out to the emulator binary) into the existing spawn_blocking so it no longer blocks the async runtime; JoinError now yields a not-ready response. - emulator::start: give the emulator its own process group on unix (process_group(0)) so it survives SIGINT/SIGHUP to the server's terminal — the unix analog of the Windows CREATE_NO_WINDOW detach. - mcp_android.py: reuse a module-level httpx.Client instead of opening and tearing one down per tool call. - ADR-024: list all ten MCP tools the server ships (was six).
The desktop UI is remote content to Tauri (http://localhost:8935), so every WebviewWindow call is an ACL-gated IPC command. Detach died on its first one: getByLabel() invokes plugin:window|get_all_windows, which was never granted. - new remote-webview capability (least-privilege, pinned to localhost:8935/5173): window/webview create + focus + get-all-windows + close + event listen/unlisten, applying to the main and android-live windows; default.json keeps fs/shell/ dialog/clipboard with NO remote grant - reattach: a control in the detached window closes it via Tauri's close IPC (JS window.close() only destroys the WRY_WEBVIEW container HWND, stranding a blank window and a stale label); the main window watches tauri://destroyed (desktop) or polls popup.closed (browser) and reopens the rail panel - scope hide-to-tray in main.rs to the main window; it swallowed the detached window's close, so the label never freed and reattach never fired - phone outline: container-query contain-fit (cqw/cqh) so it tracks BOTH axes on resize; percentage heights through flex items ignored vertical resizes - track gen/schemas/windows-schema.json alongside its platform peers
…he tool descriptions
MFA-X-AI
marked this pull request as draft
July 7, 2026 16:27
The android MCP server is now injected only for agents with "android" in their tools list (off by default). agent_mcp_servers() filters optional default servers by agent.tools; the reconciler recreates a running container when its baked-in MCP toolset drifts from the desired set, same pattern as the image-freshness check. UI: toggle in the agent Tools tab and the setup wizard; the toggle is the tool's only representation — the Tools tab's MCP Servers section filters android out, matching how the wizard hides git/github from its list.
MFA-X-AI
marked this pull request as ready for review
July 15, 2026 04:40
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Android device control as a new
androidmodule - built on pure-Rustadb_client(the ADB protocol) and Android's ownuiautomatoraccessibility tree (which we consume, not reimplement) - wired into the MCP-harness system as a per-agent opt-in tool, plus a collaborative live view in the UI. It replaces the earlierscrcpy-mcpattempt (fahreza/android-support, never merged) rather than extending it. Full rationale:docs/adr/ADR-024-android-device-control.md.Stacked on #109 - this branch also carries the agent-LLM-modal fix and a
mainmerge. Land #109 first (or rebase onto it) so this diff is Android-only before review.Why
xpressclaw agents could do everything except touch a phone. The earlier attempt drove the device by asking the model for pixel coordinates off a screenshot via
scrcpy-mcp- and hit the classic scaling bug: vision LLMs resize the image internally and emit coordinates at the displayed scale, not device resolution, so taps miss. Reproduced independently - the Photos icon eyeballed tox≈560, but the real center (uiautomator) wasx=664, a ~100px miss. That approach also pinned a scrcpy server JAR that mismatches distro adb (server version 1.25 does not match client 4.0) and silently swapped in a 60 MB-heavier Docker image based on an MCP-arg substring.A standalone spike (
android-vision-spike/) measured the vision approach againstuiautomatorground truth: asking models for{x,y}from a screenshot scored ~4/5 on frontier models but 0–1/5 on the in-house models this deployment prioritizes (one is text-only), and downscaling made it worse. Accessibility bounds are exact on any model. So this PR:tap_text/screen_mapreturn real device-pixel centers), sidestepping the scaling bug entirely;open_app) - the spike showed icon-tapping is the unreliable step;What changed
android/):AndroidDeviceoveradb_client(noadbbinary);screen_elements,screenshot_scaled,tap/tap_text/swipe/input_text/key_event, pluslong_pressandopen_app(launch by package);sdk::detect;emulatorlifecycle (is_running/start)./v1/android/*control endpoints;check-android-sdk,start-android, andandroid-target(get/set device target) setup routes.harnesses/base/mcp_android.py) proxying to/v1/android/*(no adb inside the container). Android is a tool any agent can use, not a dedicated agent, and it's per-agent opt-in: the server is injected only for agents withandroidin theirtoolslist (toggle in the agent's Tools tab and the setup wizard, off by default); the reconciler restarts an agent when the toggle flips. The toggle is the tool's only face in the UI — it never appears in the MCP-server lists (matching how the wizard treats git/github). The accessibility-first operating guidance ships in the tool descriptions themselves.android.serial/android.tcp, one source of truth for the server routes, the emulator preflight, the agents' tools, and the CLI's defaults. Editable from the live view's gear panel (/api/setup/android-target).xpressclaw android screenshot | screen-map | tap | tap-text | long-press | open-app | swipe | type | key | dump | shell | doctor.Design decisions
/v1/android/*on featureless builds, required matching harness/server builds, and the non-Windows build scripts never gained it. The/androidpage andxpressclaw android doctorown the "SDK not found" expectation./v1/android/*endpoints; the live view is just a second client.AndroidDevice↔DockerManager;sdk::detect↔system::detect; emulator lifecycle ↔ Docker check/start;/v1/android/*↔browser.rs; MCP shim ↔ the existing stdio proxy servers;android-targetpersistence ↔ themcp-serverssettings routes. New controls (open_app/long_press) mirror the existingtap/keyplumbing one-for-one across core, server, shim, and CLI.Security - desktop "detach" and remote IPC (reviewed)
The live view can pop out into its own window: a native
WebviewWindowin the desktop app, awindow.openpopup on the web. The desktop app loads its UI overhttp://localhost:8935(the embedded server), which Tauri treats as remote content - and Tauri v2 does not grant remote content IPC access by default, so theWebviewWindowAPI needs an explicit grant.That grant is deliberately minimal (least-privilege), split across two capability files:
default.json: fs / shell-spawn / dialog / clipboard. Noremotegrant, so these are not reachable from the http-served frontend (unchanged from before this work).remote-webview.json: applies to themainandandroid-livewindows and grants onlywebview:create-webview-window/window:create/window:set-focus/window:get-all-windows/window:close/event:listen/event:unlisten, and only to pinned portshttp://localhost:8935and:5173(no wildcard).get-all-windowsis required becauseWebviewWindow.getByLabel()callsplugin:window|get_all_windowsbefore anything else, without it the detach flow's first IPC call is denied and the feature silently no-ops.event:listen/unlistenlet the main window watchtauri://destroyedon the detached window so closing it reattaches the rail panel.window:closelets the detached window close itself via Tauri's close IPC - JSwindow.close()is NOT usable there: wry's handler destroys only the WRY_WEBVIEW container HWND, stranding a live blank window and a stale label that blocks future detaches.Worst case from an XSS with these grants: open/close/focus windows and reach the four existing app commands (
get_health/get_server_port/get_status/open_browser- all read-only or hardcoded-local-URL). Still no fs/shell/dialog/clipboard. Two tighter options were considered and rejected: a Rust command with a hardcoded URL (removes a negligible residual, adds code) and bundling the frontend astauri://local assets (eliminates remote IPC entirely, but breaks the relative-URL API model - a larger, separate change).How to test
cargo build --release -p xpressclaw-cli(or.\build.ps1for the NSIS installer). No flags — android is part of every build.bash launch-emulator.shto boot the AVD, or plug in a phone with USB debugging (confirm withadb devices).xpressclaw android doctor→ SDK preflight (emulator / images / AVDs / accel).xpressclaw android open-app com.android.settings→ Settings launches (by package, no icon-tapping).xpressclaw android tap-text "Network & internet"→ resolves via the accessibility tree and taps.xpressclaw android long-press 540 1000→ touch-and-hold (context menus).xpressclaw android screenshot shot.png/dump→ PNG of the screen / rawuiautomatorXML.curl localhost:8935/v1/android/status→{"reachable":true}.curl localhost:8935/v1/android/elements→ screen-map JSON.curl -X POST localhost:8935/v1/android/open-app -d '{"package":"com.android.settings"}'.xpressclaw.yamlunderandroid:and drive the CLI/agents too.Known issues
FLAG_SECURE, and Android blanks secure surfaces on every user-space capture path (adb framebuffer, screencap, screenrecord) by design. For the managed emulator a capture below Android (emulator console / gRPCgetScreenshot) bypasses it and is the planned fallback; real devices can't be bypassed — the phone's own screen is the login surface (and logins persist via AVD snapshot, so on emulators this bites first login only). Details:android-liveview-TODO.md./v1/android/screenshot— measured at ~23% of a core for xpressclaw plus sustained adb/emulator CPU while "idle". The loop gates ondocument.hidden, which doesn't flip on Tauri's hide-to-tray and is also false for an occluded (not minimized) detached window. The gear panel's slower refresh rates reduce the cost but don't remove it; the real fix is pausing on Tauri window hide/blur (android-liveview-TODO.md).Not in this PR (deferred)
/v1/android/devices(adb enumerate) endpoint is a follow-up.