Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8823fdc4 authored by Ugo Yu's avatar Ugo Yu
Browse files

Fix Bluetooth auto turns ON in airplane mode

Fix a race condition that mBleApps is cleared while turning ON BLE,
this causes Bluetooth turns on classic profiles instead of stays in
BLE_ON state.

Bug: 142220937
Test: enableBle() -> turn on airplane mode, check Bluetooth does not
      turn to ON.
Change-Id: I3cea5384f734dde269cf93a93ed7cc4173f669a0
parent ea9e0298
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -969,6 +969,13 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                Slog.e(TAG, "onBluetoothServiceUp: mBluetooth is null!");
                return;
            }
            if (!mEnableExternal && !isBleAppPresent() && isAirplaneModeOn()) {
                // Airplane mode is turned on while enabling BLE only mode, disable
                // BLE now.
                disableBleScanMode();
                sendBrEdrDownCallback();
                return;
            }
            if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) {
                // This triggers transition to STATE_ON
                mBluetooth.onLeServiceUp();