* Build the native Android dictation keyboard Add a three-page Compose setup and an InputMethodService with QWERTY editing, system IME switching, tap dictation and hold-to-talk. Capture inside the keyboard and decode a checksum-pinned, MIT-licensed Whisper tiny model so a fresh install works offline without an app switch, playback focus request or audio files. Verified on the Studio API 35 ARM64 emulator: clean assembleDebug, three debug/release unit cases, system permission and keyboard setup, actual key editing, two WAVs through the guest microphone, insertion into a separate editor, cancellation and continued media output. The merged debug manifest has no Internet permission. * Document Android setup and the recognizer decision Record the supported toolchain, model and runtime licences, offline-first trade-off, and phase 1 limits. Document the headless emulator microphone path used for verification so the next phase can repeat it. Checked the Studio build/run commands and both recognizers on the API 35 image with airplane mode enabled and media playing. * Measure on-device Android dictation across four languages Replace the phase-one single-phrase evidence with a fixed 40-clip multilingual, partly music-mixed corpus. Record per-clip errors, load, warm inference, memory, two-core sensitivity and delivered platform-service results separately. Keep an independent foreground editor and media track for mic-to-insertion verification. Verified on an API 35 ARM64 Studio emulator: Whisper tiny/base/small, Parakeet TDT v3 int8 and strictly on-device Android recognition. Small in its short window made 15/285 word errors; the platform service returned 33/40. Both native runners also decoded the notebook clip after tightening the PCM input checks. * Use verified Whisper small for styled, offline Android dictation Replace tiny-only English recognition with a pinned small model selected by the multilingual benchmark. Keep bundled tiny for first-run offline use and download failures. Snapshot the style, cleanup, language and translation task per recording so a paste override affects only the intended editor and dictation. Replace the recording status text and old meter with the iOS-style dot waveform, round cancel/finish controls and in-place spinner. Explain the sole network permission on welcome and bundle verified Inter v4.1 and its OFL notice for Compose and the keyboard. Verified assembleDebug and tests on the Studio. The Android formatter matched 41 applicable iOS examples. Exercised tiny before download, observed progress and verified small and Inter hashes. The real IME inserted all four styles and both Spanish paste choices in airplane mode, with music continuing in an external editor; checked recording and transcribing in both themes. * Add offline spatial typing assistance to the Android keyboard Replace literal-only English and Spanish key handling with a native Kotlin Gaussian tap decoder, context-weighted word pairs, missed-space readings, and confidence margins. Map the pinned, uncompressed iOS-compatible Google Books v3 assets; credit the CC BY counts, SCOWL and MPL word filters. Use hashed local rejection counts so a second undo stops that correction without saving typed text. Give the idle strip three frequency-ranked slots and add independent default-on key previews and system-aware haptics, plus slide-to-select accents. Commit space on the same key-up as letters: the previous posted click could reorder rapid input. Make a confident known spelling harder to replace than an unknown one. Verified on Studio API 35: assembleDebug and tests, byte-identical English and Spanish models, the exact centre-tapped typo sentence in both themes, one-backspace undo and suppression after two undos across an IME restart, ranked suggestions, accent insertion, independent switches and the system vibration gate. * Benchmark Android typing against iOS on synthetic key taps Replay the 2,000 held-out English sentences through the installed Kotlin decoder and suggestion path, keeping only public synthetic rows from the mixed iOS experiment. Preserve aggregate scores, the unmodified Google Books model builder, and the two model digests; no labelled personal typing, offsets, or raw logs are committed. Verified 1,461 errors over 13,870 words (10.53% Android; 8.39% iOS without offsets using the byte-identical model; 33.81% raw). On the Studio emulator the real editor received letters in 1.41 ms median and spaces in 3.16 ms across five exact sentence replays. Document the confidence margins, timing boundaries, feedback controls, licences and reproducible aggregate scorer. * Align Android typing with iOS and add German and Bokmål layouts and models Apply R1's English typo and contraction rules before spatial search and match its language weight, shortlist and valid-spelling margins. A mapped SCOWL spelling list supplies the validity check missing on Android. Scale vertical spread and the missing-space cost to real Android row geometry so "seehkw" still splits into "see how". Keep the existing en/es model bytes. Build the new German and Bokmål HXTM files with the shared iOS writer. German uses all Google Books v3 shards; Bokmål uses NB book counts filtered by the complete 2022 Ordbank snapshot. Pin the new assets, credit their sources and licences, and ship their real layouts, accents and suggestions. Replace the post-setup list with the iOS-style Home, local Dictate bar and four settings pages. Follow the system language by default; make the spoken language switchable on space, and optionally pin an independent layout. Verified on the Studio API 35 ARM64 emulator: 1,027 English and 1,374 Spanish word errors vs R1's 1,163 and 1,387 on the same 2,000 synthetic sentences per language. Ran all five unit tests in debug and release, inspected the packaged assets, and checked external-editor suggestions, corrections, undo and offline microphone insertion, plus Home and settings in both themes. The Swift reader round-tripped both new models; the identical iOS files are in the separate local commit 230a437e. * Build a signed, shrunk Android 16 upload bundle Replace the API 35 release defaults with API 36, an external upload key, R8 and resource shrinking. Omit the debug probes, benchmark receiver and unused permission, silence native speech diagnostics, and guard password-field context at the input connection. Give the download a generic user agent and ship the Android privacy policy offline. Verified on the Studio: jarsigner, bundletool and byte-identical installed splits on API 31 and API 36; all ELF load segments and APK native offsets meet 16 KB alignment. Fresh model downloads and offline insertion passed on both. Binder traces showed zero reads in four password variants versus ten in an ordinary editor. Five tests passed in each build variant. * Prepare the Android Play listing and device handoff Add the en-US listing, Data safety and IARC drafts, four release screenshots, launcher-derived store art and a physical-phone checklist. Replace the obsolete API 35 build instructions with the signed API 36 workflow. Flag that the public privacy URL still needs the Android text and that suggestions can include strong language. Verified title and description limits, native screenshot and artwork formats, model downloads and offline microphone insertion in an external editor on 2.5 GiB API 31 and 16 KB API 36 emulators. Recorded bundletool download size and sampled memory from the same signed release.
11 KiB
Android typing benchmark
On the same iOS R1 word models and synthetic taps, Android now has 136 fewer English word errors and 13 fewer Spanish word errors than iOS. The biggest part of the old 298-error English deficit was a missing step before spatial decoding: porting the English contraction and typo rules alone recovered 231 errors.
Same-model results
Each language has 2,000 held-out synthetic Tatoeba sentences. English has 13,870 reference words; Spanish has 13,301. Errors are word insertions, deletions and substitutions, ignoring case and terminal punctuation. A missing space can change the word count. No user-specific offsets are applied.
| Decoder | English errors | English WER | English exact / 2,000 | Spanish errors | Spanish WER | Spanish exact / 2,000 |
|---|---|---|---|---|---|---|
| Raw hit keys | 4,689 | 33.8068% | 160 | 5,343 | 40.1699% | 94 |
| Phase 3 Android | 1,461 | 10.5335% | 983 | 1,338 | 10.0594% | 1,086 |
| iOS R1, same HXTM, no offsets | 1,163 | 8.3850% | 1,154 | 1,387 | 10.4278% | 1,064 |
| Phase 4 Android | 1,027 | 7.4045% | 1,249 | 1,374 | 10.3301% | 1,070 |
The installed APK ran on the Studio’s Android 15/API 35 ARM64 emulator (4 vCPUs, 4 GiB guest RAM). It received the original 402-point iOS key geometry, hit-key sequence, coordinates and separators. Letters request suggestions and spaces request replacements and predictions, exactly as in the Android IME. English and Spanish HXTM files are byte-identical across platforms. The iOS reference is the recorded output-r1-decoder-{en,es}.json output, before calibration. The earlier iOS prototype’s 6.71% English WER used a different model; it is not the comparison target. Phase 3 measurements · historical iOS aggregate, including calibration · Phase 4 replay counts and latency.
Where the 298 English errors came from
We changed one decision rule at a time on the same 2,000 English inputs. The diagnostic runner used scratch copies of the Kotlin classes on Android. Its phase 3 and phase 4 error and agreement counts matched the installed APKs. Deltas below are conditional on the preceding rows; they are not independent effects.
| Cumulative change | Errors | Δ errors | Normalized outputs matching iOS / 2,000 |
|---|---|---|---|
| Phase 3 | 1,461 | — | 1,517 |
| Apply iOS’s English contractions/common typos before search | 1,230 | −231 | 1,724 |
| Increase English word/pair weight from 1.25 to 1.5 | 1,255 | +25 | 1,740 |
| Score only the five best whole-word spatial readings | 1,207 | −48 | 1,762 |
| Use R1’s 0.26-row-pitch vertical spread on the recorded layout | 1,186 | −21 | 1,832 |
| Use R1’s 6.0 missed-space penalty | 1,196 | +10 | 1,864 |
| Protect valid English spellings outside HXTM (phase 4) | 1,027 | −169 | 1,773 |
| Diagnostic only: fixed Android 3.9 split penalty even at iOS pitches | 1,007 | −20 | 1,751 |
The R1 scoring and correction order alone closed 265 of the 298 errors. The remaining 33 were a net WER difference, not 33 sentences with one known cause. The intermediate decoders disagreed on 138 alignment spans; in 54, iOS retained a literal absent from HXTM. iOS can ask UITextChecker whether such a spelling is valid. Android had treated every missing spelling as a nonword. It now uses the same valid-literal cost (15 instead of 22) and replacement margin (7 instead of 2), with a bundled public SCOWL list. That list is not Apple’s dictionary. Lower WER is not identical decisions: the final engines produce the same normalized word sequence on 1,773 English and 1,906 Spanish sentences. Spanish made 36 more errors than phase 3 but agreed with iOS on 84 more sentences and still beat the same-model iOS WER.
The production IME scores actual key centres. Android’s rows are shorter than the test layout, so its vertical spread has a floor based on the iOS reference aspect ratio (56 / 39.5). This floor is inactive on the replay geometry. A fixed 6.0 split penalty ranked “seeks” ahead of “see how” for the real centre taps for seehkw. The IME now scales that squared-distance cost with row height, floored at the existing Android 3.9 prior (2% omitted separators). The measured Android pitch was 106.2 × 131 px, giving a cost of about 4.5; the recorded iOS layout uses exactly 6.0. This keeps the iOS behavior on its geometry and fixes the Android regression without a sentence-specific exception. The external editor received we need to do research into this and see how well we can get it from we need tk dk research into this and seehkw well we can get it. Tapping space after we need tk produced we need to ; one backspace restored we need tk.
Checks in an external editor
The Studio sent touch events to Hex’s visible keys and suggestion strip, then read the separate editor’s text. With Wi-Fi off and airplane mode on:
| Layout | Typed and completed with a model suggestion | Space-triggered correction |
|---|---|---|
| Español | Nos vemos mañan → Nos vemos mañana; ¿ and ¡ inserted from the second symbols page |
nos vemos mañnaa → nos vemos mañana |
| Deutsch | Bären mögen süße Äpfe → Bären mögen süße Äpfel; held s and slid to ß |
vielen dnak → vielen dank |
| Norsk (Bokmål) | Jeg lærer norsk på lørda → Jeg lærer norsk på lørdag; next words included kveld, morgen and og |
tusen takkk → tusen takk |
Automatic on a fresh install displayed English, followed the system locale to Español, and returned to English when the system did. With layout pinned to Deutsch and dictation set to Español, the keyboard kept the German letters and showed Español on the space bar.
Models and licences
All four HXTM v3 assets are uncompressed and memory-mapped from the APK; Gradle verifies the pinned hashes. There is no SymSpell data. German and Bokmål have the same binary format as the iOS files; the Studio checked them with the Swift model reader as well as the Android IME. The two new files are also in the iOS checkout’s ios/HEXKeyboard/TypingModel/ folder, local commit 230a437e. The Swift reader round-tripped every spelling and every stored pair cost. This verifies file compatibility, not iOS device behavior.
| Language | Words | Word pairs | Source of counts | Source of spelling |
|---|---|---|---|---|
| English | 86,133 | 417,480 | Google Books v3, 24 unigram / 589 bigram shards | SCOWL 2020.12.07 |
| Spanish | 110,000 | 326,366 | Google Books v3, 3 / 73 shards; existing model unchanged | RLA-ES Hunspell |
| German | 95,000 | 368,534 | Google Books v3, all 8 / 181 German shards | German alphabetic corpus spellings |
| Bokmål | 95,000 | 370,560 | NB N-gram 2026 book unigrams and bigrams, language nob |
Norsk ordbank, Bokmål full forms |
The shared iOS builder, SHA-256 cba009fe227632d9f8d176055f26ca34d5eb6f88a7cbd947955d8f9142878317, sums counts from 1980–2019, selects informative pairs and writes quantized probabilities. The German/Bokmål adapter uses the same writer. For German, it uses the iOS shard reader and filters lowercased words to its alphabet. For Bokmål, it NFC-normalizes and lowercases the words, filters vocabulary to standard Bokmål forms in the 1 February 2022 Ordbank fullformsliste.txt (OPPSLAG, normative and current in that snapshot), and only retains pairs whose two words are in that vocabulary. The September 2026 inflection export alone dropped common uninflected words such as og, på and det; it was not used in the shipped model. The complete snapshot supplied 617,139 distinct forms. Of 20,096,783 observed in-vocabulary pair types, 394,825 met the shared writer’s count and information thresholds; 370,560 fit the model budget.
- Google Books Ngram v3 (2020-02-17): CC BY 3.0. English and Spanish keep the original shared builds. German uses no second dictionary.
- NB N-gram 2026: the National Library of Norway’s counts are CC0 1.0. The Norsk ordbank – Bokmål 2005, February 2022 spelling filter is separately CC BY 4.0.
- SCOWL permits commercial redistribution subject to its included notices. The English literal-validity list contains 45,303 unique spellings absent from the frequency model (440,142 bytes). It is built from the same public SCOWL archive, not from benchmark outputs or personal data. It cannot supply scored candidates or word probabilities.
- RLA-ES es_ES/es_MX sources use their MPL 1.1 option. APK credits, source links and modification notices · full licence texts.
Reproduce on the Studio
-
Export only the allowlisted synthetic IDs where the iOS inputs already reside. The exporter accepts
test-0…1999(English) ores-test-0…1999(Spanish), empty context, no logged flag, and key-aligned finite x/y pairs. It exports only ID, intended text, synthetic hit keys/taps and the matching uncalibrated iOS output. Never transfer the mixed source, labels or personal offsets.mkdir -p "$T/bench" for lang in en es; do python3 benchmark/typing/export_synthetic.py "$IOS_BENCH/input.json" \ "$IOS_BENCH/output-r1-decoder-$lang.json" "$lang" > "$T/bench/$lang.jsonl" done -
In the synced Android project with JDK 21, Android SDK 35 and the designated emulator:
./gradlew assembleDebug test adb install --no-incremental -r app/build/outputs/apk/debug/app-debug.apk sh benchmark/typing/replay.shThe Java replay shim executes the installed APK’s Kotlin classes with Android’s
app_process. The output is aggregate WER, normalized sentences matching iOS and per-key timing (median/p95/max). Timings exclude loading, JSON parsing, evaluation, editor IPC and screen paint. Phase 3 timed the separate editor’s text-change callback from key-up (letter median/p95: 1.409/2.589 ms; space: 3.161/4.428 ms). The Phase 4 replay measures decoder work, not that end-to-end path or a physical handset. -
To rebuild the new typing models, use Python 3.9+,
curl,gzipandzstdwith scratch storage. German streams each shard and caches its counts. The Bokmål adapter resumes the two large NB archives in validated byte ranges and verifies their SHA-256 alongside the Ordbank snapshot. The SCOWL English validity list has a separate pinned-source generator:mkdir -p "$T/models" "$T/source" python3 benchmark/typing/build-layout-model.py de "$T/source/de" "$T/models/de.hextm" python3 benchmark/typing/build-layout-model.py nb "$T/source/nb" "$T/models/nb.hextm" curl -fsSL https://downloads.sourceforge.net/project/wordlist/SCOWL/2020.12.07/scowl-2020.12.07.tar.gz -o "$T/source/scowl.tar.gz" python3 benchmark/typing/build-valid-words.py "$T/source/scowl.tar.gz" \ app/src/main/assets/typing/en.hextm "$T/models/en.valid"