Files
piik/mobile/README.md
T
AAA b1dc436459 fix(app)!: bind Android capture confirmation to its request
Present the Android confirmation entry only after its capture is registered, and keep late intents scoped to that capture. Rejected desktop preparations no longer cancel another pending OBS source.

BREAKING CHANGE: Internal Web and App builds must use App Control protocol 24. Domain protocol and saved-data formats are unchanged.
2026-11-23 06:09:01 -05:00

79 lines
4.0 KiB
Markdown

# Android App runtime
On the isolated 3.0 branch, this directory contains the Java system-browser
shell for the shared Rust App. It currently targets Android 10 or later on
ARM64 and x64, with the isolated application ID `tv.piik.android.channel3`. It does not
replace the published 2.x package or its data.
`AppRuntimeService` owns one runtime. Its serial worker starts Rust, receives
the final entry URL, and cancels and joins the runtime when the Service stops.
`MainActivity` retains notification permission and opens the existing launcher
in the system browser. The JNI entry in
[`prototype/channel-android`](../prototype/channel-android/) only supplies
Application Context and data/cache/frontend/helper paths; the shared
[App runtime](../prototype/channel-server/README.md#local-app-link) owns sites, room
hosting and networking.
Application Context is initialized before networking. Android WSS uses the
[official rustls platform verifier](https://github.com/rustls/rustls-platform-verifier)
and Android's certificate trust. Gradle reads the paired Android artifact
version from the JNI crate's Cargo lock. No Go business core or gomobile AAR is
used by this shell. The independent cloudflared helper remains Go-built.
After room admission, the Android App registers the screen request and the
selecting page shows **Confirm in App**. Tapping it opens Android's system picker
for that capture ID. Cancelled selections cannot claim a later request.
One MediaProjection owns the
image source and optional playback sound; Rust encodings use the shared Native
producer and source clock. Permission and first-frame waits belong to the
selecting page and use the same stop operation as active capture. The
[network design](../docs/research/channel-network-design.md#implementation-boundary)
owns that boundary. Android does not expose a controlled keyboard/mouse endpoint;
Browser camera and room voice keep their Browser permissions.
## Development build
Use Rust 1.91 with `aarch64-linux-android`, NDK 30.0.16248370, JDK 17,
Gradle 8.11.1 and Android platform/build-tools 35. Also install the
`x86_64-linux-android` and `wasm32-unknown-unknown` Rust targets,
wasm-bindgen CLI 0.2.129 and cargo-about 0.9.3.
Set `ANDROID_HOME`, `ANDROID_NDK_HOME` and `GRADLE_HOME`, then run the shared
packaging entry point:
```sh
node scripts/build-android.mjs
```
That script configures API 29 and 16 KB alignment, builds the ARM64 and x64
Rust JNI libraries and cloudflared helpers, bundles the
[shared frontend](../prototype/channel-browser/README.md), and passes those
inputs, icons and third-party notices to the existing Gradle project.
`CARGO_TARGET_DIR` can place build output outside the checkout;
`WASM_BINDGEN` and `CARGO_ABOUT` can point to installed tool executables.
The APK contains stripped JNI libraries. Keep its matching `native-symbols/<ABI>/`
directory with the exact APK for crash diagnosis, using the APK's SHA-256 and
reported ABI to select the symbols. Decode a crash with
`ndk-stack -sym native-symbols/<ABI> -dump tombstone.txt`; source line information
depends on the Cargo profile's debug information.
[NDK symbolization guide](https://developer.android.com/ndk/guides/ndk-stack)
For a signed release candidate, use the same entry point with a new output directory:
```sh
node scripts/build-android.mjs --release --output build/android-release
```
Toolchain paths and generated libraries, assets and APKs stay outside tracked
source. [TODO](../docs/todo.md) owns remaining device acceptance and publication holds.
## Signed release APK
The signed release command produces one universal APK for ARM64 and x64;
install it directly without extracting an archive.
Gradle reads signing material from `PIIK_ANDROID_KEYSTORE` (an absolute path),
`PIIK_ANDROID_STORE_PASSWORD`, `PIIK_ANDROID_KEY_ALIAS` and
`PIIK_ANDROID_KEY_PASSWORD`. Keep the keystore and passwords outside Git and
back up the signing key securely. Updates to an installed package must retain
its application ID and signing key. The experimental application ID above keeps
this runtime separate from the published 2.x App.