Don't try to use bluetooth headset if it is not connected.

This commit is contained in:
Onuray Sahin 2020-08-27 16:43:11 +03:00
parent 95e80f0263
commit d9009540dd
2 changed files with 3 additions and 2 deletions

View file

@ -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 🗣:
-

View file

@ -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 {