Skip to content
Commit c61fb841 authored by jasonwshsu's avatar jasonwshsu
Browse files

Fix Audio output sometimes fails to apply when bluetooth re-enabled

Root Cause: AudioManager#getDevices(AudioManager.GET_DEVICES_OUTPUTS) is not guarantee to return the expected device after receiving profile STATE_CONNECTING broadcast. It will cause HearingAidAudioRoutingHelper#getMatchedHearingDeviceAttributes() can not find the expected output hearing device.

Solution: Listen to AudioDeviceCallback#onAudioDevicesAdded(). It was listened by HearingAidService and sent broadcast intent BluetoothHearingAid.ACTION_ACTIVE_DEVICE_CHANGED. Use SettingsLib onActiveDeviceChanged() to handle it.

Bug: 282547878
Test: make RunSettingsLibRoboTests ROBOTEST_FILTER="(BluetoothEventManagerTest|CachedBluetoothDeviceManagerTest|HearingAidDeviceManagerTest)"
Change-Id: I47a500e855b94becf979392d67c317533e0ce2a9
parent 619bfd92
Loading
Loading
Loading
Loading
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