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
Branches
Tags
No related merge requests found
...@@ -152,7 +152,7 @@ class HardwareServiceImpl( ...@@ -152,7 +152,7 @@ class HardwareServiceImpl(
if (incomingCall) { if (incomingCall) {
// ringtone for incoming calls // ringtone for incoming calls
mAudioManager.mode = AudioManager.MODE_RINGTONE mAudioManager.mode = AudioManager.MODE_RINGTONE
setAudioRouting(isOngoingVideo && mBluetoothWrapper?.canBluetooth() != true) setAudioRouting(isOngoingVideo && !(mBluetoothWrapper?.canBluetooth() == true && mBluetoothWrapper?.isBTHeadsetConnected == true))
//mShouldSpeakerphone = isOngoingVideo //mShouldSpeakerphone = isOngoingVideo
} else setAudioRouting(isOngoingVideo) } else setAudioRouting(isOngoingVideo)
} }
......
...@@ -107,11 +107,7 @@ class BluetoothWrapper(private val mContext: Context, private val btChangesListe ...@@ -107,11 +107,7 @@ class BluetoothWrapper(private val mContext: Context, private val btChangesListe
} }
} }
val isBTHeadsetConnected: Boolean val isBTHeadsetConnected: Boolean
get() = try { get() = connectedDevices?.isEmpty() ?: false
bluetoothAdapter?.getProfileConnectionState(BluetoothProfile.HEADSET) == BluetoothAdapter.STATE_CONNECTED
} catch (e: SecurityException) {
true
}
fun canBluetooth(): Boolean { fun canBluetooth(): Boolean {
// Detect if any bluetooth a device is available for call // 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.
Please register or to comment