Skip to content

android: launch configured default digital assistant on stem long-press (#868) - #886

Open
duongynhi000005-oss wants to merge 1 commit into
librepods-org:mainfrom
duongynhi000005-oss:fix-issue-868-digital-assistant-action-assist-intent
Open

duongynhi000005-oss wants to merge 1 commit into
librepods-org:mainfrom
duongynhi000005-oss:fix-issue-868-digital-assistant-action-assist-intent

Conversation

@duongynhi000005-oss

Copy link
Copy Markdown

Fixes #868

Problem

executeStemAction() previously dispatched an unscoped Intent(Intent.ACTION_VOICE_COMMAND) for StemAction.DIGITAL_ASSISTANT. Because third-party default digital assistants (such as Grok Bot, ChatGPT, Perplexity, etc.) typically register for Intent.ACTION_ASSIST rather than Intent.ACTION_VOICE_COMMAND, an unscoped ACTION_VOICE_COMMAND falls through to the Google app (which redirects to the Android Default digital assistant app settings screen when it is not the active default) or to Bixby on Samsung devices.

Solution

  • Resolve the user's configured default assistant package from Settings.Secure ("assistant" / "voice_interaction_service", both @Readable on Android 13+).
  • Attempt Intent.ACTION_VOICE_COMMAND and Intent.ACTION_ASSIST scoped via setPackage(defaultAssistantPackage) first:
    • Preserves direct eyes-free voice listening when Google/Gemini is the active default assistant.
    • Launches non-Google default assistants (e.g. Grok Bot on Xiaomi HyperOS, or third-party assistants on Samsung without Bixby hijacking or chooser prompts) directly via ACTION_ASSIST.
  • Fall back cleanly to unscoped Intent.ACTION_ASSIST -> Intent.ACTION_VOICE_COMMAND catching ActivityNotFoundException / SecurityException.

…tion (librepods-org#868)

Resolve the active default assistant package from Settings.Secure
("assistant" / "voice_interaction_service") and dispatch
ACTION_VOICE_COMMAND / ACTION_ASSIST scoped to that package first,
falling back cleanly to unscoped ACTION_ASSIST and ACTION_VOICE_COMMAND
on ActivityNotFoundException.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Digital Assistant press-and-hold opens "Default digital assistant app" settings when the default assistant isn't Google

1 participant