Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51b4402a authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

AudioService: prevent ignoring already connected devices on restore

AudioDeviceInventory.onRestoreDevices is called after audioserver
restarted. In case a device had been reconnected after
audioserver died, and before onRestoreDevices had run, we're
calling AudioSystem.setDeviceConnectionState(AVAILABLE) to
reconnect the device. But when the device is already connected
it doesn't return OK, which was then considered an error, and
the device was ignored.
The fix consists in checking whether a device is already connected
before attempting to reconnect it, but also in keeping track of
devices that were attempted to be connected while audioserver
was restarting.
The new code also changes the role of mApmConnectedDevices:
it contains all the devices, regardless of their type, which
have been made available to AudioPolicy.
While AudioService handles an audio server restart, don't
attempt to connect the device to AudioPolicy. Instead keep
track of them by adding them to mConnectedDevices.
mApmConnectedDevices will be rebuilt in
AudioDeviceInventory.onRestoreDevices() which is
called only after audioserver is back online.

Bug: 393821141
Flag: EXEMPT bug fix
Test: kill audio server and connect HFP/AVRCP headset before device
restore, verify media goes to A2DP

Change-Id: I0eda2c02d4a92db72ee086dca79363730c0ab985
parent 951c20e0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment