Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
agent
da70f9b32d
docs(android): describe the live wallet-child poller (#134)
main merged the APK loop that paints with wallet_status then probes with
wallet_child_refresh. Rebase onto that and write the loop as it ships.
2026-09-20 00:54:57 -04:00
agent
e2c77da6bc
docs(android): rewrite Android docs to match the tree
android/README.md, CUPRATE_DAEMON.md and MONERO_BINARIES.md were the
half PR #133 left out. Releases are two manual dispatches, not a push
to main; the APK version comes from the tag android-release checks out;
the layout now includes wallet/ and keepalive/; the status line's
sync h/t is documented; the APK poller still calls wallet_status, not
wallet_child_refresh.
2026-09-20 00:54:27 -04:00
3 changed files with 316 additions and 78 deletions

View file

@ -5,10 +5,13 @@ OnionWire process** — is compiled into the Android build. This document is the
provenance record for that: how the feature is enabled, why the link line looks
the way it does, what CI checks, and what has *not* been proven.
Companion reading: `docs/WALLET.md` ("The in-process chain daemon") for what the
daemon is, `docs/cuprate-android-spike.md` for the cross-compile spike this
plumbing comes from, and `MONERO_BINARIES.md` for the `monero-wallet-rpc`
executable, which is still a child process — Cuprate has no wallet layer.
Companion reading: [docs/WALLET.md](../docs/WALLET.md) ("The in-process chain
daemon") for what the daemon is, [docs/cuprate-android-spike.md](../docs/cuprate-android-spike.md)
for the cross-compile spike this plumbing comes from,
[MONERO_BINARIES.md](MONERO_BINARIES.md) for the `monero-wallet-rpc` executable
(still a child process — Cuprate has no wallet layer), and
[README.md](README.md#wallet-child-and-chain-sources-as-android-sees-them) for
how the Android wallet screen drives it.
## What changed in the build
@ -34,6 +37,10 @@ the request rather than only the task name:
cargo ndk build for arm64-v8a features=cuprate-daemon api=26 ndk=28.2.13676358
```
There is no `-P` knob that turns the feature off. A build that silently dropped
it would ship an APK whose on-device node can only fail; `android-ci.yml` greps
the artifact (below) so that is not only a log line.
## The link line
RandomX is C++ and its aarch64 JIT calls `__clear_cache`, and `randomx-rs`'s build
@ -88,6 +95,10 @@ else:
the `rust-version = "1.91"` MSRV are untouched, because the feature-off workspace
does not need the bump and moving the MSRV is a separate decision.
`:sdk:preBuild` also runs `verifyDynamicLibc`: `libonionwire_sdk.so` must have
`libc.so` in `DT_NEEDED`. Linking the NDK's static `libc.a` instead null-derefs
inside `dlopen` on the first SDK call.
## What ends up in the APK
```
@ -103,8 +114,9 @@ lib/arm64-v8a/librandomx_rs-<hash>.so <- new, see below
RandomX code is statically inside the SDK's own `.so` (its symbols and strings are
there). `cargo-ndk` copies every cdylib the target directory produced into
`jniLibs`, and `randomx-rs` also builds one. It is left in place rather than
filtered out: it is 1,122,296 bytes uncompressed / 387,996 deflated, and dropping
it would be a packaging rule that silently breaks the day something *does* link it.
filtered out: it is 1,122,296 bytes uncompressed / 387,996 deflated (sizes from
the feature-on CI run in the table below), and dropping it would be a packaging
rule that silently breaks the day something *does* link it.
## The CI gate
@ -125,11 +137,12 @@ above is the other half of the proof — request and artifact, separately checka
* Selecting **On-device node (Cuprate)** stores `ChainChoice.InProcessCuprate` with
an **empty** `monerod_datadir`, which the SDK resolves to
`$ONIONWIRE_HOME/chain` — the same directory a spawned `monerod` would use. Kotlin
never invents an absolute path.
`$ONIONWIRE_HOME/chain/{testnet,mainnet-pruned,mainnet-full}` from the stored
`mainnet` / `prune` flags — Kotlin never invents an absolute path.
* `monero-wallet-rpc` is still required and still a subprocess: Start is gated on
the bundled binary exactly as before, and an in-process node does not bundle
`arti`, so a `.onion` daemon is still refused.
`arti`, so a `.onion` daemon is still refused. Wallet RPC is loopback only.
Chain traffic stays off until the user opted into a wallet and chose a source.
* The status line renders the core's words verbatim and grows a `node <word>`
segment from `WalletChildStatus.node_state` for this source only. An unrecognised
word is never rendered as ready.
@ -141,19 +154,29 @@ above is the other half of the proof — request and artifact, separately checka
`node` segment) whenever either is non-zero: `0/0` means the last probe failed
or the daemon is not up, so it is *unknown*, not `0%` — there is no percent, no
progress bar and no ETA anywhere in the UI, and a zero target still prints as
`/0`. This is the **daemon's** chain height, not the wallet's scan height. The
same string is what the status row's screen-reader `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.
`/0` when height is non-zero. This is the **daemon's** chain height, not the
wallet's scan height. The same string is what the status row's screen-reader
`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 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
3 GiB floor, or when that filesystem cannot be read at all. The floor is a
*floor*, not a sync estimate, and the doc comment says why: nothing in this stack
floor, or when that filesystem cannot be read at all. The floor is a *floor*,
not a sync estimate, and the doc comment says why: nothing in this stack
exposes one — `WalletChildStatus` has no size field, and Cuprate's restricted RPC
reports a hardcoded 5 GiB `database_size` placeholder.
reports a hardcoded 5 GiB `database_size` placeholder. Floors in
`ui/WalletChildStatusText.kt`: 3 GiB testnet, 64 GiB mainnet-pruned, 280 GiB
mainnet-full.
* **Pre-production warning**, above the Start button, in a sentence:
`CUPRATE_PREPRODUCTION_WARNING` — quoted user book, testnet-only, and Cuprate
issue #278, assertable in `WalletChildStatusTextTest`. Opt-in, never a default.
`CUPRATE_PREPRODUCTION_WARNING` — quoted user book, testnet-only / mainnet
unvalidated, and Cuprate issue #278, assertable in `WalletChildStatusTextTest`.
Opt-in, never a default.
## What it costs in CI
@ -164,6 +187,9 @@ the feature on. There are two feature-on regimes, and the second is the one a PR
author feels — the first build after the feature lands compiles the whole cuprated
graph, every later build is incremental against the same volume.
These figures are the **recorded** costs from the runs that landed the feature
(not re-measured on `fa0e4b2`):
| | feature off — `main` 773dacb, run 402 | feature on — PR #113 head 3860c3d (merged as 8626da2), run 412 |
|---|---|---|
| Gradle | `BUILD SUCCESSFUL in 6m 10s` | `BUILD SUCCESSFUL in 7m 14s` |
@ -182,29 +208,42 @@ cargo job on the runner. After that it settles to roughly **+2 minutes over the
feature-off build** (7m 14s vs 6m 10s), because only this repo's own crates
recompile.
Nothing needed mitigating: the job's `timeout-minutes` is 120, so even the 44-minute
first build fits with room to spare, and the volume grows to 5.6 G on a runner
filesystem with 37 G free (the `df -h` in the run log). The feature is **not** gated
on a build variant, a label or a manual dispatch — the release path builds exactly
what CI verifies.
`android-ci.yml`'s job `timeout-minutes` is **120**; `android-release.yml`'s
Android job is **90**. Even the 44-minute first build fits both with room to
spare, and the volume grew to 5.6 G on a runner filesystem with 37 G free (the
`df -h` in the run log). The feature is **not** gated on a build variant, a label
or a manual dispatch — the release path builds exactly what CI verifies.
`android-ci.yml` prints `du -sh /cargo-target`, the length/method/deflated size of
every native lib, and both artifact digests, and the workflow echoes
`build_wall_clock_seconds`: the next person changing this graph reads the cost and
the artifact's identity out of the run log rather than re-deriving either.
## Not verified
## What has not been proven
The daemon was **not executed on a device or an emulator**. There is no
`arm64-v8a` AVD on the build host (the same gap `MONERO_BINARIES.md` records), and
no aarch64 Android sysroot to run it under `qemu-user`. What is proven: it
cross-compiles and links against the NDK's C++ runtime, the feature is in the
shipped `.so`, the artifact packages, and the Kotlin that drives it compiles and
passes its unit tests. What is not: that `cuprated` starts, opens its fjall store
and answers on loopback under Android's runtime — and, on top of that, Cuprate
itself is pre-production and testnet-only.
`arm64-v8a` AVD on the build host (the same gap [MONERO_BINARIES.md](MONERO_BINARIES.md)
records), and no aarch64 Android sysroot to run it under `qemu-user`. What is
proven: it cross-compiles and links against the NDK's C++ runtime, the feature is
in the shipped `.so`, the artifact packages, and the Kotlin that drives it
compiles and passes its unit tests. What is not:
To close the gap, on an arm64 device or a software-emulated arm64 AVD:
* that `cuprated` starts, opens its fjall store and answers on loopback under
Android's runtime;
* **mainnet remains unvalidated.** Cuprate itself is pre-production and its own
user book says not to use `cuprated` for serious purposes. The Android screen
can store a mainnet-pruned or mainnet-full mode; that is not a claim this build
has run either. Core still surfaces `testnet only — mainnet is unvalidated`
(`cuprate::TESTNET_ONLY`);
* **a daemon that dies after the wallet child came up cannot be reported
`exited`.** The in-process node is a value this app owns, not a process with a
pid. The SDK derives `node_state` from the wallet-child state
(`crates/onionwire-sdk/src/lib.rs`, `node_state`). If the daemon dies after its
wallet child is up, the chain probe fails and the state stays `syncing`. It is
never reported `ready` from that failure. `exited` still means what it says:
the `monero-wallet-rpc` child is gone.
To close the device gap, on an arm64 device or a software-emulated arm64 AVD:
```bash
sdkmanager "system-images;android-35;google_apis;arm64-v8a"
@ -217,4 +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.
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.

View file

@ -1,22 +1,28 @@
# Bundled native executables (`jniLibs`)
The wallet screen starts an **app-owned `monero-wallet-rpc` child** (issue #107,
`src/wallet_child.rs`). Monero ships no Android binaries, so this repository
carries one, built here.
[`src/wallet_child.rs`](../src/wallet_child.rs)). Monero ships no Android
binaries, so this repository carries one, built here.
| | |
|---|---|
| File in the tree | `android/app/src/main/jniLibs/arm64-v8a/libmonerowalletrpc.so` |
| Bytes | 19 954 224 (stripped) |
| sha256 | `d9126788030ecd1ccdb40c7764e66e9a14d158a147ad335b256f0577681b5ad4` |
| Format | `ELF 64-bit LSB shared object, ARM aarch64, dynamically linked, interpreter /system/bin/linker64, for Android 21, built by NDK r17b` |
| Format | `ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, for Android 21, built by NDK r17b (4828580), stripped` |
| Needed libs | `libc.so`, `libm.so`, `libdl.so` — everything else is static |
| Source | `https://github.com/monero-project/monero` |
| Tag | `v0.18.4.4` |
| Commit | `516e5355a103a2bf0b7e10328ebcaa2945019445` |
| Commit | `516e5355a103a2bf0b7e10328ebcaa2945019445` (peeled annotated tag) |
| Reproduce with | `scripts/build-monero-wallet-rpc-android.sh` |
| Verified by | `android/monero-binaries.sha256`, checked by `scripts/build-android-local.sh` on every build (local and CI) |
Re-checked on this tree (`fa0e4b2`): `stat -c %s` is 19954224; `sha256sum` of the
blob equals the hash above and equals the line in `android/monero-binaries.sha256`
(that file's path is relative to `android/`:
`app/src/main/jniLibs/arm64-v8a/libmonerowalletrpc.so`). `readelf -d` NEEDED is
`libdl.so`, `libm.so`, `libc.so`.
Only `arm64-v8a` is built. `-Ponionwire.abis=x86_64` produces an APK with no
wallet binary in it — the screen says so (`NO_WALLET_RPC_MESSAGE`) instead of
offering a Start that cannot work.
@ -28,8 +34,10 @@ cross-compile path — `contrib/depends` (boost, openssl, libunbound, libzmq,
libsodium, ncurses, readline, libiconv, expat for `aarch64-linux-android`) plus
the `toolchain.cmake` it emits — and then builds the single CMake target
`wallet_rpc_server`. It takes ~40 min on 12 cores and needs ~15 GB of scratch
space. It is **not** part of the CI path: CI here runs on a Raspberry Pi and the
Gradle build is already ~9 minutes. CI verifies the committed bytes instead.
space. It is **not** part of the CI path: the Android Gradle jobs already run
on `docker-amd64` for ~9 minutes with warm volumes, and rebuilding Monero's C++
tree is a separate 30–45 min host job. CI verifies the committed bytes instead
(`sha256sum -c` plus the APK-entry check in `scripts/build-android-local.sh`).
Four things about the build are worth writing down, because each one is a
failure that looks like something else:
@ -83,6 +91,11 @@ shipped blob** and the thing CI re-verifies — not a reproducible-build
assertion. If you rebuild, update both `android/monero-binaries.sha256` and this
table in the same commit, and say what changed in the tag or the toolchain.
The reproduce script pins **the tag** (`MONERO_TAG=v0.18.4.4`, shallow clone).
The commit in the table is the peeled object of that annotated tag on GitHub,
recorded here so a rebuild can be compared; it is not a second pin in the
script.
## Why it is a `jniLibs` `.so` and not an asset
Since Android 10 (API 29) an app may not `exec()` a file in its own data
@ -108,6 +121,8 @@ AGP's strip pass cannot rewrite the bytes that CI verifies.
Cost: the release APK grows from ~9 MB to ~28 MB (the binary is deflate-stored
at 6.9 MB) and installs ~20 MB into the app's native library directory.
(Those packaging sizes are the original measurement when the blob landed; the
committed blob's **uncompressed** size is the 19 954 224 bytes above.)
## `arti` is NOT bundled
@ -116,8 +131,7 @@ daemon, and `ChildConfig::validate` requires a non-empty `arti_bin` for any
chain source that is not receive-only. There is no `arti` executable in this
build, and producing one (a standalone `arti` binary for
`aarch64-linux-android`, from a crate the Rust side does not currently build as
a bin) is a follow-up, not something this card could do without editing
`Cargo.toml`/`crates/**`.
a bin) is a follow-up, not something this document can invent.
What the app does about it, honestly:
@ -133,9 +147,9 @@ So today: **loopback and clearnet daemons work; `.onion` daemons do not.**
## Verification in CI
`.forgejo/workflows/android-ci.yml` builds the APK on every `android/**` PR and
`scripts/build-android-local.sh` does the checking, so both CI jobs and local
builds get it:
`.forgejo/workflows/android-ci.yml` (and `android-release.yml`) build the APK on
`docker-amd64` and `scripts/build-android-local.sh` does the checking, so both
CI jobs and local builds get it:
1. before Gradle, `sha256sum -c android/monero-binaries.sha256` against the
committed blob;
@ -171,8 +185,7 @@ at the arti notice above.
The third chain source — Cuprate's chain daemon running inside the OnionWire
process — is a **linked feature of the SDK's `.so`**, not a `jniLibs` executable,
so it has its own record: `android/CUPRATE_DAEMON.md` (feature wiring, the NDK C++
/ compiler-rt link line, the CI check that greps the shipped `.so` for a
cuprated-only string, and what has not been verified). `monero-wallet-rpc` above
stays a child process for it — Cuprate has no wallet layer.
so it has its own record: [CUPRATE_DAEMON.md](CUPRATE_DAEMON.md) (feature wiring,
the NDK C++ / compiler-rt link line, the CI check that greps the shipped `.so`
for a cuprated-only string, and what has not been verified). `monero-wallet-rpc`
above stays a child process for it — Cuprate has no wallet layer.

