Skip to content
Snippets Groups Projects
Commit 1054b39b authored by Adrien Béraud's avatar Adrien Béraud
Browse files

ringtone: fix when not using Bluetooth

Change-Id: I0d79911ff681a65894b104b94df9d06c49f70dcb
parent 1dc9a866
No related branches found
No related tags found
No related merge requests found
......@@ -152,7 +152,7 @@ class HardwareServiceImpl(
if (incomingCall) {
// ringtone for incoming calls
mAudioManager.mode = AudioManager.MODE_RINGTONE
setAudioRouting(isOngoingVideo && mBluetoothWrapper?.canBluetooth() != true)
setAudioRouting(isOngoingVideo && !(mBluetoothWrapper?.canBluetooth() == true && mBluetoothWrapper?.isBTHeadsetConnected == true))
//mShouldSpeakerphone = isOngoingVideo
} else setAudioRouting(isOngoingVideo)
}
......
......@@ -107,11 +107,7 @@ class BluetoothWrapper(private val mContext: Context, private val btChangesListe
}
}
val isBTHeadsetConnected: Boolean
get() = try {
bluetoothAdapter?.getProfileConnectionState(BluetoothProfile.HEADSET) == BluetoothAdapter.STATE_CONNECTED
} catch (e: SecurityException) {
true
}
get() = connectedDevices?.isEmpty() ?: false
fun canBluetooth(): Boolean {
// Detect if any bluetooth a device is available for call
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment