hex/android/README.md
Ryan Vogel 61eb56dbeb android keyboard: Português gets its own layout and typing model, accent holds, swipe and filter
Step 5 of Portuguese typing. Português, dictated or pinned in Keyboard › Keyboard layout, now types
with its own model instead of English's word list standing in (Spoken.Portuguese, "pt"):
- Keys: QWERTY, as English's (KeyboardLetters "pt").
- Holds: iPhone Hex's Portuguese long presses (KeyboardLanguage.swift) on a, e, i, o, u, c and n;
  other letters hold nothing, as on iPhone.
- The strip's words between words: "eu", "o", "a" at a sentence's start, "e", "mas", "que" after a
  comma, and the commonest words where the pairs know none.
- never-suggest.tsv: Portuguese rows curated from LDNOOBW's pt list (CC BY 4.0, credit extended):
  11 slurs (viado, bicha, paneleiro, sapatão...) and 43 swear words with common inflections;
  ordinary words on that list (comer, cerveja, burro, saco, transar) and veado (deer) stay.
- Swipe: swipe_paths.py and swipe-bench.py know "pt".
Nederlands, Polski and Русский keep English's word list as a stand-in, as before.

Tests (existing files): InsertionTest now expects Português's layout and typing model;
NeverSuggestTest runs its filter, between-words and swipe checks for pt as for the other six.

Verified on the Studio (host JVM, Gradle --no-daemon, no emulator): testDebugUnitTest passes;
quality-gate.py all: pt PASS (83.75% fewer errors, 0.16% correct words changed, 98.30% accents,
7/7), the other six identical field for field to origin/dev's; swipe-bench.py, typical fingers:
pt 96.3% first word right, 99.5% typed or in the strip over 11,580 swipes, the other six as in the
README table. Not yet checked on an emulator.
2026-11-24 18:25:08 -05:00

43 KiB
Raw Permalink Blame History

Hex for Android

Hold the Hex key, speak and release to insert text in the current app. A tap starts hands-free dictation; ✓ finishes and ✕ discards. The Hex key sits at the strip’s trailing end, where Gboard has its mic; while dictating it becomes ✓ and the live dot waveform grows out of it, above the keys. While Hex transcribes, a spinner takes the checkmark’s place and ✕ still cancels, which also stops the transcription itself. A recording stops at 1 minute and says so (“Stopped at 1 minute”); its text is still inserted. While a dictation opens, listens or transcribes, the keyboard’s and Home’s windows hold Android’s FLAG_KEEP_SCREEN_ON (no permission), so the display timing out can’t hide the IME and cancel the recording; the screen sleeps normally again once Hex is idle. Dictation’s notes show in the strip even while Hex Preview’s update line is waiting, which returns afterwards. The keys are Gboard’s size and place on a Pixel (measured on an emulator), with ?123, comma, space, period and enter in the bottom row (the second symbols page puts < and > there, as Gboard does); the system’s own switcher in the navigation bar, or Hex menu › Next keyboard, changes keyboards.

Speech model and privacy

Whisper small Q5_1 is the default; multilingual tiny Q5_1 is bundled and works from first launch in airplane mode. The Android benchmark compares tiny, base, small, Parakeet and Android’s strictly on-device provider on the same 40 clips. Hex’s small configuration reduced WER from 17.54% to 5.26% and used 344 MiB peak native RSS on short clips. Norwegian remains the weakest language.

Labs › Faster English dictation (off) runs English dictations on NVIDIA's Parakeet TDT-CTC 110M instead, through transcribe.cpp at the commit desktop Hex pins, in a second native library (libhexenglish.so, built from source with the same patch and import check as libhexspeech.so, and only Parakeet in its model registry). Turning it on shows Download 135 MB; nothing is fetched until that tap. The file (handy-computer's Q8_0 GGUF at 1c3f0d53, 135,373,280 bytes, SHA-256 7dd44c74…) goes through ModelStore like the default model and is hashed once more per process before its first use; Delete download removes it (and turns the switch off). Only English uses it, decided when a dictation starts: every other language, Automatic resolving to one, and Paste in English keep today's model, and the library isn't even loaded with the switch off. One model is loaded at a time. When the faster one can't run (no file, a file failing its hash, a failed load) or fails, the same audio goes to today's model; short of memory with today's model already loaded, an English dictation keeps it, and the strip says so at most once a day. On the host's clip sets it used 26× less processor time than small on short dictations and 13× less on long ones, with no English errors (benchmark).

