diff options
| author | 2020-03-23 14:11:49 +0800 | |
|---|---|---|
| committer | 2020-03-30 09:39:15 +0800 | |
| commit | 0c69be28786ed71f13e7724bdc523381d018d397 (patch) | |
| tree | 5c95cbe9f6e6b9343852b61f1dbb7e920709dcc5 | |
| parent | f845259eecf9ecd3b8385a81e6a3792ac515cba2 (diff) | |
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
| -rw-r--r-- | services/core/java/com/android/server/BluetoothManagerService.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index d7b4f2e8f136..192ea72224b1 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -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(); |