Trying to prevent BT not being used automatically when it connects during a call + improved AudioUtils logs

This commit is contained in:
Sylvain Berfini 2025-06-19 13:22:08 +02:00
parent fd3f746e3d
commit 6f80409086
2 changed files with 9 additions and 4 deletions

View file

@ -48,6 +48,8 @@ class TelecomCallControlCallback(
) {
companion object {
private const val TAG = "[Telecom Call Control Callback]"
private const val DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS = 100L
}
private var availableEndpoints: List<CallEndpointCompat> = arrayListOf()
@ -124,12 +126,12 @@ class TelecomCallControlCallback(
Log.i("$TAG New available audio endpoints list")
if (availableEndpoints != list) {
Log.i(
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK in 500ms"
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK in [$DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS] ms"
)
coreContext.postOnCoreThreadDelayed({ core ->
core.reloadSoundDevices()
Log.i("$TAG Sound devices reloaded")
}, 500)
}, DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS)
}
availableEndpoints = list

View file

@ -92,16 +92,19 @@ class AudioUtils {
if (!skipTelecom) {
val callId = currentCall?.callLog?.callId.orEmpty()
Log.i("$TAG Trying to change audio endpoint using Telecom Manager APIs")
val success = coreContext.telecomManager.applyAudioRouteToCallWithId(types, callId)
if (!success) {
Log.w("$TAG Failed to change audio endpoint to [$types] for call ID [$callId]")
applyAudioRouteChange(currentCall, types, output, skipTelecom = true)
} else {
Log.i("$TAG It seems audio endpoint update using Telecom Manager was successful")
return
}
} else {
Log.i("$TAG Trying to change audio endpoint directly in Linphone SDK")
applyAudioRouteChangeInLinphone(currentCall, types, output)
}
applyAudioRouteChangeInLinphone(currentCall, types, output)
}
fun applyAudioRouteChangeInLinphone(