Welcome explains that the internet is used only to fetch the 190 MB speech model (and any added in Labs) and, when you tap Send, to send feedback. Get started begins a fixed HTTPS download; setup shows progress and lets you continue with tiny. The partial file is kept: when Android closes the connection because Hex went to the background, or Hex is closed or the phone restarts, the download continues with an HTTP range request the next time a Hex screen is open. A real failure (no connection, server error, full storage) says so and offers Retry, which also continues. ModelStore verifies the exact byte count and SHA-256 before atomically installing it in private, non-backed-up storage. The keyboard never makes a network request. Missing or unusable small weights fall back to tiny. Voice, words and translations stay on the device; Hex has no telemetry, transcript history or network speech service. The app’s only other request is Send feedback, made when you tap Send.

Keyboard and styles

Automatic follows a keyboard layout chosen in Keyboard › Keyboard layout, else the first supported Android system language, else English. It never listens for the language, so Settings › Dictation language and the Hex menu name the one it dictates in now, in its own name (“Automatic · English”). Hold the language-labelled space bar to switch immediately between Automatic, English, Español, Deutsch, Norsk (Bokmål), Français, Italiano, Nederlands, Português, Polski and Русский. Português is one entry for Brazil and Portugal (Whisper has one pt). Its layout is QWERTY with the iPhone’s Portuguese accents held on a, e, i, o, u, c and n, and its typing model is Brazilian Portuguese, which keeps Portugal’s own spellings (“facto”, “telemóvel”) as typed. Nederlands, Polski and Русский keep the English layout (Polish letters are held on their base keys; there are no Cyrillic keys yet), so they type with English’s keys and accents and none of English’s suggestions, next words or autocorrections — your own dictionary words still complete and your text shortcuts still apply — and have no cleanup or list rules; pin a layout in Keyboard › Keyboard layout to type with that layout’s words. Português has spoken punctuation, the other three don’t. Slide on the Hex key or tap Hex menu to change the spoken language or style:

  • Polished (default): trims standalone hesitation sounds, fixes spacing/capitals and closes sentences.
  • Casual: lowercase texting, without the period at the end of a single statement.
  • Notes: “bullet point,” “next bullet,” “new line” and “new paragraph” become list items and breaks.
  • Verbatim: keeps the recognizer’s words and punctuation; no cleanup is applied.

Clean up what I say is off by default. The deterministic rules remove hesitations and resolve explicit self-corrections against nearby words of the same kind. Spanish, German and Norwegian use the iOS word lists and pause boundaries; English uses explicit markers, not iOS’s learned tagger or an LLM. Ambiguous repairs stay as spoken. Ordinary negation and language-specific words such as German “eh” and Norwegian “er” stay intact.

Translate what I say is also off by default. With Español and translation enabled, Next dictation offers Paste in English or Paste as spoken. The choice is captured when recording begins; after a one-off spoken-language insertion, the next dictation returns to English. Translation is multilingual Whisper’s native speech-to-English task, not a second text model or online SDK. The tested Spanish WAV inserted both “El café todavía está caliente.” and “The coffee is still hot.” offline.

Typing assistance

All four layouts have a bundled, memory-mapped HXTM v3 word and word-pair model. English and Spanish keep the original iOS Google Books files. German uses Google Books; Bokmål uses the National Library of Norway’s book counts filtered by Norsk ordbank. Start typing to see ranked suggestions; tap one to insert it. An Italian or French elision typed without its apostrophe is offered joined up while the word after it is one of the model’s own starting with a vowel or h (“laltro” gives “l’altro”, “dellanno” “dell’anno”, “lho” “l’ho”, “lheure” “l’heure”), the longest elision first: Italian’s h is only for ho, hai, ha and hanno, and a word the model itself has (“lago”) or a books’ run-together spelling whose word after it is not much likelier (“allodio”, “sensei”) is left alone; a suggestion only, as the English contractions are. A space brings up next-word predictions. Passwords and email addresses use literal typing; a URL or web search field, as a browser’s address bar is, keeps suggestions and swipe typing but never autocorrects, shows no highlighted autocorrection and changes nothing typed there (no double-space period, text replacement or tap correction); a picked suggestion goes in with a space, as Gboard’s does there, and a following mark such as . or / takes that space (“github.”, “github/”), while a swiped word gets the usual space before it and none after; a field that asks for no suggestions, completions or filtering, as a search box does, keeps suggestions, next words, emoji suggestions, swipe typing, text replacements and double-space period but does not autocorrect on space or punctuation: no autocorrection is highlighted in the strip, though a text replacement still shows and applies; a field that asks not to be learned from, as an incognito tab does, keeps every suggestion, autocorrection, swipe and double-space period, and remembers nothing typed there: an undone autocorrection is not counted, and a picked emoji does not join the picker’s recents. A field that keeps its own text, as a terminal’s TYPE_NULL editor does, gives Hex nothing to read back or edit: suggestions, autocorrection, swipes and smart quotes are off there, Delete and a held Delete send one delete key press each (a key press per press, never a surrounding-text delete), Delete’s slide is off, the space bar’s cursor slide steps with arrow keys instead of setting a selection, and Enter sends an Enter key when the editor has no action. Read from the source and the field’s unit test; not tried on a device.