View file

@ -11,6 +11,14 @@ The Linux TUI in the repository root is a **separate product** with a separate
Cargo workspace. Nothing here turns it into a WebView, and nothing here imports
its TUI code. Same wire protocol: [docs/PROTOCOL.md](../docs/PROTOCOL.md).
Companion records (not duplicated here):
* in-process chain daemon in the APK — [CUPRATE_DAEMON.md](CUPRATE_DAEMON.md)
* bundled `monero-wallet-rpc` blob — [MONERO_BINARIES.md](MONERO_BINARIES.md)
* wallet / chain-source behaviour (core + SDK) — [docs/WALLET.md](../docs/WALLET.md)
* consuming the AAR — [crates/onionwire-sdk/README.md](../crates/onionwire-sdk/README.md)
* how a maintainer actually cuts a release — [docs/RELEASING.md](../docs/RELEASING.md)
## Requirements
* JDK 17+ (built and tested on JDK 21)
@ -36,7 +44,8 @@ cd android
```
The Rust cross-compile and the UniFFI Kotlin bindings are wired into the Gradle
tasks — there is no manual codegen step. `:sdk:preBuild` depends on them.
tasks — there is no manual codegen step. `:sdk:preBuild` depends on
`cargoBuildAndroid`, `uniffiBindgen`, and `verifyDynamicLibc`.
Emulator / x86_64 slice:
@ -44,13 +53,20 @@ Emulator / x86_64 slice:
./gradlew :app:assembleDebug -Ponionwire.abis=arm64-v8a,x86_64
```
That extra ABI does **not** ship `libmonerowalletrpc.so` for x86_64. The wallet
screen says so (`NO_WALLET_RPC_MESSAGE`) instead of offering a Start that cannot
work. See [MONERO_BINARIES.md](MONERO_BINARIES.md).
Or from the repo root, with checksums and an optional publish step:
```bash
scripts/build-android-local.sh # -> dist/onionwire-<v>-android-arm64-v8a.apk
PUBLISH_TAG=v0.1.0 scripts/build-android-local.sh
PUBLISH_TAG=v0.14.0 scripts/build-android-local.sh
```
The script re-verifies `android/monero-binaries.sha256` before Gradle, then
again against the bytes inside the APK. It does not create tags.
## Decisions you should know about
### `minSdk = 26` (Android 8.0)
@ -79,12 +95,24 @@ readelf -l android/sdk/build/rustJniLibs/arm64-v8a/libonionwire_sdk.so | grep LO
### Permissions
`INTERNET` only, declared at first launch. No camera (invites are pasted, not
scanned), no contacts, no storage permission — the data directory is
`context.filesDir`, which is already app-private. There is **no**
`FOREGROUND_SERVICE` and no keep-alive notification in v1: the node lives only
while the process does, and the UI says so. Adding one is a product decision
(battery, Play's FGS type declarations), not a silent fix.
`INTERNET` is the only permission requested at first launch. No camera (invites
are pasted, not scanned), no contacts, no storage permission — the data
directory is `context.filesDir`, which is already app-private.
The node is **not** process-lifetime-only. After unlock, `KeepAliveService` is
a foreground service (`specialUse`, not `dataSync`) with an ongoing
notification so the onion stays published across Doze and backgrounding. The
manifest therefore also declares:
* `FOREGROUND_SERVICE`
* `FOREGROUND_SERVICE_SPECIAL_USE`
* `POST_NOTIFICATIONS` (API 33+; denial hides the drawer notification, it does
not stop the service)
`NodeHost` owns the single `Wire` handle. The service never does. Lock, or the
notification's Stop action, drops the keep-alive anchor; the node stays up
only while another owner (the UI) still holds it. `START_NOT_STICKY`: a
restarted empty service would show "reachable" over a dead onion.
### Data at rest
@ -148,9 +176,11 @@ Release APKs are signed with a **repo-owned keystore**, not the debug key.
present (`~/.android/onionwire-release.jks` + `.env`, mode 600). Local and
CI APKs then verify as the same cert and can upgrade in place.
* If the env file is missing, Gradle **warns** and signs with the debug
keystore so a laptop build still installs. CI sets
keystore so a laptop build still installs. CI's `android-release.yml` sets
`ONIONWIRE_REQUIRE_RELEASE_KEY=true` and **fails closed** instead — a
per-machine debug key would make every CI APK uninstallable over the last.
`android-ci.yml` deliberately does **not** set that: it is a verification
build and `apksigner` reporting the debug cert there is expected.
* Never commit a keystore, password, or `android/local.properties`. This is
not a Play upload key; nothing here should be uploaded to Play.
@ -162,23 +192,157 @@ path and an on-device test of the JNI surface is how you ship an
`UnsatisfiedLinkError` nobody can read. Turn it on together with crash
deobfuscation, not before.
## CI
## Wallet child and chain sources (as Android sees them)
`.forgejo/workflows/android-release.yml` runs on `docker-amd64` (T480 dind).
The job image is `node:20-bullseye` (EOL) — **do not apt-get there**. The
toolchain runs in a sibling `debian:bookworm` container
(stdin-tar + `docker cp`, same pattern as the Rust CI job).
Any push to `main` that touches Android **sources or build config**
(`android/app/**`, `android/sdk/**`, Gradle files — not `android/README.md`)
workflow) builds `onionwire-<version>-android-arm64-v8a.apk` and
`onionwire-sdk-<version>.aar`, verifies them, and attaches them to the Forgejo
release for that tag. Version is the latest `v*.*.*` tag plus patch, or
**v0.1.0** when there are no tags. `versionName` matches the tag;
`versionCode` is `major*10000 + minor*100 + patch` (so 0.1.0 → 100).
Chain traffic is **off** until the user opens Wallet, picks a source, and
presses Start. Receive-only is the default: no `monero-wallet-rpc` child, no
daemon, no P2P.
`workflow_dispatch` with `dry_run=true` builds and checksums without creating
a tag or publishing. `scripts/build-android-local.sh` remains the offline
fallback; it does not create tags.
The app owns `monero-wallet-rpc` (issue #107). It is still a **child process**,
exec'd from `applicationInfo.nativeLibraryDir/libmonerowalletrpc.so`. Cuprate
has no wallet layer — an in-process node does not replace that binary.
Sources the screen offers:
1. **Receive-only** — no child, no chain.
2. **A daemon address you type** — loopback or clearnet. Wallet RPC itself is
loopback only. A `.onion` host is refused while `libarti.so` is absent
(`ONION_NEEDS_ARTI_NOTICE`); this APK does not bundle `arti`.
3. **On-device node (Cuprate)** — opt-in. Selecting it stores
`ChainChoice.InProcessCuprate` with an empty `monerod_datadir`, which the
SDK resolves to `$ONIONWIRE_HOME/chain`. Kotlin never invents an absolute
path. The pre-production warning (`CUPRATE_PREPRODUCTION_WARNING`) sits
**above Start**, not after. The screen can store testnet, mainnet-pruned, or
mainnet-full (and applies the matching storage floor); **mainnet remains
unvalidated** and the warning says so. Cross-compiled is not device-proven.
See [CUPRATE_DAEMON.md](CUPRATE_DAEMON.md).
Start is gated on the bundled wallet-rpc binary, on the storage floor for the
chosen Cuprate mode, and on the `.onion`/arti check. The floors are floors, not
sync estimates — nothing in this stack exposes a chain size:
| Mode | Floor |
|---|---|
| testnet | 3 GiB |
| mainnet pruned | 64 GiB |
| mainnet full | 280 GiB |
Unreadable free space (`StatFs` failed) is fail-closed: Start stays blocked.
### Status line
`ui/WalletChildStatusText.kt` is the pure model. The line renders the core's
words verbatim (`off` / `connecting` / `syncing` / `ready` / `exited`), then
the chain-source label, then — for the in-process source only — `node <word>`
from `WalletChildStatus.node_state`. An unrecognised word is never rendered as
ready.
When the last probe reported a non-zero height or target, the line grows
` · sync h/t`. That is the **daemon's** chain height, not the wallet's scan
height. `0/0` is omitted (unknown), not printed as 0%. There is **no
percentage, no progress bar, and no ETA** anywhere in the UI. The same string
is the row's screen-reader `contentDescription`.
Honest limit of the in-process node word: a daemon that dies *after* the wallet
child came up cannot be reported `exited` — there is no separate pid for the
in-process daemon, the chain probe fails, and the state stays `syncing`.
`exited` still means the `monero-wallet-rpc` child is gone. Details:
[CUPRATE_DAEMON.md](CUPRATE_DAEMON.md#what-has-not-been-proven).
### What the APK refresh loop actually calls
`WireViewModel.openWalletChild()` runs `walletChildRefreshLoop` with a 2 s
tick (`WALLET_CHILD_TICK_MS = 2_000`):
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
A merge to `main` does **not** publish an APK. Neither does a tag push.
Releases are manual and batched: two dispatches. Full procedure:
[docs/RELEASING.md](../docs/RELEASING.md).
### `android-ci.yml` (verification, not a release)
Runs on `docker-amd64` (T480 dind) for every `push`/`pull_request` whose paths
include `android/**`, `src/**`, `crates/**`, `Cargo.toml`, `Cargo.lock`,
`scripts/build-android-local.sh`, or the workflow itself — plus
`workflow_dispatch`. Job image is `node:20-bullseye` (EOL) — **do not apt-get
there**. The toolchain runs in a sibling `debian:bookworm` container
(stdin-tar + `docker cp`). Both Android workflows install `cmake` in that
container (RandomX).
It calls `scripts/build-android-local.sh` with the **debug** key
(`ONIONWIRE_REQUIRE_RELEASE_KEY` unset). Nothing is published. After the APK
is built it greps `lib/arm64-v8a/libonionwire_sdk.so` for `target_max_memory`
and **fails** if that cuprated-only string is missing.
### `android-release.yml` (the APK that lands on a tag)
`on:` is `workflow_dispatch` (and a declared `workflow_call` that this Forgejo
10.0.3 instance cannot invoke). **No `push` trigger.** Inputs:
| Input | Default | Meaning |
|---|---|---|
| `tag` | empty | Existing tag to check out, build, and attach. |
| `dry_run` | `false` | Build and checksum; skip the Pi publish job. |
Operator path, after `release.yml` has minted the tag (`dry_run=true` on that
workflow first):
1. Actions → **android-release** → Run workflow, `tag=vX.Y.Z` (the tag core
just created), `dry_run=false`.
2. The Android job **checks out that tag** (`ref:` is the tag, not `main`) and
stamps `versionName` / `versionCode` from it.
3. `versionCode` is `major*10000 + minor*100 + patch` (so 0.14.0 → 1400).
4. Publish is a second job on the Pi runner (`docker`). It attaches
`onionwire-<version>-android-arm64-v8a.apk`, `onionwire-sdk-<version>.aar`,
and both `.sha256` files to **that same tag**.
The APK is built from **the tag's tree**. Building from `main` and stamping a
tag you did not check out is how you ship a binary that does not match the
tag.
**Empty `tag` is the foot-gun.** Checkout then falls back to `github.sha`
(usually `main` HEAD). Version is *not* "latest `v*.*.*` plus patch" as a
rule:
* no tags at all → `0.1.0`;
* latest `v*.*.*` release is **missing** the Android APK (or the job cannot
inspect the release) → **join** that version: same `versionName` restamped
onto whatever tree was checked out. Android will refuse to install that APK
over an already-installed build of the same `versionName`/`versionCode`;
* latest tag already has an Android APK → `patch+1` of that version, still
built from `github.sha`, and this workflow may then **create** that new tag
at publish time if it does not exist.
Do not dispatch `android-release` with an empty `tag` to ship a release. Core
owns minting (`release.yml`, default `bump=minor`). This workflow attaches.
`workflow_dispatch` with `dry_run=true` builds and checksums without
publishing. `scripts/build-android-local.sh` remains the offline fallback; it
does not create tags.
The Android job image / bookworm-container story is the same as `android-ci.yml`.
The cuprated graph is built with `RUST_TOOLCHAIN=1.98` here (workspace MSRV
stays 1.91). Job timeout is **90** minutes on `android-release.yml` and **120**
on `android-ci.yml`.
## Layout
@ -187,17 +351,38 @@ android/
settings.gradle.kts
build.gradle.kts # plugin aliases only
gradle/libs.versions.toml # version catalog
gradle/wrapper/
monero-binaries.sha256 # provenance of the bundled wallet-rpc blob
CUPRATE_DAEMON.md
MONERO_BINARIES.md
sdk/ # -> AAR
build.gradle.kts # cargo-ndk + uniffi-bindgen wiring
consumer-rules.pro
src/main/AndroidManifest.xml
app/ # -> APK
build.gradle.kts
src/main/AndroidManifest.xml
src/main/java/com/siriusdevops/onionwire/
MainActivity.kt # NavHost
WireViewModel.kt # owns the single Wire node
WireViewModel.kt # UI-side Wire handle; wallet-child poller
crypto/ # Keystore-wrapped store passphrase
keepalive/ # NodeHost, KeepAliveService, policy, lifetime
wallet/ # ChainStorage, WalletChildBinaries
ui/ # Compose screens (M3)
src/test/ # JVM tests (envelope, store, invite flow)
WalletScreen.kt
WalletChildStatusText.kt
ChatScreen.kt
RosterScreen.kt
InviteScreens.kt
InviteAddFlow.kt
OutboxDetail.kt
MessageDelivery.kt
UnlockScreen.kt
UnlockSubmit.kt
RotateScreen.kt
Insets.kt
Theme.kt
src/test/ # JVM: envelope, store, invite, outbox, keepalive, wallet line, refresh loop
src/androidTest/ # device-only: AndroidKeyStore
src/main/jniLibs/arm64-v8a/libmonerowalletrpc.so
```