Wake word: the engine loads, and its state is one truth that is shown
CI / check (push) Canceled after 0s

The model was read from the APK with AssetManager.openFd, which throws for a
compressed asset; the assets were compressed, runCatching swallowed it, and
the engine never loaded on any phone.

- The model is copied out by stream, keyed by a version file the fetch
  script writes (a hash of the pinned model); onnx assets are stored.
- WakeState (Off, Starting, Listening, Paused, Failed) in one StateFlow that
  the service, its notification and Settings read. onStartCommand no longer
  posts the default phrase; the notification is written from the state only.
- WakeListener holds the loop apart from Android: an engine that does not
  load and a microphone that does not start or stops are Failed states with
  a reason, logged, retried with back-off; a new phrase cancels and joins the
  old loop before the engine is released.
- A keywords line is checked against tokens.txt before the engine sees it
  (the engine exits the process on an unknown piece).
- The service is not started without the microphone permission, and the app
  looks again each time it comes to the screen.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-11-12 09:44:49 +00:00
1 parent 2d38ccd321
commit 374574b9ce
24 files changed
+1154 -151

No files matched your search

+10 -1
View File
@@ -435,11 +435,20 @@ STRINGS: dict[str, str] = {
"wake_word_privacy": "Nothing leaves the phone before the word. The microphone's sound goes only to the wake-word engine on the phone and is not kept, and the notification stays up the whole time it listens. The phrases are English; the engine is sherpa-onnx (open source).",
"wake_word_cost": "It costs battery: the microphone stays on and the phone's processor checks every moment of sound, without the low-power chip the built-in assistant uses. It pauses in battery saver, while the assistant is open and, unless you change it, with the screen off. After a restart, tap its notification to start it again.",
"wake_listening_for": "Listening for “%1$s”",
"wake_off": "The wake word is not listening",
"wake_tap_to_start": "Tap to start it again. If Android asks, allow the microphone.",
"wake_starting": "Starting the wake word…",
"wake_paused_silent": "Wake word hears nothing: another app has the microphone, or the phone's microphone is switched off",
"wake_failed_no_engine": "Wake word is not working: this build has no engine",
"wake_failed_model": "Wake word is not working: its model could not be unpacked on this phone",
"wake_failed_engine": "Wake word is not working: the engine did not start",
"wake_failed_microphone": "Wake word is not working: the microphone did not start",
"wake_failed_line": "It is not listening. It tries again by itself.",
"wake_notification_line": "Nothing leaves the phone until you say it.",
"wake_paused_screen": "Wake word paused: the screen is off",
"wake_paused_battery": "Wake word paused: battery saver is on",
"wake_paused_assistant": "Wake word paused while the assistant is open",
"wake_paused_microphone": "Wake word paused: the microphone or the engine is not available",
"wake_paused_microphone": "Wake word paused: LLeMbas is not allowed to use the microphone",
"wake_stop": "Stop listening",
"wake_heard": "Heard you. Tap to ask.",
"wake_resume": "Listen for the wake word again",