Nederlands, Polski and Русский have no typing model of their own: while one of them is dictated and no layout is pinned, English’s word list only gives the keys their geometry. The strip offers what you typed and your own dictionary words as completions; there are no next words, no autocorrection or replacement on space and punctuation, and no tap correction, swipe typing or English emoji keywords. Double-space for a period, your personal-dictionary text shortcuts, capitals and the literal chip keep working. Pin a layout in Keyboard › Keyboard layout to type with its model.

Keyboard › Keyboard layout follows dictation by default; an explicit layout can differ from the space bar’s spoken language. Spanish has a dedicated ñ, and holds ¿ and ¡ on ? and !. German is QWERTZ with ü, ö and ä; hold s for ß. Bokmål has å, ø and æ.

Keyboard › Suggest swear words is off by default on every layout. Slurs on the curated list are never offered, even when swear words are enabled. The filter applies to completions, next words, autocorrect and both halves of a missed-space correction. Typing a listed word in full keeps your exact spelling; its literal chip accepts what you typed. The filter never changes the HXTM models.

On space, the Kotlin decoder compares each tap with the measured key centres and combines those distances with the previous word’s probability. It can recover a missing space. A known spelling requires a higher confidence margin than a nonword. Immediately press Delete to restore exactly what you typed, without the space. Undo the same replacement twice and Hex keeps that spelling in later sessions. Only rejection counts keyed by hashes and, with Labs › Learn from my fixes on, the dictation word pairs you corrected are saved locally; there is no typing journal. In a field that asks not to be learned from (an incognito tab), undo still restores exactly what you typed, but that rejection is not counted; a picked emoji is not remembered either.

Keyboard › Swipe typing is on by default, as on iPhone Hex and Gboard (Gboard calls it glide typing). Slide from a letter through a word's letters and lift: a trail follows the finger and the strip shows the word so far. Lifting types the best reading, after a space unless the text before ends in one, a line break or opening punctuation, with a capital from shift or a sentence's start; names and German nouns take theirs from the capitals list. The strip then offers the next three readings; tapping one puts it in the word's place. A letter, digit or opening mark tapped next goes in after a space; a comma, period or other closing mark goes against the word. Delete right after takes the whole word back as Gboard's does: the space before it stays, the strip offers the word again, and the same swipe there types its next reading instead (with Labs › Keyboard › Delete swiped words letter by letter on, it deletes one letter and the swipe is forgotten). Space never autocorrects a swiped word. A drag that comes back to the key it started on types that key; a hold for accents, a slide from shift or ?123, the space bar's cursor and Delete's slide work as before, and a second finger going down finishes the swipe first. Swipes work in all seven layouts, in fields where Hex reads words (not passwords, addresses or URLs), except while a dictation language without a typing model is dictated and no layout is pinned (Nederlands, Polski or Русский): English’s words are only standing in for the keys there, so they never guess ahead. ß is read through s, and French œ and æ through o and e and through a and e.

SwipeDecoder is iPhone Hex's decoder in Kotlin with the same parameters. A path is resampled in key pitches, and the words starting and ending near its ends are read in place from the same HXTM model. Each is scored on location, shape, where the finger turned and paused, and the word before. On the iPhone benchmark's method and the held-out sentences (swipe-bench.py), the Android and iPhone decoders give the same four readings for every one of 12,514 English swipes. The first word is right for 96.9% of English swipes and 94.3% of Spanish, 95.9% German, 96.4% Bokmål, 95.2% French and 96.0% Italian; the word is typed or in the strip 99.2–99.6% of the time. A swipe takes 1.0–1.4 ms at the median and under 5 ms at p99 on the API 36 emulator. Swipe results and how to run them

Keyboard settings and Hex menu → Typing feedback control key pop-ups and key haptics independently. Both default on. Each key press is one short click that Hex plays on the vibrator itself, not Android’s keyboard effect, which some phones (Samsung’s One UI) keep for their own keyboard. The click is touch feedback, so the phone’s touch vibration setting, its strength and Do Not Disturb apply (Pixel: Sound & vibration › Vibration & haptics › Touch feedback; Samsung: Sounds and vibration › System vibration › Touch interactions). Hex doesn’t follow Android’s Keyboard vibration switch (Android 15 and later; a Galaxy S23 stores it off with touch vibration on): Hex’s own Haptics switch turns its taps off. Hold a letter, slide to an accent, and release. Turning off pop-ups leaves the deliberate accent picker available.

English/Spanish typing benchmark, model sources and licences

Settings

