Skip to content

fix(happy-app): block voice session when microphone permission is denied#861

Open
kod4284 wants to merge 1 commit intoslopus:mainfrom
kod4284:fix/voice-permission-check
Open

fix(happy-app): block voice session when microphone permission is denied#861
kod4284 wants to merge 1 commit intoslopus:mainfrom
kod4284:fix/voice-permission-check

Conversation

@kod4284
Copy link

@kod4284 kod4284 commented Mar 15, 2026

Fixes #860

Summary

  • Add secondary checkMicrophonePermission() verification in RealtimeVoiceSessionImpl.startSession() right before the ElevenLabs SDK call
  • If permission is not granted, abort the session and set status to disconnected

Context

The ElevenLabs SDK sends a TTS greeting from the server immediately upon WebSocket connection. Speaker output works regardless of RECORD_AUDIO permission, so in edge cases where the existing permission check in startRealtimeSession() is bypassed, the greeting plays even when the user denied microphone access.

Test plan

  • Android: tap voice button → deny permission → verify TTS greeting does NOT play
  • Android: tap voice button → grant permission → verify normal operation
  • iOS: same scenarios

On Android, denying the microphone permission popup still allowed the
ElevenLabs session to connect and play the TTS greeting ("hello I am
Happy") because speaker output doesn't require RECORD_AUDIO permission.

The existing permission check in startRealtimeSession() should prevent
this, but edge cases (stale cached permission state, SDK race conditions)
could let it through. Adding a secondary permission verification in
RealtimeVoiceSessionImpl.startSession() right before the ElevenLabs
SDK call ensures the session is never started without confirmed
microphone access.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
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.

ElevenLabs TTS greeting plays even when microphone permission is denied

1 participant