Files
LLeMbas-Android/app/src/fdroid/java/eu/llembas/android/wake/Engine.kt
T
HomerandClaude Fable 5.2 374574b9ce
CI / check (push) Canceled after 0s
Wake word: the engine loads, and its state is one truth that is shown
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>
2026-11-12 09:44:49 +00:00

15 lines
564 B
Kotlin

package eu.llembas.android.wake
import android.content.Context
/**
* The F-Droid build has no wake-word engine: F-Droid builds every library from source, and the
* engine (sherpa-onnx, Apache-2.0) comes to the other build as its project's prebuilt Android
* library. Settings says so; everything else about the wake word is the same code in both.
*/
object WakeEngine {
const val AVAILABLE = false
fun create(context: Context, keywords: String): WakeDetector = throw WakeError(WakeFailure.NoEngine, message = "this build has no wake-word engine")
}