After setup, Home shows Ready or Finish setup, a Dictate bar and four destinations, following the iOS navigation in #2054. Tap Dictate, speak, then Finish dictation: Hex displays the local result on Home. Dictation controls style, language, translation, cleanup and the offline speech model. Keyboard has layout, autocorrect, swipe typing, key pop-ups, haptics and a practice field. Privacy explains storage and links the model credits. Labs has a Dictation group with Faster English dictation (off; see Speech model and privacy) and Learn from my fixes (off): a dictation inserted in a word field is followed by its text around the cursor, never by position, for a minute or until the field changes, and the words you correct become fixes once you make the same one twice. Fixes are applied to later dictations, and the words you meant join the recognition hints. It holds only the word pairs, their counts and when you last made each fix, on this phone, and off it tracks, applies and hints nothing; Settings lists each learned pair with a switch and Delete what Hex learned, which stays reachable while the lab is off because the records remain. An Output group with Signature (off): each keyboard dictation ends with “Sent from Hex” on its own line. The line is editable, one line of up to 200 characters, and an empty line adds nothing. The next dictation starts on a new line below the signature, and a signed dictation never continues the signature line. Home’s preview and Copy stay unsigned, and Hex’s own fields are never signed. Labs also has a Keyboard group with Symbols on letter keys (off): hold a letter from any of QWERTY’s three rows, such as m, to type ? first, with the letter’s accents after it. Symbols follow the letter, so AZERTY q/w and QWERTZ y get none where their layouts draw those letters on rows 2 and 3. Row 1 keeps its digit while it shows one: with Number row off it hints and holds the digit first; with it on, the top row’s letters show Gboard’s symbols in its place and hold them first (q for %, p for }, r for =), and a letter that already has a row 2 or 3 symbol keeps that one (@ on AZERTY a, * on AZERTY z and QWERTZ z). The top row’s symbols stay on row 1, and no two letter keys show the same symbol. Off, the keyboard is unchanged. The same group has Number row (off): while it is on, every letter layout draws 1 2 3 4 5 6 7 8 9 0 in a row above the letters, so a digit types without switching to ?123. The digits type like normal keys, with key pop-ups, haptics and their held symbols, and shift leaves them alone. With the number row on, the letter keys’ corner digits and digit-first holds are gone, and the Symbols on letter keys hints and holds still work, row 1’s first ten letters showing a symbol instead of the digit (Gboard’s, such as q for % and p for }, or the letter’s own home- or bottom-row symbol where it has one, like AZERTY a for @). The keyboard is one row taller and the Hex menu keeps its keys but matches that height; switching between the letters and ?123, the symbols pages or a number pad changes the height by a row while it is on. With the toggles off the keys are exactly as before. The same group has Local currency (off): the ?123 page shows your region’s currency in $’s place, and d holds it on the letters — £ in Britain, € in the eurozone, ¥ in Japan and China, and ₹, ₱, ₩, ₽ or ₴ where those are used. Only the first system language with a country is read, and the currency’s code decides the symbol, so it never follows the phone’s wording; an unknown region, a first language whose region isn’t a country (such as Latin American Spanish, es-419), a currency Hex has no single symbol for, and the United States keep $. Holding the key types $ first, then the key’s held symbols without a second copy of the local one. The second symbols page’s money row is £ ¢ € ¥: a local £, € or ¥ gives its slot to $, and any other local currency takes only ¥’s slot, so £, ¢ and € stay drawn and no page shows a symbol twice. Off, both pages draw Gboard’s rows and d keeps $. That group also has Emoji suggestions (off): on the English keyboard, while an English word that names an emoji is being typed (never while English’s list only stands in for a dictation language without a layout), the strip’s last slot offers it beside the word suggestions — “smile” gives 😊, “joy” or “haha” gives 😂, “heart” gives ❤️. It always takes that last slot, even when it is the only suggestion. Matching is case-insensitive and whole-word; continuing to type keeps the word, and nothing matching leaves the strip unchanged. Tapping the emoji replaces the word and commits it with the same space rules as a word suggestion. The word list uses the same 0.85 strong cut-off as iPhone Hex, plus a reviewed “joy” → 😂 and a reviewed exclusion list (number words that name clock faces, and ordinary words that name an emoji’s object in another sense), generated from the iOS keyboard’s emoji index (Unicode emoji-test 18.0 and CLDR 49, plus Hex’s chat words) by build-emoji-suggestions.py. It is a 10 KB asset (828 words), read lazily only while the toggle is on; the loader keeps only emoji the device’s Paint.hasGlyph can draw (minSdk 31 draws up to Emoji 13.1), so the strip never shows tofu. The same group has Keyboard tools (off): while the strip has nothing else to show (no suggestions, Undo dictation, notice or dictation), its Hold Hex to talk hint becomes up to four buttons — emoji, paste, Hex’s Keyboard settings and undo of the last autocorrection — without making the keyboard taller. A field with no text either side of the cursor shows them in place of the sentence-start words the strip would otherwise offer, so they are there as soon as an empty field opens; typing anything brings predictions back, and switching the toggle swaps the two at once while the field is empty; a word being typed, a swipe’s readings or a word Delete took back keep their line. The emoji button appears only on the letters page, where the keys’ own emoji key is; a symbol page or a number, phone or date pad has none. Paste uses the editor’s own paste and appears only while the clipboard has something, and password and PIN fields show none. Undo appears only while the last autocorrection is still right before the cursor, and only when no next-word suggestions fill the strip; the Delete right after an autocorrection still undoes it when they do. Settings reopens Hex on its Keyboard page, replacing whatever Hex screen was open. The same group has Smart quotes (off): in a plain-text field (not a password, email or URL field, or a TYPE_NULL field such as a terminal), the ' and " keys type ’ ‘ “ ”. An opening quote — ‘ or “ — goes in at the start, after whitespace, or after an opening bracket or quote; the closing quote or apostrophe — ’ or ” — goes in after anything else. A word picked from the strip, autocorrected or swiped goes in with ’ for its apostrophe (“don’t”), your own text replacements get ’ for each straight apostrophe they contain (a " in one stays straight), and a dictation’s straight quotes are placed by the same rules, after its spacing is decided, in the same plain-text fields as the keys. The strip shows the ’ a suggestion will insert. The Italian and French elisions the keyboard section above describes (“laltro” gives “l’altro”) go in with ’ too. A quote key’s held alternates still type exactly what they show. With the toggle off, keys, picks and dictation insert the straight characters they always did, and existing ’ and ” are treated like ' and " for word boundaries, spacing and lookups. The same group has Delete swiped words letter by letter (off), as iPhone Hex's experiment: Delete right after a swipe removes one letter instead of taking the word back, and the swipe is forgotten with it, so the strip stops offering the word, the next swipe there is a new word, and what's left is ordinary text. Held, Delete repeats letter by letter from the first; its slide still selects whole words. Off, Delete takes the swiped word back as before. The same group has Password manager suggestions (off): while Android’s autofill service — Bitwarden, 1Password or Google Password Manager, which must itself support Android 11’s inline suggestions — offers logins, one-time codes or cards for the focused field, its own chips take the word suggestions’ place in the strip: up to six, in the service’s order, the pinned ones held at the edge outside the scroll. Tapping one lets Android fill the field: Hex lays the service’s views out and never reads a login, a code or a card, and nothing is logged or sent. A new field, the keyboard hiding or the toggle turning off clears them. Off, Hex makes no inline request, so Android’s own autofill dropdown is exactly as before. Keyboard › Spatial autocorrect controls tap-based correction; it starts on to preserve existing Android behavior. Turning it off keeps dictionary completions and the fixed English typo/contraction rules; turning off Keyboard › Autocorrect disables all automatic replacements, while the strip still offers the corrections and near words as plain words to tap (Gboard keeps its suggestions too).

