Fix for ticket #2246: Ringtone volume cannot bechanged while ringing

This fix delays the creation of the audioManager until the call is connected. This way the call feature does not takes the focus from the core service (where the ringtone is generated) until the call is esablished. This way the volume can be controled correctly while the phone is ringing (incoming and outgoing).
This commit is contained in:
Markus 2020-10-12 15:06:49 +02:00
parent e6a8fd5b73
commit a9f7fb46b3
2 changed files with 6 additions and 1 deletions

View file

@ -95,7 +95,7 @@ class CallRingPlayerOutgoing(
} else {
mediaPlayer.setAudioAttributes(AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
.setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION_SIGNALLING)
.setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION)
.build())
}
return mediaPlayer

View file

@ -93,6 +93,10 @@ class CallAudioManager(
fun startForCall(mxCall: MxCall) {
Timber.v("## VOIP: AudioManager startForCall ${mxCall.callId}")
}
fun setupAudioManager(mxCall: MxCall) {
Timber.v("## VOIP: AudioManager setupAudioManager ${mxCall.callId}")
val audioManager = audioManager ?: return
savedIsSpeakerPhoneOn = audioManager.isSpeakerphoneOn
savedIsMicrophoneMute = audioManager.isMicrophoneMute
@ -150,6 +154,7 @@ class CallAudioManager(
fun onCallConnected(mxCall: MxCall) {
Timber.v("##VOIP: AudioManager call answered, adjusting current sound device")
setupAudioManager(mxCall)
adjustCurrentSoundDevice(mxCall)
}