Wake word: Stop's start id counts too, so the service still ends after it
CI / check (push) Canceled after 0s

The service stops itself by the newest start id it was given; without
Stop's own id that call would have been ignored after a tap on Stop.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Fable 5.2 committed 2026-11-12 10:40:22 +00:00
1 parent 5fcc158763
commit d30b74e1a4
1 file changed
+2 -1
@@ -103,6 +103,8 @@ class WakeWordService : LifecycleService() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
super.onStartCommand(intent, flags, startId)
// Every start counts, Stop's too: the service stops itself by the newest one it was given.
lastStart = startId
if (intent?.action == ACTION_STOP) {
// Stop is the setting going off; the loop sees it and ends the service on the path
// that has shown its notification first (follow). The service is stopped from here
@@ -114,7 +116,6 @@ class WakeWordService : LifecycleService() {
}
return START_NOT_STICKY
}
lastStart = startId
mayRecord.value = micAllowed(this)
val running = following?.isActive == true
// The notification first: Android stops a foreground service that is slow to show one.