Privacy › Privacy policy opens the Android policy text even in airplane mode.

Labs › Diagnostics (Hex Preview and debug builds, never the Play release) makes a plain-text report that a tester copies and pastes wherever they like. Nothing runs until a button on the page is tapped, and nothing is sent. The report has the build, the phone's maker, model, Android version, public build number and security patch, total and available memory, the processor's cores as the kernel rates them (cpu_capacity, top frequency), the thread count and speech library ("standard" or "faster") Hex picks, whether the downloaded model is installed, the haptics switches and what the vibrator supports. It holds nothing typed or said, no identifiers and no list of apps. Speed test transcribes a bundled 11 s English clip (whisper.cpp's public-domain samples/jfk.wav, shipped only in those builds) twice each way, each row named by what it does so reports from different builds read the same: "new threads every graph" (ggml's default, a new pool for each encoder pass and each token); "threads kept ready, any core" (a pool made with the model, a patch); "threads kept ready, fast cores" (that pool kept on the cores the kernel rates at least half the strongest, shown only where Hex can tell them apart); and, where the kernel rates six or more cores fast, "threads kept ready, 6". The row a dictation uses in that build is marked "(what dictation uses)". The Speech line says where dictation's threads are kept ("dictation threads: 4 kept ready on cpu 4-7", or "on any core" when Hex can't tell the cores apart or the kernel refuses to pin them), and each run and the last dictation say where theirs were, read back from the decoding thread. It runs in the app, or, after Run in the keyboard, the next time the keyboard opens in another app's field. The keyboard and the app share one process, so that second run measures the scheduling a dictation gets. Each run reports wall and processor time, the encoder and decoder time (whisper.cpp's own timings, read through a patch), the thread's cpuset, cgroups and allowed cores (said once when every run shares them), the cores it ran on, and, sampled every 150 ms during the run, each cluster's clock range and the share of samples below its top frequency, so a clock cap shows up. Last dictation shows how long the last real dictation's steps took, kept in memory only until Hex's process ends, with nothing said or typed: where it was made (the keyboard or Home), seconds recorded and kept after the trim, the threads and encoder window, where the model was at ✓ (already loaded, loaded while the person spoke, still loading, or loaded after ✓), the ms after ✓ at which recording stopped, the decode started and finished and the text went in, whisper.cpp's encoder, decoder and prompt time, and the process's processor time against the decode's wall time. The speed test never replaces it. The haptics part says what Android's settings and the vibrator report, what each of Hex's taps resolves to on the phone (Tap.plays, the decision tap() uses), and how many taps Hex asked the vibrator for and how many its settings stopped since Hex last started (counted in memory). Tap through the vibrator plays a key press's tap through KeyHaptics and its one gate, Hex's Haptics switch, Tap the way Android does for keyboards plays Android's own KEYBOARD_TAP, and Stronger pulse plays an 80 ms full-strength pulse on the touch channel without Hex's gates.

