From f05615f1e85d81e2cffd14f210d21eff965fd092 Mon Sep 17 00:00:00 2001 From: Patty Huang Date: Fri, 28 Apr 2023 16:40:56 +0800 Subject: [PATCH 1/2] Add toggle to show/hide the Per Device Enable LE Audio Toggle in Device details Bug: 280020008 Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothLeAudioDeviceDetailsPreferenceControllerTest Change-Id: I559f34f2b0764c4f566fe1e0c1357929e2c88fb6 --- res/values/strings.xml | 11 +- res/xml/development_settings.xml | 4 + .../settings/core/SettingsUIDeviceConfig.java | 5 + ...udioDeviceDetailsPreferenceController.java | 102 ++++++++++++++ .../DevelopmentSettingsDashboardFragment.java | 1 + ...DeviceDetailsPreferenceControllerTest.java | 133 ++++++++++++++++++ 6 files changed, 252 insertions(+), 4 deletions(-) create mode 100644 src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceController.java create mode 100644 tests/robotests/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceControllerTest.java diff --git a/res/values/strings.xml b/res/values/strings.xml index 6605be2c8da..1218f02e949 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -221,14 +221,17 @@ Cancel - + Disable Bluetooth LE audio - + Disables Bluetooth LE audio feature if the device supports LE audio hardware capabilities. - + + Show LE audio toggle in Device Details + + Enable Bluetooth LE audio Allow List - + Enable Bluetooth LE audio allow list feature. diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml index eb17fbf0828..68e4e78945b 100644 --- a/res/xml/development_settings.xml +++ b/res/xml/development_settings.xml @@ -350,6 +350,10 @@ android:title="@string/bluetooth_disable_leaudio" android:summary="@string/bluetooth_disable_leaudio_summary" /> + + Date: Thu, 4 May 2023 03:35:50 +0800 Subject: [PATCH 2/2] Hide the LE audio toggle by flag Bug: 280021500 Test: build pass. Change-Id: I3f4a821c50dfb9d2de73919945334b42c59b3309 --- .../bluetooth/BluetoothDetailsProfilesController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index f69cf580d51..208fba7716c 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -77,6 +77,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll private Map> mProfileDeviceMap = new HashMap>(); private boolean mIsLeContactSharingEnabled = false; + private boolean mIsLeAudioToggleEnabled = false; @VisibleForTesting PreferenceCategory mProfilesContainer; @@ -97,6 +98,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll mProfilesContainer.setLayoutResource(R.layout.preference_bluetooth_profile_category); mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); + mIsLeAudioToggleEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, + SettingsUIDeviceConfig.BT_LE_AUDIO_DEVICE_DETAIL_ENABLED, false); // Call refresh here even though it will get called later in onResume, to avoid the // list of switches appearing to "pop" into the page. refresh(); @@ -142,6 +145,10 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll profilePref.setEnabled(!mCachedDevice.isBusy()); } + if (profile instanceof LeAudioProfile && !mIsLeAudioToggleEnabled) { + profilePref.setVisible(false); + } + if (profile instanceof MapProfile) { profilePref.setChecked(device.getMessageAccessPermission() == BluetoothDevice.ACCESS_ALLOWED);