From 0cbc4474e883aae23fb86340fc279ee707596085 Mon Sep 17 00:00:00 2001 From: Himanshu Rawat Date: Fri, 3 Dec 2021 09:33:57 +0000 Subject: [PATCH] Global settings for Bluetooth (Settings.Global.BLUETOOTH_ON) must be set to BLUETOOTH_ON_BLUETOOTH whenever non-BLE MESSAGE_ENABLE is handled irrespective of the state. Bug: 208777033 Test: Manual Change-Id: I92c58cd8f4510f91453bf77166af9d304030483f (cherry picked from commit 465382bb7148ccfbc4eec142ae3bb42b858aa54c) --- .../java/com/android/server/BluetoothManagerService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 51066dd837e26..ea637922e6cc5 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -1869,6 +1869,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mHandler.removeMessages(MESSAGE_RESTART_BLUETOOTH_SERVICE); mEnable = true; + if (isBle == 0) { + persistBluetoothSetting(BLUETOOTH_ON_BLUETOOTH); + } + // Use service interface to get the exact state try { mBluetoothLock.readLock().lock(); @@ -1882,7 +1886,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } else { Slog.w(TAG, "BT Enable in BLE_ON State, going to ON"); mBluetooth.onLeServiceUp(mContext.getAttributionSource()); - persistBluetoothSetting(BLUETOOTH_ON_BLUETOOTH); } break; case BluetoothAdapter.STATE_BLE_TURNING_ON: