Change the switcher to switch LE audio mode with broadcast

Change the previous toggle design to list option for broadcast feature.
The new toggle change is only applied as broadcast feature enabled whcih
is behind a feature flag.

Bug: 273153850
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothLeAudioPreferenceControllerTest
Change-Id: Ic2ea10d9d9529a2d413525c1b660f8fbac371502
This commit is contained in:
Alice Kuo
2024-01-03 07:07:08 +08:00
parent b4e65e6e71
commit 37e1fef9d4
6 changed files with 184 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import android.bluetooth.BluetoothManager;
import android.bluetooth.BluetoothStatusCodes;
import android.content.Context;
import android.os.SystemProperties;
import android.sysprop.BluetoothProperties;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -64,6 +65,12 @@ public class BluetoothLeAudioPreferenceController
return PREFERENCE_KEY;
}
@Override
public boolean isAvailable() {
return BluetoothProperties.isProfileBapUnicastClientEnabled().orElse(false)
&& !BluetoothProperties.isProfileBapBroadcastSourceEnabled().orElse(false);
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
BluetoothRebootDialog.show(mFragment);