docs(android): the APK poller now calls wallet_child_refresh #136

Merged
sirius merged 1 commit from onionwire/t_4afe292a-android-docs-live-poller into main 2026-09-20 12:47:24 +00:00
2 changed files with 29 additions and 21 deletions

View file

@ -159,12 +159,12 @@ above is the other half of the proof — request and artifact, separately checka
`contentDescription` carries (`walletChildStatusDescription`), so the spoken row `contentDescription` carries (`walletChildStatusDescription`), so the spoken row
is never shorter than the visible one. Cross-compiled and unit-tested on the is never shorter than the visible one. Cross-compiled and unit-tested on the
JVM; still not device-proven. JVM; still not device-proven.
* **What writes that snapshot on Android.** The wallet screen's 2 s loop * **What writes that snapshot on Android.** The wallet screen's loop
(`WireViewModel.refreshWalletChild`) calls `Wire.walletStatus()` — the cached (`WireViewModel.openWalletChild` → `walletChildRefreshLoop`) does one cached
UniFFI read, no dial. The live probe `Wire.walletChildRefresh()` `Wire.walletStatus()` paint, then every 2 s a live
(`Wire::wallet_child_refresh` in `crates/onionwire-sdk`) exists and is what `Wire.walletChildRefresh()` (`Wire::wallet_child_refresh`). The live call is
makes height/target move between calls; the TUI uses it. The APK poller on what makes height/target move between ticks; it never spawns. See
this tree does not. See [README.md](README.md#what-the-apk-refresh-loop-actually-calls). [README.md](README.md#what-the-apk-refresh-loop-actually-calls).
* **Storage honesty.** The card shows the free space on the filesystem the fjall * **Storage honesty.** The card shows the free space on the filesystem the fjall
store grows into (`StatFs` on the app's data dir) and refuses Start below a store grows into (`StatFs` on the app's data dir) and refuses Start below a
floor, or when that filesystem cannot be read at all. The floor is a *floor*, floor, or when that filesystem cannot be read at all. The floor is a *floor*,
@ -256,6 +256,5 @@ then unlock the node, open Wallet, tap **On-device node (Cuprate)**, read the
warning, press **Start wallet**, and watch the status line for warning, press **Start wallet**, and watch the status line for
`connecting → syncing · in-process node · node starting → node syncing`. A wallet `connecting → syncing · in-process node · node starting → node syncing`. A wallet
balance needs the chain synced, which on a phone is a long wait — the status line balance needs the chain synced, which on a phone is a long wait — the status line
is the thing to watch, not the balance. On this tree the APK loop will not itself is the thing to watch, not the balance. After the first cached paint, the APK
refresh height from the daemon; a live probe is a separate SDK call the TUI loop probes live every 2 s, so `sync h/t` should move once the daemon answers.
makes and the Android poller does not.

View file

@ -251,17 +251,26 @@ in-process daemon, the chain probe fails, and the state stays `syncing`.
### What the APK refresh loop actually calls ### What the APK refresh loop actually calls
`WireViewModel.openWalletChild()` polls every 2 s `WireViewModel.openWalletChild()` runs `walletChildRefreshLoop` with a 2 s
(`WALLET_CHILD_TICK_MS = 2_000`). Each tick is `Wire.walletStatus()` — the tick (`WALLET_CHILD_TICK_MS = 2_000`):
cached, non-dialing UniFFI read (`Wire::wallet_status`). It never spawns and
it never probes the daemon, so `sync h/t` only moves when something else
wrote a fresh snapshot (start, a previous live probe).
The SDK also exposes `Wire.walletChildRefresh()` (`Wire::wallet_child_refresh`): 1. **First paint** — `paintWalletChildCached()` → `Wire.walletStatus()`
a live probe of the loopback wallet RPC, and of the local daemon's `get_info` (`Wire::wallet_status`). Cached, no dial, so the screen has a record
when that RPC does not answer. The TUI uses it. **This APK's poller does not.** while the first probe is still in flight.
Do not read the moving `sync h/t` docs in [docs/WALLET.md](../docs/WALLET.md) 2. **Every tick after that** — `refreshWalletChild()` →
as a description of the Android loop on this tree. `Wire.walletChildRefresh()` (`Wire::wallet_child_refresh`). That dials
the child's loopback wallet RPC, and the configured local daemon's
`get_info` when the wallet RPC does not answer, which is what makes
`sync h/t` move without another Start. It never spawns a child. With no
live child the core short-circuits to the cached `off` / `exited`
snapshot, so this cannot invent `ready`.
The loop suspends on each read before it sleeps: a probe slower than 2 s
delays the next tick instead of overlapping it. Do not run two concurrent
`wallet_child_refresh` calls against one child.
See [docs/WALLET.md](../docs/WALLET.md) (Android / SDK) for the same two
methods as the UniFFI surface.
## CI and releases ## CI and releases
@ -373,7 +382,7 @@ android/
RotateScreen.kt RotateScreen.kt
Insets.kt Insets.kt
Theme.kt Theme.kt
src/test/ # JVM: envelope, store, invite, outbox, keepalive, wallet line src/test/ # JVM: envelope, store, invite, outbox, keepalive, wallet line, refresh loop
src/androidTest/ # device-only: AndroidKeyStore src/androidTest/ # device-only: AndroidKeyStore
src/main/jniLibs/arm64-v8a/libmonerowalletrpc.so src/main/jniLibs/arm64-v8a/libmonerowalletrpc.so
``` ```