[Android] Incoming voice audio is silent for 1+ minute after joining, then starts on its own

(#4515) Bug Open: Confirmed Priority: P1 mobile voice

Thread

Comment by Charles W (K5CDW)
Update with the complete root cause, a fix, and test results. The plugin race (flutter_callkit_incoming#893) was only half of it. Fixing just that on my Pixel 6 Pro did not fix the speaker. The other half is in Fluxer: while the self-managed Telecom call exists, Telecom owns the audio route and ignores the app's AudioManager calls. VoiceSpeakerRoute.kt already routes through the call's Telecom Connection, but only when routesSpeakerWithCommunicationDevice is true (Samsung). That is likely why it doesn't reproduce everywhere. Two more Android issues show up in the same area:
  • Bluetooth earbuds connected mid-call never appear in the output picker: in Telecom mode flutter_webrtc's AudioSwitch isn't running, so onDeviceChange never fires.
  • Earbuds disconnected mid-call: Telecom falls back to the earpiece, not the speaker.
Fix, tested on Pixel 6 Pro / Android 17 in a custom build on canary (022f1249): speaker loud right after joining; earbuds on/off mid-call, audio and picker follow; manual speaker/earpiece switching; leave from the notification; swipe-away; mute; chat.