Fixed use of TelecomManager APIs

This commit is contained in:
Sylvain Berfini 2026-01-20 14:23:43 +01:00
parent 5391c12473
commit 597581faa5

View file

@ -77,10 +77,7 @@ class TelecomManager
"$TAG android.software.telecom feature is [${if (hasTelecomFeature) "available" else "not available"}]"
)
try {
callsManager.registerAppWithTelecom(
CallsManager.CAPABILITY_BASELINE or
CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING
)
callsManager.registerAppWithTelecom(CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING)
Log.i("$TAG App has been registered with Telecom")
} catch (e: Exception) {
Log.e("$TAG Can't init TelecomManager: $e")
@ -110,11 +107,12 @@ class TelecomManager
friend?.name ?: LinphoneUtils.getDisplayName(address)
}
val isVideo = LinphoneUtils.isVideoEnabled(call)
val type = if (isVideo) {
CallAttributesCompat.CALL_TYPE_VIDEO_CALL
} else {
// Always set type to video (if enabled in Core) as it indicates that video is supported, not that it's being used at the time
// https://developer.android.com/reference/kotlin/androidx/core/telecom/CallAttributesCompat#CALL_TYPE_VIDEO_CALL()
val type = if (!call.core.isVideoEnabled) {
CallAttributesCompat.CALL_TYPE_AUDIO_CALL
} else {
CallAttributesCompat.CALL_TYPE_VIDEO_CALL
}
scope.launch {