From 54c2f4dd4b60ca90099db9b5cf11d8c52362a2f6 Mon Sep 17 00:00:00 2001 From: Rongxuan Liu Date: Wed, 15 Nov 2023 20:44:32 +0000 Subject: [PATCH] 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 --- .../BluetoothDetailsProfilesController.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index 73857f2c2a7..f0910e78666 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -350,15 +350,23 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile(); + LocalBluetoothProfile broadcastAssistant = + mProfileManager.getLeAudioBroadcastAssistantProfile(); for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { Log.d(TAG, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() - + "disable LE profile"); + + " disable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), false); 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,15 +393,23 @@ 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, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() - + "enable LE profile"); + + " enable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), true); 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); + } } }