diff --git a/android/CUPRATE_DAEMON.md b/android/CUPRATE_DAEMON.md index e3b422b..8689f2a 100644 --- a/android/CUPRATE_DAEMON.md +++ b/android/CUPRATE_DAEMON.md @@ -159,12 +159,12 @@ above is the other half of the proof — request and artifact, separately checka `contentDescription` carries (`walletChildStatusDescription`), so the spoken row is never shorter than the visible one. Cross-compiled and unit-tested on the JVM; still not device-proven. -* **What writes that snapshot on Android.** The wallet screen's 2 s loop - (`WireViewModel.refreshWalletChild`) calls `Wire.walletStatus()` — the cached - UniFFI read, no dial. The live probe `Wire.walletChildRefresh()` - (`Wire::wallet_child_refresh` in `crates/onionwire-sdk`) exists and is what - makes height/target move between calls; the TUI uses it. The APK poller on - this tree does not. See [README.md](README.md#what-the-apk-refresh-loop-actually-calls). +* **What writes that snapshot on Android.** The wallet screen's loop + (`WireViewModel.openWalletChild` → `walletChildRefreshLoop`) does one cached + `Wire.walletStatus()` paint, then every 2 s a live + `Wire.walletChildRefresh()` (`Wire::wallet_child_refresh`). The live call is + what makes height/target move between ticks; it never spawns. See + [README.md](README.md#what-the-apk-refresh-loop-actually-calls). * **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 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 `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 -is the thing to watch, not the balance. On this tree the APK loop will not itself -refresh height from the daemon; a live probe is a separate SDK call the TUI -makes and the Android poller does not. +is the thing to watch, not the balance. After the first cached paint, the APK +loop probes live every 2 s, so `sync h/t` should move once the daemon answers. diff --git a/android/README.md b/android/README.md index 6d58f6a..c96aaa4 100644 --- a/android/README.md +++ b/android/README.md @@ -251,17 +251,26 @@ in-process daemon, the chain probe fails, and the state stays `syncing`. ### What the APK refresh loop actually calls -`WireViewModel.openWalletChild()` polls every 2 s -(`WALLET_CHILD_TICK_MS = 2_000`). Each tick is `Wire.walletStatus()` — the -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). +`WireViewModel.openWalletChild()` runs `walletChildRefreshLoop` with a 2 s +tick (`WALLET_CHILD_TICK_MS = 2_000`): -The SDK also exposes `Wire.walletChildRefresh()` (`Wire::wallet_child_refresh`): -a live probe of the loopback wallet RPC, and of the local daemon's `get_info` -when that RPC does not answer. The TUI uses it. **This APK's poller does not.** -Do not read the moving `sync h/t` docs in [docs/WALLET.md](../docs/WALLET.md) -as a description of the Android loop on this tree. +1. **First paint** — `paintWalletChildCached()` → `Wire.walletStatus()` + (`Wire::wallet_status`). Cached, no dial, so the screen has a record + while the first probe is still in flight. +2. **Every tick after that** — `refreshWalletChild()` → + `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 @@ -373,7 +382,7 @@ android/ RotateScreen.kt Insets.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/main/jniLibs/arm64-v8a/libmonerowalletrpc.so ```