Make bluetooth toggle be on when Bluetooth is turning on

The logic should be similar to the Wi-Fi one: https://android.googlesource.com/platform/packages/apps/Settings/+/refs/heads/main/src/com/android/settings/wifi/slice/WifiSlice.java#379

BUG: 293264131
Test: unit test
Change-Id: I1222f9f793b91d81d74ed9358f1b055d3049866e
This commit is contained in:
Haijie Hong
2023-10-10 13:34:23 +08:00
parent f062d1cd6e
commit 8d0c67408e

View File

@@ -124,7 +124,8 @@ public class BluetoothSliceBuilder {
private static boolean isBluetoothEnabled() { private static boolean isBluetoothEnabled() {
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
return adapter.isEnabled(); return adapter.getState() == BluetoothAdapter.STATE_ON
|| adapter.getState() == BluetoothAdapter.STATE_TURNING_ON;
} }
private static PendingIntent getPrimaryAction(Context context) { private static PendingIntent getPrimaryAction(Context context) {