From 78407171393aacc694775f250eb2e5c1b6ea011a Mon Sep 17 00:00:00 2001 From: Rahul Sabnis Date: Mon, 15 May 2023 15:26:49 -0700 Subject: [PATCH] LEA developer option is enabled if the BT LEA flag is enabled Bug: 281568856 Test: Manual Change-Id: If59afff53c304e38074d7a9999329dc039d4cffb --- .../bluetooth/BluetoothDetailsProfilesController.java | 5 ++++- .../BluetoothLeAudioDeviceDetailsPreferenceController.java | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index d0fb16a91aa..5dabb7aea05 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -69,6 +69,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll private static final String ENABLE_DUAL_MODE_AUDIO = "persist.bluetooth.enable_dual_mode_audio"; + private static final String CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT = "le_audio_enabled_by_default"; private LocalBluetoothManager mManager; private LocalBluetoothProfileManager mProfileManager; @@ -99,7 +100,9 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll 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); + SettingsUIDeviceConfig.BT_LE_AUDIO_DEVICE_DETAIL_ENABLED, false) + || DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, + CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT, 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(); diff --git a/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceController.java b/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceController.java index 0945f0da746..a54c594c84d 100644 --- a/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceController.java +++ b/src/com/android/settings/development/BluetoothLeAudioDeviceDetailsPreferenceController.java @@ -39,6 +39,7 @@ public class BluetoothLeAudioDeviceDetailsPreferenceController implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin { private static final String PREFERENCE_KEY = "bluetooth_show_leaudio_device_details"; + private static final String CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT = "le_audio_enabled_by_default"; static int sLeAudioSupportedStateCache = BluetoothStatusCodes.ERROR_UNKNOWN; @VisibleForTesting @@ -87,8 +88,12 @@ public class BluetoothLeAudioDeviceDetailsPreferenceController final boolean leAudioDeviceDetailEnabled = DeviceConfig.getBoolean( DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_DEVICE_DETAIL_ENABLED, false); + final boolean leAudioEnabledByDefault = DeviceConfig.getBoolean( + DeviceConfig.NAMESPACE_BLUETOOTH, CONFIG_LE_AUDIO_ENABLED_BY_DEFAULT, false); - ((SwitchPreference) mPreference).setChecked(leAudioDeviceDetailEnabled); + mPreference.setEnabled(!leAudioEnabledByDefault); + ((SwitchPreference) mPreference).setChecked(leAudioDeviceDetailEnabled + || leAudioEnabledByDefault); } @Override