Move state check to audio handler thread.
This commit is contained in:
parent
16f1fbf583
commit
a141fdaf7d
1 changed files with 5 additions and 3 deletions
|
@ -337,12 +337,14 @@ class SignalBluetoothManager(
|
|||
scoConnectionAttempts = 0
|
||||
updateDevice()
|
||||
}
|
||||
} else if (state != State.UNINITIALIZED) {
|
||||
} else {
|
||||
handler.post {
|
||||
if (state != State.UNINITIALIZED) {
|
||||
val connectionState: Int = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, BluetoothHeadset.STATE_AUDIO_DISCONNECTED)
|
||||
onAudioStateChanged(connectionState, isInitialStickyBroadcast)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (intent.action == AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED) {
|
||||
if (wasScoDisconnected(intent)) {
|
||||
handler.post(::updateAudioDeviceState)
|
||||
|
|
Loading…
Add table
Reference in a new issue