android: start/stop the monero-wallet-rpc child from WalletScreen, bundle the binary (issue #107) #109
Loading…
Reference in a new issue
No description provided.
Delete branch "onionwire/t_87984328-android-start-stop-the-monero-wallet-rpc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements the Android half of issue #107. The Rust half landed as #108 (
src/wallet_child.rs,start_wallet_child/stop_wallet_child/wallet_status/set_chain_source/chain_sourceover UniFFI), so this is based straight onmain.Binary
android/app/src/main/jniLibs/arm64-v8a/libmonerowalletrpc.sois a realmonero-wallet-rpc, cross-compiled foraarch64-linux-androidfrommonero-project/monerov0.18.4.4 (516e5355a103a2bf0b7e10328ebcaa2945019445) via upstream's owncontrib/depends+ emittedtoolchain.cmake, then stripped with the target's own strip.d9126788030ecd1ccdb40c7764e66e9a14d158a147ad335b256f0577681b5ad4ELF 64-bit LSB shared object, ARM aarch64, dynamically linked, interpreter /system/bin/linker64, for Android 21, built by NDK r17blibc.so,libm.so,libdl.so— everything else staticIt ships through
jniLibsrather than as an asset on purpose: since API 29 the kernel refusesexec()on a file in the app's own data directory (SELinux has noexecuteonapp_data_file), so the only executable directory an app has isapplicationInfo.nativeLibraryDir, which the package manager fills fromlib/<abi>/at install time. That requiresandroid:extractNativeLibs="true"—app/build.gradle.ktsnow setspackaging.jniLibs.useLegacyPackaging = true, pluskeepDebugSymbolsfor this one entry so AGP's strip pass cannot rewrite the bytes CI verifies.scripts/build-monero-wallet-rpc-android.shreproduces the build.android/MONERO_BINARIES.mdrecords the four host quirks that cost the most time, because each one presents as something else:libclang_rt.builtins.a.clang60needslibtinfo.so.5; current distros ship ncurses 6 only. A shim directory onLD_LIBRARY_PATHfixes it.toolchain.cmakeputs the host/usrinCMAKE_FIND_ROOT_PATH, sofind_library()returns host libraries. That gives/usr/lib/libpgm.so: error adding symbols: File in wrong formatat the final link and aHAVE_HIDAPIdefine that makessrc/devicecompile against host headers. The script pinsCMAKE_FIND_ROOT_PATHto the depends prefix.wallet_rpc_server;monero-wallet-rpcis only the output name.Not bit-reproducible — build paths and timestamps land in the binary. The sha256 is a provenance record of the shipped blob, not a reproducible-build assertion; that is stated in the doc.
CI re-verifies rather than trusting the blob.
scripts/build-android-local.sh(whichandroid-ci.ymlandandroid-release.ymlboth call) checksandroid/monero-binaries.sha256before Gradle, and after packaging pullslib/<abi>/libmonerowalletrpc.soback out of the produced APK and compares its sha256 with the committed file. A mismatch fails the build.artiis NOT bundledWalletChildrunsarti proxyas the SOCKS child for a.oniondaemon andChildConfig::validaterequires a non-emptyarti_bin. There is noartiexecutable here, and producing one means building a standaloneartibin for android — which needsCargo.toml/crates/**changes that are outside this card.So the app says so instead of pretending:
arti_binis set to the path the binary would occupy (<nativeLibraryDir>/libarti.so), which is inert for a loopback or clearnet daemon, and the screen refuses an.oniondaemon while that file is absent, with the reason on screen. It is deliberately not set to a real binary —monero-wallet-rpcnamed as the SOCKS child would be spawned as the proxy the moment the user typed an.onionhost.Today: loopback and clearnet daemons work;
.oniondaemons do not.UI
WalletScreengains a "wallet daemon" card above the existing Create / Import / Invoice / Tip actions, which are untouched (no removal, no reorder):Wire::wallet_status()rendered verbatim —off/connecting/syncing/ready/exitedplus the core's chain-source label (receive-only/local node/remote onion daemon/remote daemon). A died child readsexited; it is never folded intooffand never intoready;start_wallet_child/stop_wallet_childthroughWireViewModel, onDispatchers.IO(the spawn is synchronous inside the node and a.onionsource waits up to 20s; the status read re-decrypts the sealed record);host:portfield that saves a remote daemon viaset_chain_source, plus a Receive-only button, with the stored config prefilling the field;.oniondaemon with no arti, or a start that failed — each gets its own sentence and Start is disabled with the reason on screen.WireViewModelowns the 2s wallet-child poller the same way it owns the chat poller, so leaving the wallet screen and coming back cannot stack a second loop.ui/WalletChildStatusText.ktis the pure model (mirroring theChatRowInput/OutboxRowInputconvention) and holds the state mapping, the status line and the Start/Stop gates;WalletChildStatusTextTestcovers them on the JVM.WireViewModel.ktis the known hotspot for the wallet cards — this touches only the wallet-child section and the wallet methods.Verified
./gradlew :app:testDebugUnitTestpasses (newWalletChildStatusTextTestincluded).scripts/build-android-local.shproducesdist/onionwire-0.1.0-android-arm64-v8a.apk— 27 884 277 bytes,versionName='0.1.0' versionCode='100'— withlib/arm64-v8a/libmonerowalletrpc.soinside it atd9126788…, matching the committed blob, andextractNativeLibs="true"in the merged release manifest.NOT verified: the binary was never executed. The build host has no
arm64-v8aAVD (all three existing AVDs arex86_64) and no aarch64 sysroot to run it underqemu-user, so nothing here provesmonero-wallet-rpcstarts, opens its wallet file and answers JSON-RPC under Android's runtime.android/MONERO_BINARIES.mdsays that plainly and lists the emulator steps to close the gap. The CI artifacts are the second half of the evidence.