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,15 +353,23 @@ 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,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress() "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ "disable LE profile"); + " disable LE profile");
profile.setEnabled(leAudioDevice.getDevice(), false); profile.setEnabled(leAudioDevice.getDevice(), false);
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,15 +396,23 @@ 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,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress() "device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ "enable LE profile"); + " enable LE profile");
profile.setEnabled(leAudioDevice.getDevice(), true); profile.setEnabled(leAudioDevice.getDevice(), true);
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);
}
} }
} }