Skip to content

Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.

Fixed wake word ack, animation, long-press; tests pass.

Rishabh Bajpai2f09347c3c31
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0fe0301..177e74b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,21 @@ All notable changes to Gotcha are documented here.
## [Unreleased]
+### Changed — Wake word & call-mode feel (#25)
+
+- **The wake-word acknowledgment is now one short word.** Saying "Hey Gotcha"
+ used to reply with the full "Call started. I'm ready when you are." sentence,
+ which made the wake word feel ignored and delayed the mic opening. It now
+ answers with a single "Yes?" (translated per language) and the mic opens
+ sooner. Normal long-press calls get a tighter "Call started. Go ahead."
+- **The ball now visibly reacts when the wake word fires.** It gives a quick
+ scale bounce while an accent ring radiates from it on its own overlay window,
+ so the pulse still plays after the ball is hidden by the call window. Respects
+ the system "remove animations" preference.
+- **Long-press to start a call is 1 second instead of 2.** The hold-to-call
+ gesture on the floating ball was reduced from 2000 ms to 1000 ms; the
+ expanding ring that previews it stays in sync.
+
### Fixed — Malformed tool call no longer bricks the chat (#13)
- **A tool call with invalid `arguments` JSON can no longer poison a chat.** When
diff --git a/app/src/main/java/com/gotcha/i18n/SpokenPhrases.kt b/app/src/main/java/com/gotcha/i18n/SpokenPhrases.kt
index 92993fa..40daf4c 100644
--- a/app/src/main/java/com/gotcha/i18n/SpokenPhrases.kt
+++ b/app/src/main/java/com/gotcha/i18n/SpokenPhrases.kt
@@ -16,6 +16,10 @@ object SpokenPhrases {
fun callStarted(lang: Language): String = callStartedPhrases[lang] ?: callStartedPhrases.getValue(Language.ENGLISH)
+ /** Short attention-getter spoken when a wake-word ("Hey Gotcha") call starts. */
+ fun wakeWordAcknowledged(lang: Language): String =
+ wakeWordAcknowledgedPhrases[lang] ?: wakeWordAcknowledgedPhrases.getValue(Language.ENGLISH)
+
fun confirmationNeeded(lang: Language): String =
confirmationNeededPhrases[lang] ?: confirmationNeededPhrases.getValue(Language.ENGLISH)
@@ -95,15 +99,32 @@ object SpokenPhrases {
)
private val callStartedPhrases: Map<Language, String> = mapOf(
- Language.ENGLISH to "Call started. I'm ready when you are.",
- Language.SPANISH to "Llamada iniciada. Estoy listo cuando quieras.",
- Language.FRENCH to "Appel démarré. Je suis prêt quand vous voulez.",
- Language.GERMAN to "Anruf gestartet. Ich bin bereit, wenn du es bist.",
- Language.HINDI to "कॉल शुरू हो गई है। जब आप तैयार हों, बताइए।",
- Language.JAPANESE to "通話を開始しました。準備ができたら教えてください。",
- Language.CHINESE to "通话已开始,准备好后请告诉我。",
- Language.ITALIAN to "Chiamata iniziata. Sono pronto quando vuoi.",
- Language.PORTUGUESE to "Chamada iniciada. Estou pronto quando você quiser."
+ Language.ENGLISH to "Call started. Go ahead.",
+ Language.SPANISH to "Llamada iniciada. Puedes hablar.",
+ Language.FRENCH to "Appel démarré. À vous.",
+ Language.GERMAN to "Anruf gestartet. Los geht's.",
+ Language.HINDI to "कॉल शुरू हो गई है। बोलिए।",
+ Language.JAPANESE to "通話を開始しました。どうぞ。",
+ Language.CHINESE to "通话已开始,请说话。",
+ Language.ITALIAN to "Chiamata iniziata. Vai pure.",
+ Language.PORTUGUESE to "Chamada iniciada. Pode falar."
+ )
+
+ /**
+ * The user already announced themselves with the wake word, so the
+ * acknowledgment is a single word — anything longer makes the wake word
+ * feel like it was ignored and delays the mic opening.
+ */
+ private val wakeWordAcknowledgedPhrases: Map<Language, String> = mapOf(
+ Language.ENGLISH to "Yes?",
+ Language.SPANISH to "¿Dime?",
+ Language.FRENCH to "Oui ?",
+ Language.GERMAN to "Ja?",
+ Language.HINDI to "हाँ?",
+ Language.JAPANESE to "はい?",
+ Language.CHINESE to "嗯?",
+ Language.ITALIAN to "Sì?",
+ Language.PORTUGUESE to "Sim?"
)
private val confirmationNeededPhrases: Map<Language, String> = mapOf(
diff --git a/app/src/main/java/com/gotcha/service/AssistiveBallService.kt b/app/src/main/java/com/gotcha/service/AssistiveBallService.kt
index 1229c9f..232669c 100644
--- a/app/src/main/java/com/gotcha/service/AssistiveBallService.kt
+++ b/app/src/main/java/com/gotcha/service/AssistiveBallService.kt
@@ -37,7 +37,7 @@ import java.io.File
/**
* Foreground service that hosts the floating assistive ball over other apps.
*
- * When idle, the ball is shown. Long-press the ball (3s) to start a voice call.
+ * When idle, the ball is shown. Long-press the ball (1s) to start a voice call.
* During a call, the ball is hidden and replaced by three floating draggable
* glass buttons (Mic, Stop, End). The buttons let the user push-to-talk,
* interrupt the agent, or end the call. It owns its own STT/TTS engines
@@ -872,6 +872,9 @@ class AssistiveBallService : Service() {
vibrate = s.notifyVibrationEnabled,
chime = false
)
+ // The call hides the ball almost immediately, so the visual ack has to
+ // be kicked off before it starts — see AssistiveBallOverlay.playWakeAnimation.
+ overlay.playWakeAnimation()
callController.startWakeWordCall()
}
diff --git a/app/src/main/java/com/gotcha/service/CallSessionController.kt b/app/src/main/java/com/gotcha/service/CallSessionController.kt
index 7ed034e..930f6c6 100644
--- a/app/src/main/java/com/gotcha/service/CallSessionController.kt
+++ b/app/src/main/java/com/gotcha/service/CallSessionController.kt
@@ -205,7 +205,7 @@ class CallSessionController(
_state.value = CallState.STARTING
scope.launch {
val language = Language.fromLabel(s.preferredLanguage)
- if (!speakText(SpokenPhrases.callStarted(language), language)) {
+ if (!speakText(startGreeting(handsFree, language), language)) {
reportError("Couldn't play voice audio — check your Text-to-Speech settings.")
}
_state.value = CallState.READY
@@ -213,6 +213,22 @@ class CallSessionController(
return true
}
+ /**
+ * The first thing the user hears when a call starts. A wake-word call gets
+ * the short single-word acknowledgment ([SpokenPhrases.wakeWordAcknowledged])
+ * — the user just said "Hey Gotcha", so a full "call started" sentence makes
+ * the wake word feel ignored and delays the mic opening. A normal long-press
+ * call gets [SpokenPhrases.callStarted], which tells them the PTT session is
+ * live. [handsFree] is already true by the time [startWakeWordCall] reaches
+ * [startCall].
+ */
+ internal fun startGreeting(handsFree: Boolean, language: Language): String =
+ if (handsFree) {
+ SpokenPhrases.wakeWordAcknowledged(language)
+ } else {
+ SpokenPhrases.callStarted(language)
+ }
+
fun startWakeWordCall(): Boolean {
handsFree = true
autoEndOnReply = true
diff --git a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
index 7e870f4..d0816fa 100644
--- a/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
+++ b/app/src/main/java/com/gotcha/ui/AssistiveBallOverlay.kt
@@ -98,6 +98,10 @@ class AssistiveBallOverlay(context: Context) {
private var statusRingAnimator: ValueAnimator? = null
private var activity: BallActivity = BallActivity.IDLE
+ /** One-shot wake-word pulse: an expanding ring that survives the ball hiding. */
+ private var wakePulseView: View? = null
+ private var wakePulseAnimator: ValueAnimator? = null
+
/** What the card is showing, so a theme change can rebuild it as it was. */
private var cardMessage: String? = null
private var cardShowClose: Boolean = true
@@ -288,6 +292,7 @@ class AssistiveBallOverlay(context: Context) {
dockAnimator = null
removeLongPressRing()
removeStatusRing()
+ removeWakePulseRing()
removeMenu()
removeCard()
removeDismissTarget()
@@ -828,6 +833,89 @@ class AssistiveBallOverlay(context: Context) {
statusRingDrawable = null
}
+ /**
+ * Flash the ball when the wake word fires.
+ *
+ * A wake-word call hides the ball almost immediately (the call window takes
+ * its place), so the feedback has to outlive that: the ball gives a quick
+ * scale bounce, and an expanding accent ring — its own window, not a child
+ * of the ball — radiates from where the ball was and keeps playing even
+ * after the ball is hidden. No-op under the "remove animations" preference.
+ */
+ fun playWakeAnimation() {
+ mainHandler.post {
+ val view = ballView ?: return@post
+ if (!animationsEnabled(appContext)) return@post
+ ValueAnimator.ofFloat(1f, WAKE_BALL_PULSE_SCALE, 1f).apply {
+ duration = WAKE_BALL_PULSE_MS
+ interpolator = AccelerateDecelerateInterpolator()
+ addUpdateListener { anim ->
+ val scale = anim.animatedValue as Float
+ view.scaleX = scale
+ view.scaleY = scale
+ }
+ start()
+ }
+ showWakePulseRing()
+ }
+ }
+
+ private fun showWakePulseRing() {
+ removeWakePulseRing()
+ val density = appContext.resources.displayMetrics.density
+ val ballPx = dp(BALL_SIZE_DP)
+ val viewSize = dp(WAKE_PULSE_WINDOW_DP)
+ val accent = accentColor()
+ val drawable = RingDrawable().apply {
+ fillColor = Color.TRANSPARENT
+ strokeColor = accent
+ strokeWidth = WAKE_PULSE_STROKE_DP * density
+ }
+ val view = View(appContext).apply { background = drawable }
+ val params = WindowManager.LayoutParams(
+ viewSize,
+ viewSize,
+ overlayType(),
+ WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE or
+ WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
+ WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
+ PixelFormat.TRANSLUCENT
+ ).apply {
+ gravity = Gravity.TOP or Gravity.START
+ x = ballParams.x + ballPx / 2 - viewSize / 2
+ y = ballParams.y + ballPx / 2 - viewSize / 2
+ }
+ try {
+ windowManager.addView(view, params)
+ wakePulseView = view
+ } catch (_: Exception) {
+ wakePulseView = null
+ return
+ }
+ wakePulseAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
+ duration = WAKE_PULSE_MS
+ interpolator = AccelerateDecelerateInterpolator()
+ addUpdateListener { anim ->
+ val p = anim.animatedValue as Float
+ drawable.ringRadius = ballPx * (WAKE_PULSE_START_RADIUS + p * WAKE_PULSE_RADIUS_GROWTH)
+ drawable.strokeColor = ColorUtils.setAlphaComponent(accent, ((1f - p) * 255).toInt())
+ }
+ addListener(object : android.animation.AnimatorListenerAdapter() {
+ override fun onAnimationEnd(animation: android.animation.Animator, isReverse: Boolean) {
+ removeWakePulseRing()
+ }
+ })
+ start()
+ }
+ }
+
+ private fun removeWakePulseRing() {
+ wakePulseAnimator?.cancel()
+ wakePulseAnimator = null
+ wakePulseView?.let { safeRemove(it) }
+ wakePulseView = null
+ }
+
private fun showLongPressRing() {
removeLongPressRing()
val density = appContext.resources.displayMetrics.density
@@ -1214,7 +1302,20 @@ class AssistiveBallOverlay(context: Context) {
/** Room for the aura to fade out as a circle inside a square window. */
const val STATUS_RING_WINDOW_SCALE = 2.6f
- const val LONG_PRESS_START_MS = 2000L
+ // Wake-word visual feedback. The ball bounces in place while an accent
+ // ring radiates from it on its own window (so the pulse survives the
+ // ball being hidden the moment the call starts).
+ const val WAKE_BALL_PULSE_MS = 320L
+ const val WAKE_BALL_PULSE_SCALE = 1.22f
+ const val WAKE_PULSE_MS = 520L
+ const val WAKE_PULSE_START_RADIUS = 0.5f
+ const val WAKE_PULSE_RADIUS_GROWTH = 1.15f
+ const val WAKE_PULSE_STROKE_DP = 3f
+
+ /** Big enough for the ring's largest radius without clipping. */
+ const val WAKE_PULSE_WINDOW_DP = 200
+
+ const val LONG_PRESS_START_MS = 1000L
const val LONG_PRESS_END_MS = 2000L
const val DISMISS_TARGET_SIZE_DP = 64
const val DISMISS_TARGET_MARGIN_DP = 32
diff --git a/app/src/test/java/com/gotcha/i18n/SpokenPhrasesTest.kt b/app/src/test/java/com/gotcha/i18n/SpokenPhrasesTest.kt
index 97fc4de..8ec8351 100644
--- a/app/src/test/java/com/gotcha/i18n/SpokenPhrasesTest.kt
+++ b/app/src/test/java/com/gotcha/i18n/SpokenPhrasesTest.kt
@@ -45,6 +45,31 @@ class SpokenPhrasesTest {
}
}
+ @Test
+ fun `every language has a non-blank wakeWordAcknowledged phrase`() {
+ for (lang in Language.entries) {
+ assertTrue(SpokenPhrases.wakeWordAcknowledged(lang).isNotBlank())
+ }
+ }
+
+ @Test
+ fun `wakeWordAcknowledged is shorter than callStarted in every language`() {
+ for (lang in Language.entries) {
+ assertTrue(
+ "wakeWordAcknowledged(${lang.label}) should be the short ack, not the call-started sentence",
+ SpokenPhrases.wakeWordAcknowledged(lang).length <= SpokenPhrases.callStarted(lang).length
+ )
+ }
+ }
+
+ @Test
+ fun `no non-English language returns the English wakeWordAcknowledged phrase`() {
+ val english = SpokenPhrases.wakeWordAcknowledged(Language.ENGLISH)
+ for (lang in Language.entries - Language.ENGLISH) {
+ assertNotEquals(english, SpokenPhrases.wakeWordAcknowledged(lang))
+ }
+ }
+
@Test
fun `every language has a non-blank confirmationNeeded phrase`() {
for (lang in Language.entries) {
diff --git a/app/src/test/java/com/gotcha/service/CallSessionControllerTest.kt b/app/src/test/java/com/gotcha/service/CallSessionControllerTest.kt
index 4c2a6e7..bb346b3 100644
--- a/app/src/test/java/com/gotcha/service/CallSessionControllerTest.kt
+++ b/app/src/test/java/com/gotcha/service/CallSessionControllerTest.kt
@@ -8,6 +8,8 @@ import com.gotcha.audio.TtsEngine
import com.gotcha.data.LlmProvider
import com.gotcha.data.Settings
import com.gotcha.data.SettingsRepository
+import com.gotcha.i18n.Language
+import com.gotcha.i18n.SpokenPhrases
import com.gotcha.testsupport.FakeAndroidKeyStore
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -229,6 +231,28 @@ class CallSessionControllerTest {
assertTrue(failed.contains("could not be captured"))
}
+ @Test
+ fun `wake-word calls speak the short acknowledgment instead of the call-started sentence`() {
+ val greeting = controller.startGreeting(handsFree = true, Language.ENGLISH)
+ assertTrue(
+ "A wake-word call must use the short acknowledgment, not the call-started sentence",
+ greeting == SpokenPhrases.wakeWordAcknowledged(Language.ENGLISH)
+ )
+ assertTrue(
+ "A wake-word call must not announce itself like a normal call",
+ greeting != SpokenPhrases.callStarted(Language.ENGLISH)
+ )
+ }
+
+ @Test
+ fun `normal calls speak the call-started sentence`() {
+ val greeting = controller.startGreeting(handsFree = false, Language.ENGLISH)
+ assertTrue(
+ "A normal call must speak the call-started sentence",
+ greeting == SpokenPhrases.callStarted(Language.ENGLISH)
+ )
+ }
+
@Test
fun `hands-free input waits for a pending question and never for a confirmation overlay`() {
// Call-started announcement done → READY means "awaiting spoken input".
diff --git a/docs/wake-word-handoff.md b/docs/wake-word-handoff.md
index f07d7ea..ea6b83b 100644
--- a/docs/wake-word-handoff.md
+++ b/docs/wake-word-handoff.md
@@ -31,8 +31,8 @@ while reusing the current `CallSessionController` voice-call path.
- **Auto-end after the task:** `CallSessionController.startWakeWordCall()`
plus the `autoEndOnReply` flag, so a wake-word-triggered call ends after
the spoken reply while ordinary calls keep the existing stay-open behavior.
-- **Hands-free wake-word calls:** after the "call started" announcement the
- microphone opens itself; a voice-activity detector
+- **Hands-free wake-word calls:** after the short wake-word acknowledgment
+ ("Yes?") the microphone opens itself; a voice-activity detector
(`audio/SilenceDetector.kt`) stops it after ~3 s of silence (API STT, via a
new `AudioRecord` + WAV path in `SttEngine.listenForUtterance`; ~2 s
platform end-of-speech hint for the Android provider). The transcript then
@@ -71,8 +71,8 @@ custom TFLite classifier).
## Manual device-verification checklist
-- [ ] Ball on, microphone granted, wake word on; say "Hey Gotcha" — call
- starts, "call started" announced, **mic opens by itself**, reply spoken,
+- [ ] Ball on, microphone granted, wake word on; say "Hey Gotcha" — the ball
+ pulses, a short "Yes?" is spoken, **mic opens by itself**, reply spoken,
call auto-ends.
- [ ] Speak, pause >3 s (API STT) — mic stops on its own and the turn sends.
- [ ] Keep speaking — mic stays open (no early cut-off).
diff --git a/docs/wake-word.md b/docs/wake-word.md
index 7c5e128..f2f78e0 100644
--- a/docs/wake-word.md
+++ b/docs/wake-word.md
@@ -49,7 +49,7 @@ corresponds to the model card's balanced threshold of 0.50.
A wake-word-triggered call is **hands-free**, not push-to-talk:
-1. The wake word starts the call and the "call started" phrase is spoken.
+1. The wake word starts the call and a short acknowledgment ("Yes?") is spoken.
2. The microphone **opens automatically** once that announcement finishes.
3. A voice-activity detector listens for the user's speech. When the user
stops talking for **~3 seconds** (API STT; the on-device Android recognizer