Control broadcast assistant profile connection with le toggle

Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothDetailsProfilesControllerTest
Test: manual test with le toggle and check bass profile is
enabled/disabled
Bug: 300227308

Change-Id: If61b1edadb24b53661bb74173c243826f31956ae
This commit is contained in:
Rongxuan Liu
2023-11-15 20:44:32 +00:00
parent c292adaf6b
commit 54c2f4dd4b

View File

@@ -350,6 +350,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
}
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
@@ -359,6 +361,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), true);
}
if (broadcastAssistant != null) {
Log.d(TAG,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ " disable LE broadcast assistant profile");
broadcastAssistant.setEnabled(leAudioDevice.getDevice(), false);
}
}
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
@@ -385,6 +393,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
}
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
@@ -394,6 +404,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), false);
}
if (broadcastAssistant != null) {
Log.d(TAG,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ " enable LE broadcast assistant profile");
broadcastAssistant.setEnabled(leAudioDevice.getDevice(), true);
}
}
}