From 59eccef768bfb8ae3ddf54a0cdfabba66bc0f2e1 Mon Sep 17 00:00:00 2001 From: Ayaan Zaidi Date: Thu, 2 Apr 2026 15:29:42 +0530 Subject: [PATCH] feat: add Google Assistant App Actions entrypoint --- apps/android/app/src/main/AndroidManifest.xml | 3 ++ .../app/src/main/res/values/assistant.xml | 7 ++++ .../app/src/main/res/xml/shortcuts.xml | 17 ++++++++ .../ai/openclaw/app/AssistantLaunchTest.kt | 39 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 apps/android/app/src/main/res/values/assistant.xml create mode 100644 apps/android/app/src/main/res/xml/shortcuts.xml create mode 100644 apps/android/app/src/test/java/ai/openclaw/app/AssistantLaunchTest.kt diff --git a/apps/android/app/src/main/AndroidManifest.xml b/apps/android/app/src/main/AndroidManifest.xml index 801623083d2..43cd3e1acd6 100644 --- a/apps/android/app/src/main/AndroidManifest.xml +++ b/apps/android/app/src/main/AndroidManifest.xml @@ -49,6 +49,9 @@ android:supportsRtl="true" android:networkSecurityConfig="@xml/network_security_config" android:theme="@style/Theme.OpenClawNode"> + + + ask OpenClaw $prompt + tell OpenClaw to $prompt + open OpenClaw and ask $prompt + + diff --git a/apps/android/app/src/main/res/xml/shortcuts.xml b/apps/android/app/src/main/res/xml/shortcuts.xml new file mode 100644 index 00000000000..75573d4e860 --- /dev/null +++ b/apps/android/app/src/main/res/xml/shortcuts.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/apps/android/app/src/test/java/ai/openclaw/app/AssistantLaunchTest.kt b/apps/android/app/src/test/java/ai/openclaw/app/AssistantLaunchTest.kt new file mode 100644 index 00000000000..2afffcd6556 --- /dev/null +++ b/apps/android/app/src/test/java/ai/openclaw/app/AssistantLaunchTest.kt @@ -0,0 +1,39 @@ +package ai.openclaw.app + +import android.content.Intent +import org.junit.Assert.assertEquals +import org.junit.Assert.assertNull +import org.junit.Test +import org.junit.runner.RunWith +import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config + +@RunWith(RobolectricTestRunner::class) +@Config(sdk = [34]) +class AssistantLaunchTest { + @Test + fun parsesAssistGestureIntent() { + val parsed = parseAssistantLaunchIntent(Intent(Intent.ACTION_ASSIST)) + + requireNotNull(parsed) + assertEquals("assist", parsed.source) + assertNull(parsed.prompt) + } + + @Test + fun parsesAppActionPrompt() { + val parsed = + parseAssistantLaunchIntent( + Intent(actionAskOpenClaw).putExtra(extraAssistantPrompt, " summarize my unread texts "), + ) + + requireNotNull(parsed) + assertEquals("app_action", parsed.source) + assertEquals("summarize my unread texts", parsed.prompt) + } + + @Test + fun ignoresUnrelatedIntents() { + assertNull(parseAssistantLaunchIntent(Intent(Intent.ACTION_VIEW))) + } +}