DuckAi/Voice chat: Allow voice chat to run in background#8317
Open
karlenDimla wants to merge 2 commits intodevelopfrom
Open
DuckAi/Voice chat: Allow voice chat to run in background#8317karlenDimla wants to merge 2 commits intodevelopfrom
karlenDimla wants to merge 2 commits intodevelopfrom
Conversation
af29658 to
e67cfe3
Compare
e67cfe3 to
3706f37
Compare
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 67fc4e6. Configure here.
67fc4e6 to
d57f881
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Task/Issue URL: https://app.asana.com/1/137249556945/project/1208671677432066/task/1214087464606240?focus=true
Description
Enables Duck.ai voice mode to retain microphone access when the app is backgrounded.
Previously, Android would cut off microphone access as soon as the app left the foreground, interrupting any active voice session. This change introduces a foreground service (DuckChatVoiceMicrophoneService)
that is started when a voice session begins and stopped when it ends, signalling to Android that microphone use is intentional and keeping the process alive in the background.
Changes
NOTE: This does not consider multiple duck.ai voice sessions.
Steps to test this PR
Prerequisites: Enable Search & Duck.Ai
Background app — microphone stays active
Return from background — session intact
Swipe app away from recents — session ends
Close the Duck.ai tab — session ends
Closing a different tab — session unaffected
Voice session ended by Duck.ai UI — service stops
Fresh app launch — no stale session
Note
Medium Risk
Introduces a new microphone foreground service and adds new audio/foreground-service permissions, which can impact runtime behavior and Play policy compliance; also changes session-lifecycle handling tied to tab removal and app exit.
Overview
Enables Duck.ai voice chat to keep microphone access while the app is backgrounded by starting a new foreground service (
DuckChatVoiceMicrophoneService) with a persistent notification during active voice sessions.Voice session tracking is expanded so
VoiceSessionStateManageris started with atabId, automatically ends the session (and stops the service) when the owning tab is closed or the app exits/fresh-launches, andBrowserTabViewModelnow passestabIdinto Duck.ai JS callbacks to support this. Theduckchat-implmanifest adds microphone/foreground-service permissions and registers the new service, and tests are updated/added to cover the new tab-aware lifecycle behavior.Reviewed by Cursor Bugbot for commit d57f881. Bugbot is set up for automated code reviews on this repo. Configure here.