From a3b467167f38a7d30298f5ef8c7b5131ecdf2bab Mon Sep 17 00:00:00 2001 From: yishai Date: Wed, 28 Jan 2026 18:29:01 +0200 Subject: [PATCH] Android: fix digital assistant invocation with proxy activity and missing intent filters --- apps/android/app/src/main/AndroidManifest.xml | 46 ++++++++++++++++++- .../android/assistant/AssistProxyActivity.kt | 41 +++++++++++++++++ .../res/xml/voice_interaction_service.xml | 9 ++++ 3 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 apps/android/app/src/main/java/com/clawdbot/android/assistant/AssistProxyActivity.kt create mode 100644 apps/android/app/src/main/res/xml/voice_interaction_service.xml diff --git a/apps/android/app/src/main/AndroidManifest.xml b/apps/android/app/src/main/AndroidManifest.xml index df2aa94b3..1ab2541b6 100644 --- a/apps/android/app/src/main/AndroidManifest.xml +++ b/apps/android/app/src/main/AndroidManifest.xml @@ -15,6 +15,7 @@ + @@ -37,13 +38,56 @@ android:name=".NodeForegroundService" android:exported="false" android:foregroundServiceType="dataSync|microphone|mediaProjection" /> + + + + + + + + + + + + + + + + + + + + + + android:exported="true" + android:launchMode="singleTop"> + + + + diff --git a/apps/android/app/src/main/java/com/clawdbot/android/assistant/AssistProxyActivity.kt b/apps/android/app/src/main/java/com/clawdbot/android/assistant/AssistProxyActivity.kt new file mode 100644 index 000000000..a5286245a --- /dev/null +++ b/apps/android/app/src/main/java/com/clawdbot/android/assistant/AssistProxyActivity.kt @@ -0,0 +1,41 @@ +package com.clawdbot.android.assistant + +import android.app.Activity +import android.content.Intent +import android.os.Bundle +import android.util.Log +import com.clawdbot.android.MainActivity + +/** + * Invisible proxy activity that handles all assistant invocation intents. + * Extracts any assist data and forwards to MainActivity, then finishes immediately. + * + * This is a Theme.NoDisplay activity that serves as the entry point for: + * - Long-press home button (ACTION_ASSIST) + * - Voice assistant triggers (VOICE_ASSIST, VOICE_COMMAND) + * - Search button long-press (SEARCH_LONG_PRESS) + */ +class AssistProxyActivity : Activity() { + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + + Log.d("AssistProxyActivity", "onCreate: action=${intent?.action}") + + // Extract any assist data from the triggering intent + val assistBundle = intent?.extras + + // Launch the real assistant UI (MainActivity) + val launchIntent = Intent(this, MainActivity::class.java).apply { + action = "com.clawdbot.android.ACTION_ASSISTANT" + if (assistBundle != null) { + putExtras(assistBundle) + } + flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP + } + + startActivity(launchIntent) + + // Finish immediately (this activity is invisible) + finish() + } +} diff --git a/apps/android/app/src/main/res/xml/voice_interaction_service.xml b/apps/android/app/src/main/res/xml/voice_interaction_service.xml new file mode 100644 index 000000000..485b9d5d9 --- /dev/null +++ b/apps/android/app/src/main/res/xml/voice_interaction_service.xml @@ -0,0 +1,9 @@ + +