id: rb-android feature: 6-android branch: feat/6-android status: draft created: 2026-09-10

Design — Android app

0. What is already settled

The toolchain is in place: JDK 17, Android SDK with platforms 34 to 36 and build-tools 36, and the upload alias added to the release keystore on 2026-09-10. Capacitor 8.5 is current. The two apps already published from this account are native Kotlin, so there is no Capacitor precedent in this account to copy; the older react-capacitor-stack repo used a different keystore and is not a model.

1. Shape

capacitor.config.ts          appId, appName, webDir: dist
android/                     generated by cap add, then committed
  app/src/main/java/com/mby4m/rpmboss/
    MainActivity.java        registers the plugin
    RawAudioPlugin.kt        the recorder
  app/src/main/res/          adaptive icon at every density
  key.properties.example     tracked
  key.properties             gitignored
src/audio/
  native.ts                  the plugin's TypeScript face
  record.ts                  picks native or worklet at runtime

android/ is committed. Capacitor regenerates it on demand, but the signing block, the plugin registration and the icons are hand-edited, and a regenerated tree would lose them silently.

2. The recorder

2.1 Why not MediaRecorder

Android's MediaRecorder writes a container and applies the same voice processing the browser did. AudioRecord is the raw path: it takes an audio source constant, a sample rate and a buffer, and hands back PCM. That is what the DSP wants anyway.

2.2 Source order

MediaRecorder.AudioSource.UNPROCESSED first. It is optional, and a device that does not implement it either fails to open or quietly routes to MIC, so the plugin tries in order and reports what it got:

  1. UNPROCESSED — no AGC, no NS, no AEC. What we want.
  2. VOICE_RECOGNITION — no AEC and usually no AGC. The common fallback.
  3. MIC — last resort, and the one that behaves like the browser.

The chosen source comes back with the audio, so the review can record which one this phone gave, and a future bug report can say it too. The device's own claim via PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED is read and reported alongside, because a device that advertises it and then silently downgrades is exactly the failure phase 4 spent an evening on.

2.3 Rate

AudioRecord is opened at 16 kHz mono directly. Every device supports 44.1 kHz and most support 16 kHz; when 16 kHz fails the plugin falls back to 48 kHz and says so, and decodeToClip resamples as it already does for uploads. Opening at the app's own rate keeps the common case free of a resample on the phone.

2.4 Transport

PCM 16-bit is read on a background thread and accumulated natively rather than streamed frame by frame across the bridge: a ten second take is 320 kB, and crossing the bridge hundreds of times to save that is a worse trade. stop() resolves with the whole take as base64, plus the source and rate. The web side converts to Float32Array and calls the same decodeToClip the browser path uses.

Elapsed time for the countdown comes from the web side, as it already does; the plugin does not need to tick.

3. One recording interface

record.ts keeps its signature. Inside, it picks:

Capacitor.isNativePlatform() ? recordNative(...) : recordWorklet(...)

The worklet path stays, unchanged, and stays the browser's path. Two capture implementations is the honest cost of shipping both a website and an app; the alternative is a browser build that cannot record, and the browser is the test loop.

Both produce an AudioClip through decodeToClip and both raise the same InputError codes, so useAudioInput, the crop, the analysis and the result view never learn which one ran.

Permission: the plugin declares RECORD_AUDIO and Capacitor's permission API requests it. A refusal maps to mic-denied, the message that already exists.

4. Identity and signing

Name RPM Boss
Package com.mby4m.rpmboss
Version versionCode 1, versionName 1.0
minSdk / targetSdk 24 / 36
Alias a dedicated alias in a keystore kept outside the repo

build.gradle loads key.properties if present and falls back to debug signing if not, exactly as resttimer and whereami do, so a fresh clone builds without the keystore. key.properties and *.jks are gitignored; key.properties.example is tracked.

5. Icon

Plate 01, Trace, as an adaptive icon: the drawing on a white background layer, ink foreground, sized so the art sits inside the 66 % safe circle. Exported from the SVG to every density with Android Studio's own densities (mdpi through xxxhdpi), plus a 512 px master for a future store listing.

6. Privacy policy

The app records audio, so a policy is required before any store work, and it costs nothing to write now. Published at https://mby4m.github.io/legal/rpmboss/ from ~/git/legal/rpmboss/index.html, matching the two existing policies. The substance is short and true: audio never leaves the device, there is no network, no account, no analytics, and the only permission is the microphone.

7. Testing on the device

Claude can install, launch, tap and screenshot over adb, and can read the screen with uiautomator dump. It cannot hear. So the checks split:

8. Out

No splash screen beyond Capacitor's default, no deep links, no file associations, no share target, no background service.