From d9009540ddb235084308f22fd4e59ed2d708ef77 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Thu, 27 Aug 2020 16:43:11 +0300 Subject: [PATCH] Don't try to use bluetooth headset if it is not connected. --- CHANGES.md | 1 + .../main/java/im/vector/app/features/call/CallAudioManager.kt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c923053b24..07b50ef632 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,7 @@ Bugfix 🐛: - Fix FontSize issue (#1483, #1787) - Fix bad color for settings icon on Android < 24 (#1786) - Change user or room avatar: when selecting Gallery, I'm not proposed to crop the selected image (#1590) + - Loudspeaker is always used (#1685) Translations 🗣: - diff --git a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt index fde562ee63..2a773c2f9b 100644 --- a/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt +++ b/vector/src/main/java/im/vector/app/features/call/CallAudioManager.kt @@ -125,7 +125,7 @@ class CallAudioManager( } else { // if a wired headset is plugged, sound will be directed to it // (can't really force earpiece when headset is plugged) - if (isBluetoothHeadsetOn()) { + if (isBluetoothHeadsetConnected(audioManager)) { Timber.v("##VOIP: AudioManager default to WIRELESS_HEADSET ") setCurrentSoundDevice(SoundDevice.WIRELESS_HEADSET) // try now in case already connected? @@ -246,7 +246,7 @@ class CallAudioManager( } private fun isHeadsetOn(): Boolean { - return isWiredHeadsetOn() || isBluetoothHeadsetOn() + return isWiredHeadsetOn() || (audioManager?.let { isBluetoothHeadsetConnected(it) } ?: false) } private fun isWiredHeadsetOn(): Boolean {