hex/android/app/src/main
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel da409afb25
Android: Labs › Pick the English model for this phone (off, draft) (#2831)
* Android: Labs › Pick the English model for this phone (off)

Hex measures real dictations and, where English dictation is slow on the
phone, chooses faster English dictation for it (Ryan's decision; plan in
hex-android-model-by-phone-rule-plan.md, L135). Behind a new Labs switch,
off by default; whether it becomes the default, and every word, is Ryan's.

What it measures: only while faster English dictation is off, each
dictation that went in and would go to the faster model were it on
(English, not translated, Automatic with one candidate), on the standard
model, with at least 6 s kept, the model loaded before the tick (already
loaded, or loaded while the person spoke: the decode's wall time then
holds no load) and no second decode without the custom words. Its number
is decode wall time per second kept. MicCapture hands each dictation's
durations to Recognizer.timed; ModelChoice.after is the one place it
decides: median of the last 5 at least 0.5, and the last 20 dictations
all English-routable. One way: once chosen it never decides again.

What it does: the keyboard only records. MainActivity.onResume
(ModelChoice.whenOpened) turns faster English dictation on and starts its
135 MB download. Turning faster English dictation off by hand, or Delete
download, sets fastEnglishOffByHand, and the rule never turns it on again.

Changed behaviour: the 135 MB model is now Wi-Fi-first like the 190 MB
one, whoever asked for it. On a metered network a Labs tap no longer
downloads at once: its row says "135 MB. Starts by itself on Wi-Fi." with
Use mobile data, and Wi-Fi coming back starts it.

What it keeps: the private "modelChoice" preferences (the last 5 ratios,
English dictations in a row up to 20, counts by reason, the choice's
date and median), numbers only; turning the lab off deletes the file and
leaves a setting or download it made. Diagnostics gets a "Model choice:"
line (median, count, threshold, decision and date, N of 20 in a row,
counts not counted by reason). Dictation's speech model card says what is
true while it waits, downloads and once ready. Privacy page (both
copies), policy and site say what is kept (proposals for Ryan).
Debug builds only: setprop log.tag.HexDecodeScale DEBUG (x10) or VERBOSE
(x0.5) scales the measured time.

Verified on anomastudio (OpenJDK 21, SDK 36): testDebugUnitTest passed
362 tests, 0 failures (ModelChoiceTest's 17 among them, with the OnePlus
12's two reports); the R8-minified release and preview dex contain no
"HexDecodeScale" (the debug dex does). Emulator hex-modelrule-vogel (API
36): lab off stores nothing; fast dictations (median 0.30) and one 3.11
outlier don't decide; a Spanish and a translated dictation reset the row;
slow ones decide on the 20th in a row with no download from the keyboard;
on 5G it waits, Wi-Fi starts it, the next dictation runs on faster
English dictation and the rule stops measuring; low memory falls back;
Delete download keeps it off across restarts; a hand tap on 5G waits and
Use mobile data downloads; the lab off deletes the numbers and leaves
the download. Chinese screens checked.

* Android: review fixes for Pick the English model for this phone

From the faster-English helper's review of #2831:

- Turning the lab on clears fastEnglishOffByHand. It is a new request, so
  someone who tried faster English dictation before the lab existed and
  turned it off no longer gets a lab that silently measures nothing.
  Turning faster English dictation off, or Delete download, after that is
  still kept for good (ModelChoice.offByHandWhenLabTurned and
  offByHandWhenFasterEnglishTurned, used by the Labs rows).
- The site's privacy text moves to its own pull request (#2832), to be
  merged when the build that carries the lab is published; dev.anoma.ly
  would otherwise describe a lab no published build has. The in-app
  policy and both Privacy page copies stay here.
- Diagnostics' "Model choice:" line lists the last five ratios beside the
  median, so a pasted report shows a steady set from a spread.
- Tests of behaviour rather than shape: ModelStore.download now asks
  startsNow, which the mobile-data test exercises for both models; the
  test that re-tested engineFor is removed (MicCapture has no JVM seam:
  it needs Android's Looper and AudioRecord), and whenOpened loses its
  onScreen parameter, which no caller passed, with its test. Added: the
  OnePlus 13's 0.54-0.68 deciding and the emulator's 0.37 never
  deciding, as sequences of real-length dictations.

Verified on anomastudio: testDebugUnitTest 365 tests, 0 failures
(ModelChoiceTest 20). Emulator hex-modelrule-vogel: Delete download set
the off by hand; turning the lab on cleared it; five slow (x10) and
fifteen short English dictations decided (ratios 2.91, 2.52, 2.80, 2.86,
2.88, as Diagnostics now lists them); opening Hex turned faster English
dictation on and downloaded it on Wi-Fi.

* Docs: the feature map counts ModelChoiceTest's 20 tests after the review fixes

Documentation only; the count is from the 3af9e292f run (365 tests, 0 failures).
2026-11-25 08:37:37 -05:00
..
assets android: Português typing (Brazilian model, accent holds, autocorrect, suggestions, swipe) (#2780) 2026-11-24 19:06:14 -05:00
cpp android: Labs › Automatic listens for the language (off) (#2770) 2026-11-24 22:12:05 -05:00
java/ly/anoma/hex Android: Labs › Pick the English model for this phone (off, draft) (#2831) 2026-11-25 08:37:37 -05:00
res Android: Labs › Pick the English model for this phone (off, draft) (#2831) 2026-11-25 08:37:37 -05:00
AndroidManifest.xml android: nothing Hex keeps goes to a new phone (data extraction rules) (#2808) 2026-11-25 08:37:27 -05:00