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
|
scoConnectionAttempts = 0
|
||||||
updateDevice()
|
updateDevice()
|
||||||
}
|
}
|
||||||
} else if (state != State.UNINITIALIZED) {
|
} else {
|
||||||
handler.post {
|
handler.post {
|
||||||
|
if (state != State.UNINITIALIZED) {
|
||||||
val connectionState: Int = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, BluetoothHeadset.STATE_AUDIO_DISCONNECTED)
|
val connectionState: Int = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, BluetoothHeadset.STATE_AUDIO_DISCONNECTED)
|
||||||
onAudioStateChanged(connectionState, isInitialStickyBroadcast)
|
onAudioStateChanged(connectionState, isInitialStickyBroadcast)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (intent.action == AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED) {
|
} else if (intent.action == AudioManager.ACTION_SCO_AUDIO_STATE_UPDATED) {
|
||||||
if (wasScoDisconnected(intent)) {
|
if (wasScoDisconnected(intent)) {
|
||||||
handler.post(::updateAudioDeviceState)
|
handler.post(::updateAudioDeviceState)
|
||||||
|
|
Loading…
Add table
Reference in a new issue