[LE Audio] Add LE Audio Devices in Sound Settings

- When connected to the LE Audio Device, it will display "Play XXX on
    LEAduioDeviceName" in Sound Settings.

  - When connected to the LE Audio Device, it will display the LE Audio
    device name in the "Take call on" list for you having a active call(Hands Free).

  - Remove the @Ignore annotation for all the tests and make test
    cases pass.

Bug: 240911615
Bug: 243494881
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AudioOutputSwitchPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=HandsFreeProfileOutputPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=MediaOutputPreferenceControllerTest
Change-Id: I10db59b33623495a9e9933556c78e20d81e405ea
This commit is contained in:
changbetty
2022-10-12 11:02:59 +00:00
parent 50c7cb834e
commit 1096417464
6 changed files with 279 additions and 33 deletions

View File

@@ -103,6 +103,7 @@ public class HandsFreeProfileOutputPreferenceController extends AudioSwitchPrefe
mConnectedDevices.clear();
mConnectedDevices.addAll(getConnectedHfpDevices());
mConnectedDevices.addAll(getConnectedHearingAidDevices());
mConnectedDevices.addAll(getConnectedLeAudioDevices());
final int numDevices = mConnectedDevices.size();
if (numDevices == 0) {
@@ -181,12 +182,22 @@ public class HandsFreeProfileOutputPreferenceController extends AudioSwitchPrefe
@Override
public BluetoothDevice findActiveDevice() {
BluetoothDevice activeDevice = findActiveHearingAidDevice();
BluetoothDevice haActiveDevice = findActiveHearingAidDevice();
BluetoothDevice leAudioActiveDevice = findActiveLeAudioDevice();
final HeadsetProfile headsetProfile = mProfileManager.getHeadsetProfile();
if (activeDevice == null && headsetProfile != null) {
activeDevice = headsetProfile.getActiveDevice();
if (haActiveDevice != null) {
return haActiveDevice;
}
return activeDevice;
if (leAudioActiveDevice != null) {
return leAudioActiveDevice;
}
if (headsetProfile != null && headsetProfile.getActiveDevice() != null) {
return headsetProfile.getActiveDevice();
}
return null;
}
}