[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

@@ -88,9 +88,11 @@ public class MediaOutputPreferenceController extends AudioSwitchPreferenceContro
// Find active device and set its name as the preference's summary
List<BluetoothDevice> connectedA2dpDevices = getConnectedA2dpDevices();
List<BluetoothDevice> connectedHADevices = getConnectedHearingAidDevices();
List<BluetoothDevice> connectedLeAudioDevices = getConnectedLeAudioDevices();
if (mAudioManager.getMode() == AudioManager.MODE_NORMAL
&& ((connectedA2dpDevices != null && !connectedA2dpDevices.isEmpty())
|| (connectedHADevices != null && !connectedHADevices.isEmpty()))) {
|| (connectedHADevices != null && !connectedHADevices.isEmpty())
|| (connectedLeAudioDevices != null && !connectedLeAudioDevices.isEmpty()))) {
activeDevice = findActiveDevice();
}
mPreference.setTitle(mContext.getString(R.string.media_output_label_title,
@@ -103,13 +105,23 @@ public class MediaOutputPreferenceController extends AudioSwitchPreferenceContro
@Override
public BluetoothDevice findActiveDevice() {
BluetoothDevice activeDevice = findActiveHearingAidDevice();
BluetoothDevice haActiveDevice = findActiveHearingAidDevice();
BluetoothDevice leAudioActiveDevice = findActiveLeAudioDevice();
final A2dpProfile a2dpProfile = mProfileManager.getA2dpProfile();
if (activeDevice == null && a2dpProfile != null) {
activeDevice = a2dpProfile.getActiveDevice();
if (haActiveDevice != null) {
return haActiveDevice;
}
return activeDevice;
if (leAudioActiveDevice != null) {
return leAudioActiveDevice;
}
if (a2dpProfile != null && a2dpProfile.getActiveDevice() != null) {
return a2dpProfile.getActiveDevice();
}
return null;
}
/**