Repository navigation
feat(agent): add full-duplex LiveAudioSession and AndroidLiveAudioSession - #75
Open
juliantoledo wants to merge 2 commits into
Open
juliantoledo wants to merge 2 commits into
juliantoledo wants to merge 2 commits into
Conversation
mingweiliao
requested changes
Nov 12, 2026
… AndroidLiveAudioSession, enforce permission and focus checks
juliantoledo
force-pushed
the
feat/live-audio-session
branch
from
November 13, 2026 07:07
6c11a0e to
c39e1d4
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.
Summary
Part 3 of 5 in the Gemini Live voice assistant series (following #65 and #69):
LiveLlmProviderabstraction +GeminiLiveProviderImpl) (feat(agent): add LiveLlmProvider abstraction and Gemini Live WebSocket provider #69 — merged)LiveAudioSession+AndroidLiveAudioSession)LiveAgentOrchestrator)VoiceInteractionServiceand Live UI integrationChanges in this PR
LiveAudioConfig,LiveAudioSession, &LiveAudioSessionFactory: Introduce a provider-agnostic domain-layer abstraction for full-duplex PCM microphone capture (listenToRecording()), software-gated pause/resume (pauseRecording()/resumeRecording()), assistant audio playback (queueAudio(pcmBytes, sampleRateHz)), interruption flushing (stopAudio()), and lifecycle teardown (release()), configured with per-provider sample rates viaLiveLlmSession.audioConfig(LiveAudioConfig).AndroidLiveAudioSession:LiveAudioSessionpairingVOICE_COMMUNICATIONrecording withUSAGE_VOICE_COMMUNICATIONplayback underMODE_IN_COMMUNICATIONandAUDIOFOCUS_GAIN_TRANSIENTso the hardware VoIP DSP (AcousticEchoCancelerandNoiseSuppressor) cancels speaker playback from the microphone input.@RequiresPermission(Manifest.permission.RECORD_AUDIO)onstart(), fail fast withIllegalStateExceptionon invalid lifecycle transitions or denied audio focus, and respect audio focus across recording and playback.release().AudioRecordcontinuously recording across tool calls while gating emissions in software duringpauseRecording()or transient audio focus loss.AudioTrackrecreation ifqueueAudioreceives a chunk with a differentsampleRateHz.DataModule: ProvideLiveAudioSessionFactorybacked byAndroidLiveAudioSession.AndroidLiveAudioSessionTestcovering communication mode & audio focus lifecycle, failed audio focus acquisition, invalidstart()lifecycle transitions, speakerphone vs. external headset routing, interruption flushing, software pause/resume, dynamic playback sample rates, audio focus loss/gain across recording and playback, and concurrentrelease()duringstart().Test Plan
./gradlew spotlessCheck test validateScreenshotTest assembleDebug assembleRelease -PGEMINI_API_KEY=dummy_key