Send feedback

Home’s Send feedback opens a form: Problem, Idea, Question or Other (Other sends no category), an optional subject, the message, up to five pictures and an optional email. Nothing is sent until Send. Then the app makes one multipart POST https://api.blhp.app/v1/feedback to Bellhop, Anomaly’s feedback inbox, with HttpURLConnection and a hand-built body, following Bellhop’s checklist: upload progress; an Idempotency-Key made at the tap and reused for every retry; network failures and 5xx retried with the same body after 1, 2 and 4 s; 409 request_pending and 429 retried after Retry-After (up to a minute), no other 4xx; limits and the email’s shape checked before sending. 401 and 403 feedback_disabled show feedback as unavailable and log a warning (debug builds; R8 strips every android.util.Log call from release and preview).

The first picture is Hex’s own window, drawn with PixelCopy just before the form opens, never the screen, the keyboard or another app; Home’s dictation result is painted over first, so no transcript leaves the phone. More come from Android’s photo picker (no permission). Every picture is re-encoded as JPEG at 80% with the longest side at most 2048 px. With an email, the request carries it and a random install ID kept in the app’s preferences (made at the first such send); without one it is anonymous: no email, install ID or user. Metadata is the screen, the channel (play or preview), the speech model and the dictation language. Dictations, transcripts, recordings, vocabulary and corrections are never sent, and the keyboard has none of this.

The report key is the Gradle property hexFeedbackKey (in gradle.properties; publishable, it can only send feedback to Hex), surfaced as BuildConfig.FEEDBACK_KEY. A build without it has no Send feedback. Debug builds log each request without the key (adb logcat -s HexFeedback), and am start -n ly.anoma.hex/.MainActivity --ez feedback_drop_first_response true loses the first answer to show the retry returns the same issue.

Phase 4 verification

On identical held-out synthetic taps and unchanged English and Spanish iOS models, Android’s English word error rate fell from 10.53% to 7.40%, against 8.39% for iOS R1 without offsets. Spanish was 10.33% against 10.43% for iOS (phase 3 Android: 10.06%). The step-by-step benchmark explains the original 298 extra English errors; the replay table gives raw counts, exact sentences and timing.

The Studio verified Spanish, German and Bokmål suggestions and space-triggered corrections in a separate Android app, including ¿¡, ß and æøå. The German and Bokmål assets were also copied, byte-for-byte, into the iOS typing-model folder in local commit 230a437e. The production Swift reader checked all 95,000 words per language and every stored pair score; no iOS source or existing English/Spanish model changed.

With airplane mode on and Wi-Fi off, fixed audio went through the emulator microphone and Whisper small into that editor. Spanish “Nos vemos mañana en la estación” and German “Wir treffen uns morgen am Bahnhof” matched. Bokmål “Tusen takk for hjelpen” also matched; on corpus clip 40 Hex inserted “Biblioteket stenger tydelig på lørdag” instead of “Biblioteket stenger tidlig på lørdag.” The same Spanish clip also produced a transcript from Home’s Dictate bar.

Five unit tests passed in each of the debug and release variants. Home, the four settings pages and all four detail pages were captured in light and dark. Deselecting Hex as the current keyboard changed Ready to Finish setup · 1 step; selecting it again through setup restored Ready. The local APK, full-size screenshots, replay results and Studio log are under build/phase4-proof/.

