Merge "Rename toggle "Enable Bluetooth LE audio" to "Disable Bluetooth LE audio"" am: 60d9be5a0a am: 7871a9e9bd

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2516935

Change-Id: I77867e2c59c5745cf8b705072e5b0b35c455f399
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-03-31 09:34:23 +00:00
committed by Automerger Merge Worker
5 changed files with 25 additions and 38 deletions

View File

@@ -44,12 +44,6 @@ public class BluetoothLeAudioAllowListPreferenceController
static final String LE_AUDIO_ALLOW_LIST_ENABLED_PROPERTY =
"persist.bluetooth.leaudio.enable_allow_list";
private static final String LE_AUDIO_DYNAMIC_SWITCH_PROPERTY =
"ro.bluetooth.leaudio_switcher.supported";
@VisibleForTesting
static final String LE_AUDIO_DYNAMIC_ENABLED_PROPERTY =
"persist.bluetooth.leaudio_switcher.enabled";
@VisibleForTesting
BluetoothAdapter mBluetoothAdapter;
@@ -83,16 +77,9 @@ public class BluetoothLeAudioAllowListPreferenceController
return;
}
int leAudioSupportedState = mBluetoothAdapter.isLeAudioSupported();
boolean leAudioEnabled = false;
if ((leAudioSupportedState == BluetoothStatusCodes.FEATURE_SUPPORTED)
|| (leAudioSupportedState == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
&& SystemProperties.getBoolean(LE_AUDIO_DYNAMIC_SWITCH_PROPERTY, false)
&& SystemProperties.getBoolean(LE_AUDIO_DYNAMIC_ENABLED_PROPERTY, false))) {
leAudioEnabled = true;
}
final int leAudioSupportedState = mBluetoothAdapter.isLeAudioSupported();
final boolean leAudioEnabled =
(leAudioSupportedState == BluetoothStatusCodes.FEATURE_SUPPORTED);
final boolean leAudioAllowListSupport =
SystemProperties.getBoolean(LE_AUDIO_ALLOW_LIST_SWITCH_SUPPORT_PROPERTY, false);

View File

@@ -36,13 +36,13 @@ public class BluetoothLeAudioPreferenceController
extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String PREFERENCE_KEY = "bluetooth_enable_leaudio";
private static final String PREFERENCE_KEY = "bluetooth_disable_leaudio";
private static final String LE_AUDIO_DYNAMIC_SWITCH_PROPERTY =
"ro.bluetooth.leaudio_switcher.supported";
@VisibleForTesting
static final String LE_AUDIO_DYNAMIC_ENABLED_PROPERTY =
"persist.bluetooth.leaudio_switcher.enabled";
static final String LE_AUDIO_SWITCHER_DISABLED_PROPERTY =
"persist.bluetooth.leaudio_switcher.disabled";
private final DevelopmentSettingsDashboardFragment mFragment;
@@ -84,7 +84,7 @@ public class BluetoothLeAudioPreferenceController
final boolean leAudioEnabled =
(isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);
((SwitchPreference) mPreference).setChecked(leAudioEnabled);
((SwitchPreference) mPreference).setChecked(!leAudioEnabled);
// Disable option if Bluetooth is disabled or if switch is not supported
if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
@@ -101,10 +101,10 @@ public class BluetoothLeAudioPreferenceController
return;
}
final boolean leAudioEnabled =
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
SystemProperties.set(LE_AUDIO_DYNAMIC_ENABLED_PROPERTY,
Boolean.toString(!leAudioEnabled));
final boolean leAudioDisabled =
(mBluetoothAdapter.isLeAudioSupported() != BluetoothStatusCodes.FEATURE_SUPPORTED);
SystemProperties.set(LE_AUDIO_SWITCHER_DISABLED_PROPERTY,
Boolean.toString(!leAudioDisabled));
}
/**