fix(Android/ConnectionService): mic not working

Turns out the microphone will not work on some devices when starting in
"audio only", because the audio mode is not set to the MODE_IN_COMMUNICATION,
but to the MODE_IN_CALL. Calling setAudioModeIsVoip(true) makes
the system adjust to MODE_IN_COMMUNICATION and the mic works fine.
This commit is contained in:
paweldomas 2019-03-22 14:24:40 -05:00 committed by Saúl Ibarra Corretgé
parent 6894de00cc
commit 3b24124d57
1 changed files with 4 additions and 1 deletions

View File

@ -191,6 +191,9 @@ public class ConnectionService extends android.telecom.ConnectionService {
request.getAddress(),
TelecomManager.PRESENTATION_ALLOWED);
connection.setExtras(request.getExtras());
connection.setAudioModeIsVoip(true);
// NOTE there's a time gap between the placeCall and this callback when
// things could get out of sync, but they are put back in sync once
// the startCall Promise is resolved below. That's because on
@ -426,7 +429,7 @@ public class ConnectionService extends android.telecom.ConnectionService {
@Override
public String toString() {
return String.format(
"ConnectionImpl[adress=%s, uuid=%s]@%d",
"ConnectionImpl[address=%s, uuid=%s]@%d",
getAddress(), getCallUUID(), hashCode());
}
}