How it works

  • App: Kotlin and Jetpack Compose. Welcome → microphone permission and Android’s keyboard settings/picker → a real practice field. Setup reads live system state; it remembers the page, not the words.
  • Keyboard: HexKeyboard is an InputMethodService with native key views. Letters, shift/caps lock, symbols, delete, editor actions and next keyboard use Android input APIs; in a TYPE_NULL editor (a terminal) delete, the space bar’s cursor slide and Enter are key events, since the editor’s text can’t be read or edited. It commits through the active InputConnection; changing editors or hiding the keyboard discards pending results. Password fields allow typing only. Typing lives in KeyboardEngine, which reaches the editor only through KeyboardTextTarget; the views are KeyboardView (strip, keys or Hex menu), StripView and KeyPlaneView; each layout's letters are data in KeyboardLetters. KeyPlaneView turns a letter touch that travels a key's pitch into a swipe and draws its trail (SwipeTyping). While the finger moves, the path is read off the main thread every 70 ms; on lifting it is read on the main thread.
  • Audio: MicCapture records up to 60 s of mono 16 kHz PCM in RAM and releases the microphone before CPU inference. Whisper hears only the speech: from 0.3 s before it to 0.5 s after it; pauses in between stay. Speech is a stretch of voiced 40 ms blocks (RMS above −48 dBFS, the test that also decides “No speech heard”) less than 0.3 s apart with at least 120 ms of voice, so a click, a knock or the tap on ✓ doesn’t count. Quiet around the speech only slowed it down and added stray words: on the Studio, 3 s of speech in a tap that waited for the 1-minute limit took 8.5× as long and ended with an invented “you”; trimmed, it takes as long as the 3 s alone, and the 40 benchmark clips and 15 long ones keep the same text. The recognizer interface operates on that capture and its language/task. A dictation longer than 30 s (more than one Whisper window) is decoded with timestamps, so each window ends at the last sentence it finished and the next starts there; moving on a whole 30 s at a time lost the words across the cut and, in windows full of speech, whole sentences (27 of 457 on 32 clips of 36–58 s in the ten dictation languages; with timestamps, 1, a sentence said twice in a row). Hex requests no audio focus and does not change playback routing.
  • Speed: the model loads when the Hex key goes down, while the person speaks, and stays loaded between dictations; it is freed 2 minutes after the last one or when Android runs short of memory, and nothing runs while it waits. The encoder's window is sized to the speech: up to 8 s, speech plus 3.84 s (at most the earlier 512 frames); longer, speech plus 12.8 s, until that reaches Whisper's full 30 s window (about 16.7 s and more). On 53 long clips in six languages (8.5–30 s) this margin made no clip worse than the full window; at 576 frames and less clips start to lose words, so it isn't lowered without rerunning the long-clip check. On the Studio it took 8–10 s dictations from 2.1 s to 1.6 s and 10–12 s from 2.2 s to 1.7 s (median of three interleaved rounds). The bundled tiny model keeps the full window; shortened, it repeats itself. Inference uses one thread per fast core (at least half the strongest core's cpu_capacity), at most four. On the 40-clip benchmark this cut the emulator's median from 0.76 s to 0.56 s with the same word errors (5.26%). Those threads are made once, when the model opens, and kept with it (a patch) instead of ggml starting and joining a pool for every graph, each encoder pass and each decoded token, threads that often land on little ones; a decode keeps the pool, and the thread running it, on the fast cores, and gives that thread its own affinity back afterwards. A decode may write at most 15 tokens a second of audio plus 16 (Whisper’s own limit is 220 per 30 s window), and one that fails Whisper’s checks is retried once, greedy then 0.2, with one decoder instead of five at each of five temperatures, so a language the model handles badly can’t run on for seconds. ✕ and Home’s Cancel stop a decode in progress (whisper.cpp’s abort callback, asked after each encoder pass and each token), so the next dictation waits at most for the encoder pass under way, not the whole abandoned decode.
  • Type: unmodified InterVariable.ttf from Rasmus Andersson and the Inter Project, v4.1, licensed under SIL OFL 1.1. One Compose font family and native TextView helper cover Hex’s text, including keys, menus, strip labels and tabular digits (tnum). Android supplies missing glyphs; permission dialogs and the system keyboard picker use the OS font. Gradle verifies the bundled TTF’s SHA-256.
  • Licences: OpenAI Whisper weights and whisper.cpp/ggml are MIT. transcribe.cpp, with its ggml, miniz and Silero VAD code, is MIT. Parakeet TDT-CTC 110M's weights are NVIDIA's, CC BY 4.0, converted and quantized to 8 bits by the transcribe.cpp authors; they are not in the APK and download only on request. Kotlin/AndroidX are Apache 2.0; libc++ is Apache 2.0 with LLVM exceptions. Bundled credits and licence texts. No ML Kit or third-party language packs are shipped.

