summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
diff options
context:
space:
mode:
authorjonerlin <jonerlin@google.com>2022-03-21 18:28:01 +0800
committerjonerlin <jonerlin@google.com>2022-03-21 18:35:15 +0800
commitbfa86649dfa21bd80d719ea4e57749e59216b20f (patch)
tree4ae877328efdd7ec6f7c0600ec012e41aa521196 /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parentc1d74f61dee3092e472124d913ac2d7b75b179c3 (diff)
Do not allow Bluetooth enabling during device shutting down
Tag: #feature Bug: 207521630 Test: reboot device in BLE_ON state, check log Ignore-AOSP-First: Conflict with internal Change-Id: I6330d2f94fe7a5ca582df83c9fa32c5c6cba5186
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothManagerService.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index fb99e1cd08..d1ae0fce31 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -226,6 +226,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
// used inside handler thread
private boolean mQuietEnable = false;
private boolean mEnable;
+ private boolean mShutdownInProgress = false;
private static CharSequence timeToLog(long timestamp) {
return android.text.format.DateFormat.format("MM-dd HH:mm:ss", timestamp);
@@ -486,6 +487,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
}
} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
Log.i(TAG, "Device is shutting down.");
+ mShutdownInProgress = true;
mBluetoothLock.readLock().lock();
try {
mEnable = false;
@@ -1921,6 +1923,11 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
case MESSAGE_ENABLE:
int quietEnable = msg.arg1;
int isBle = msg.arg2;
+ if (mShutdownInProgress) {
+ Log.d(TAG, "Skip Bluetooth Enable in device shutdown process");
+ break;
+ }
+
if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED)
|| mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) {
// We are handling enable or disable right now, wait for it.