It seems callAudioState property on TelecomManager Connection can return null...
This commit is contained in:
parent
a0d0bb0d48
commit
51cf7a6711
1 changed files with 7 additions and 1 deletions
|
@ -259,10 +259,16 @@ class Api26Compatibility {
|
|||
|
||||
fun changeAudioRouteForTelecomManager(connection: NativeCallWrapper, route: Int): Boolean {
|
||||
Log.i("[Telecom Helper] Changing audio route [$route] on connection ${connection.callId}")
|
||||
if (connection.callAudioState.route == route) {
|
||||
|
||||
val audioState = connection.callAudioState
|
||||
if (audioState != null && audioState.route == route) {
|
||||
Log.w("[Telecom Helper] Connection is already using this route")
|
||||
return false
|
||||
} else if (audioState == null) {
|
||||
Log.w("[Telecom Helper] Failed to retrieve connection's call audio state!")
|
||||
return false
|
||||
}
|
||||
|
||||
connection.setAudioRoute(route)
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue