Merge "Avoid disabling LE Audio when BT is off" am: dd3d813ff3 am: d60b851b93 am: d4fbc38279

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

Change-Id: I7817be6bc82ac48127b00d0de8d644450a21711e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Paul Wang
2023-03-13 11:35:03 +00:00
committed by Automerger Merge Worker

View File

@@ -77,17 +77,19 @@ public class BluetoothLeAudioPreferenceController
return;
}
final boolean leAudioEnabled =
(mBluetoothAdapter.isLeAudioSupported() == BluetoothStatusCodes.FEATURE_SUPPORTED);
((SwitchPreference) mPreference).setChecked(leAudioEnabled);
final boolean leAudioSwitchSupported =
SystemProperties.getBoolean(LE_AUDIO_DYNAMIC_SWITCH_PROPERTY, false);
if (!leAudioSwitchSupported) {
final int isLeAudioSupportedStatus = mBluetoothAdapter.isLeAudioSupported();
final boolean leAudioEnabled =
(isLeAudioSupportedStatus == BluetoothStatusCodes.FEATURE_SUPPORTED);
((SwitchPreference) mPreference).setChecked(leAudioEnabled);
// Disable option if Bluetooth is disabled or if switch is not supported
if (isLeAudioSupportedStatus == BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED
|| !leAudioSwitchSupported) {
mPreference.setEnabled(false);
} else {
SystemProperties.set(LE_AUDIO_DYNAMIC_ENABLED_PROPERTY,
Boolean.toString(leAudioEnabled));
}
}