Merge "Control broadcast assistant profile connection with le toggle" into main

This commit is contained in:
Rongxuan Liu
2023-11-20 18:32:06 +00:00
committed by Android (Google) Code Review

View File

@@ -353,6 +353,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
} }
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile(); LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG, Log.d(TAG,
@@ -362,6 +364,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
if (asha != null) { if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), true); 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)) { if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
@@ -388,6 +396,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile()); disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
} }
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile(); LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG, Log.d(TAG,
@@ -397,6 +407,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
if (asha != null) { if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), false); 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);
}
} }
} }