Commit 24e8db5
RFC: Android Kotlin → Rust/Gossamer migration (#97)
## Status
**DRAFT — RFC only. Awaiting owner review BEFORE any bulk conversion.**
No Kotlin deleted, no Gossamer scaffolding generated, no behaviour
change.
Supersedes #96 (was titled "Tauri 2" — owner correction: Gossamer is the
estate target).
## Why
`android/` ships 7 Kotlin files + 3 `*.gradle.kts` files, all banned by
the
Hyperpolymath language policy. Two CI gates permanently red:
- `Check for Banned Languages`
(`.github/workflows/language-policy.yml:87-94`)
- `governance / Language / package anti-pattern policy` (estate-wide)
## What this PR contains
A single document — `docs/migrations/RFC-ANDROID-KOTLIN-TO-RUST.adoc` —
mapping every Kotlin component to its Gossamer replacement and proposing
a 9-PR landing sequence.
## Component mapping (one-line summary)
| Kotlin file | Replacement |
|---|---|
| `MainActivity.kt` | `NeurophoneMainActivity extends GossamerActivity`
|
| `NeurophoneService.kt` | Hand-written Java `Service` shim → JNI into
Rust |
| `BootReceiver.kt` | Hand-written Java `BroadcastReceiver` shim → JNI |
| `NativeLib.kt` | Delete; lives in
`crates/neurophone-android/src/lib.rs` |
| `NeurophoneAppWidget.kt` | Hand-written Java `AppWidgetProvider` shim
|
| `NeurophoneWidgetActions.kt` | Hand-written Java `BroadcastReceiver`
shim |
| `NeurophoneWidgetConfigureActivity.kt` | Java `Activity` shim (or
drop) |
| `*.gradle.kts` | Groovy `*.gradle` (matches Gossamer upstream) |
## Key structural finding
**Gossamer Android is webview-only today.** ROADMAP Phase 3 (Mobile)
lists Android as *Partially Implemented* — only `GossamerActivity` +
`GossamerBridge` exist upstream. The 7 platform-integration surfaces
neurophone needs (service, widget, receivers, sensors, intent dispatch,
prefs, deep-links) have **no upstream Gossamer support and no open
Gossamer issues**.
**Recommendation:** build all 7 downstream in neurophone's own
`android/`
tree as small Java shims that JNI immediately into Rust. Don't block
neurophone on Gossamer upstream PRs. Estimated total shim surface: < 250
LoC of Java vs. current 926 LoC of Kotlin.
## Estate precedent
- `panll` migrated `src-tauri/` → `src-gossamer/` (commit `598d537`,
ADR-0001 in `b935727`). Webview UI unchanged; swapped `tauri` crate
for `gossamer-rs`, `tauri.conf.json` for `gossamer.conf.json`,
`cargo tauri build` for `deno task build` invoking the `gossamer` CLI.
- panll is **desktop only** — its migration did not exercise foreground
service or home-screen widget surfaces; neurophone will be the first.
## Sub-PR sequence (proposed)
1. **This PR** — RFC only.
2. CI exemption for `android/**/*.java` (coordinated with
`hyperpolymath/standards`).
3. Gossamer scaffolding: `gossamer-rs` workspace dep,
`gossamer.conf.json`,
`NeurophoneMainActivity` Java shim loading placeholder HTML.
4. Port `NativeLib` Kotlin → `crates/neurophone-android/src/lib.rs`.
5. Port `NeurophoneService` → Java shim + Rust impl.
6. Port `BootReceiver`.
7. Port widget triple (provider / actions / configure).
8. AffineScript UI compiled to JS, loaded by Gossamer webview.
9. Delete legacy Kotlin `android/` tree — both CI gates green.
PRs 2 & 3 sequenced; 4–7 parallelizable after 3; 8 needs 4; 9 gated on
all.
## Open questions for owner
1. **CI exemption scope** — estate-wide via `hyperpolymath/standards`
or neurophone-local? Linchpin question.
2. **Estate governance** — who owns the cross-repo anti-pattern policy
callable in standards?
3. **Widget config sacrifice** — acceptable to drop the configure
activity?
4. **Gradle DSL** — Groovy `*.gradle` (matches Gossamer upstream) or
keep Kotlin `*.gradle.kts` under a separate exemption?
5. **Hardware test plan** — Oppo Reno 13 vs emulator + Termux?
6. **Upstream contribution** — build shims neurophone-local, or factor
a `gossamer-android-services` companion as we go?
## Constraints honoured
- All new files MPL-2.0 SPDX.
- No new GitHub Actions added.
- No Deno/npm/TypeScript changes.
## Test plan
- [x] RFC document renders as AsciiDoc.
- [ ] Owner reviews component mapping for completeness.
- [ ] Owner picks CI-exemption scope (open Q1).
- [ ] Owner resolves Gradle DSL choice (open Q4).
- [ ] Sub-PR #2 (CI exemption) opens once approved.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent c660445 commit 24e8db5
2 files changed
Lines changed: 559 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
0 commit comments