Build and run

Use the Studio’s JDK 21, SDK platform 36, NDK 27.2.12479018 and CMake 3.22.1. The Play packaging checks use Build Tools 36.0.0 and bundletool 1.18.3. From the synced android/ directory, with an ARM64 emulator or phone running:

export JAVA_HOME="/opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk/Contents/Home"
export ANDROID_HOME="$HOME/Library/Android/sdk"
export PATH="$ANDROID_HOME/platform-tools:$JAVA_HOME/bin:$PATH"
./gradlew assembleDebug
./gradlew test
adb install -r app/build/outputs/apk/debug/app-debug.apk
adb shell am start -n ly.anoma.hex/.MainActivity

On the headless Studio, start an ARM64 AVD with -audio none -grpc 8566 -grpc-use-token. inject.py uses the matching emulator discovery record and streams paced mono PCM16 into the guest microphone. Generate the bindings from the SDK emulator’s lib/emulator_controller.proto with grpcio-tools, then put them on PYTHONPATH. No recording or transcript is injected directly into the application.

For the upload bundle, run ./gradlew :app:bundleRelease. Release packaging requires a private properties file at ~/.config/hex-android/keystore.properties or the path in HEX_ANDROID_KEYSTORE_PROPERTIES. It must contain storeFile (relative to that file, or absolute), keyAlias, storePassword and keyPassword. Release uses R8 and resource shrinking and never falls back to the debug key. Gradle writes app/build/outputs/bundle/release/app-release.aab.

Hex Preview (outside Google Play)

Hex Preview is the preview build type: the release build as an APK, application id ly.anoma.hex.preview, named Hex Preview in the launcher and in Android's keyboard list, so it installs beside Hex from Google Play with its own settings, words and speech model. It is signed with its own key (never the Play upload key), read from ~/.config/hex-android-preview/keystore.properties or HEX_ANDROID_PREVIEW_KEYSTORE_PROPERTIES; every build must be, because Android refuses an update signed with any other. The certificate's SHA-256 is 13:35:68:F6:F0:61:4F:E5:7B:C8:8D:AE:CA:32:AF:A7:2C:6A:B7:40:20:26:29:F7:52:FA:A0:33:BE:35:D9:8E.

Its update check lives only in app/src/preview (code, strings); debug and release build app/src/play's empty Updates, which is inlined away, because Google Play forbids an app updating itself. It reads latest.json on the android-preview branch when the app opens and at most once a day when the keyboard opens (never in a password field; Settings › Check for updates automatically). Hex Preview installs nothing itself and asks for no install permission: Download update opens the release's APK on GitHub (latest.json's apk.url, accepted only as a GitHub HTTPS address) in the browser, which downloads it. Opening the download, Android's own installer asks whether to update Hex Preview and accepts only an APK signed with Hex Preview's key; the first time, Android asks once to allow the browser to install apps, and after allowing it the person goes back and taps the download again (Back lands on the browser's downloads, not the installer).

scripts/preview-release.sh publishes a build: the build number is the count of commits up to the built commit of dev, the version name <versionName>-preview.<build>, the tag android-preview-<build> (a pre-release, never moved), and the channel branch android-preview holds only latest.json and the README people land on.

Play Protect, before and after publishing. Scan the dry run's APK (android/build/preview/<build>/HexPreview-*.apk) on the Google Play system image system-images;android-36;google_apis_playstore;arm64-v8a (AVD hex-playprotect-vogel), signed out, with no Google account: start it with emulator -avd hex-playprotect-vogel -port 5760 -no-snapshot -audio none, serve the APK's folder with python3 -m http.server <port> --bind 127.0.0.1, open http://10.0.2.2:<port>/<file> in the emulator's Chrome, install it and accept Scan app. It passes on “This app looks safe” (adb -s emulator-5760 logcat | grep VerifyApps shows JIT scan response: {"verdict":"SAFE"}). After publishing, uninstall it and install the published file fresh from the download button on anoma.ly/hex/android, accepting a scan if one is offered, so Google holds a verdict before people's phones ask; a second fresh install then shows nothing from Play Protect (logcat response=15). The preview must never again declare REQUEST_INSTALL_PACKAGES or UPDATE_PACKAGES_WITHOUT_USER_ACTION: of nine test builds, every one that requested it was judged harmful (POTENTIALLY_UNWANTED, generic_malware) after Google's scan, even with no updater code, and every one without it was safe, which is why updates go through the browser.

Scope: Android 12+ (min API 31), target 36, ARM64, seven typing models and ten dictation languages. See the Play release evidence, listing drafts, phone screenshots and real-device checklist. The Studio also exercised offline fallback, all four styles, per-dictation translation, both appearances and insertion into a separate app with music playing in earlier phases.