Android: add Voice Wake (foreground/always)

This commit is contained in:
Peter Steinberger
2025-12-18 02:08:57 +01:00
parent 6d60224c93
commit 60321352aa
15 changed files with 522 additions and 17 deletions

View File

@@ -48,6 +48,7 @@ class BridgePairingClientTest {
version = "test",
deviceFamily = "Android",
modelIdentifier = "SM-X000",
caps = null,
),
)
assertTrue(res.ok)
@@ -95,6 +96,7 @@ class BridgePairingClientTest {
version = "test",
deviceFamily = "Android",
modelIdentifier = "SM-X000",
caps = null,
),
)
assertTrue(res.ok)

View File

@@ -67,6 +67,9 @@ class BridgeSessionTest {
token = null,
platform = "Android",
version = "test",
deviceFamily = null,
modelIdentifier = null,
caps = null,
),
)
@@ -129,6 +132,9 @@ class BridgeSessionTest {
token = null,
platform = "Android",
version = "test",
deviceFamily = null,
modelIdentifier = null,
caps = null,
),
)
connected.await()
@@ -196,6 +202,9 @@ class BridgeSessionTest {
token = null,
platform = "Android",
version = "test",
deviceFamily = null,
modelIdentifier = null,
caps = null,
),
)
connected.await()

View File

@@ -0,0 +1,26 @@
package com.steipete.clawdis.node.voice
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
class VoiceWakeCommandExtractorTest {
@Test
fun extractsCommandAfterTriggerWord() {
val res = VoiceWakeCommandExtractor.extractCommand("Claude take a photo", listOf("clawd", "claude"))
assertEquals("take a photo", res)
}
@Test
fun extractsCommandWithPunctuation() {
val res = VoiceWakeCommandExtractor.extractCommand("hey clawd, what's the weather?", listOf("clawd"))
assertEquals("what's the weather?", res)
}
@Test
fun returnsNullWhenNoCommandProvided() {
assertNull(VoiceWakeCommandExtractor.extractCommand("claude", listOf("claude")))
assertNull(VoiceWakeCommandExtractor.extractCommand("hey claude!", listOf("claude")))
}
}