Merge "Disable Bluetooth if BLE was disabled while enabling"
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index ebaebae..2297d4b 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -873,7 +873,8 @@
     }
 
     /**
-     * Call IBluetooth.onLeServiceUp() to continue if Bluetooth should be on.
+     * Call IBluetooth.onLeServiceUp() to continue if Bluetooth should be on,
+     * call IBluetooth.onBrEdrDown() to disable if Bluetooth should be off.
      */
     private void continueFromBleOnState() {
         if (DBG) {
@@ -885,11 +886,10 @@
                 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();
+            if (!mEnableExternal && !isBleAppPresent()) {
+                Slog.i(TAG, "Bluetooth was disabled while enabling BLE, disable BLE now");
+                mEnable = false;
+                mBluetooth.onBrEdrDown();
                 return;
             }
             if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) {