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
Loading
Please register or sign in to comment