summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
diff options
context:
space:
mode:
authorjonerlin <jonerlin@google.com>2022-03-19 00:37:21 +0800
committerJoner Lin <jonerlin@google.com>2022-03-23 02:23:25 +0000
commit5b5bd513f78b5183007010ed9373ab18bfc963a4 (patch)
tree50ccb1b716d93720b40bbcd8aadd26eebda2fd8f /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parent753c739998ed4a369042cbe4522004e3263df105 (diff)
Do not allow Bluetooth enabling during device shutting down
Tag: #feature Bug: 207521630 Test: reboot device in BLE_ON state, check log Change-Id: Ia51355ae88919d81108a619e789c6d3415962231 Merged-In: 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 8d248ea93c..bd6dfc984f 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -217,6 +217,7 @@ 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);
@@ -479,6 +480,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
}
} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
Slog.i(TAG, "Device is shutting down.");
+ mShutdownInProgress = true;
mBluetoothLock.readLock().lock();
try {
mEnable = false;
@@ -1961,6 +1963,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
case MESSAGE_ENABLE:
int quietEnable = msg.arg1;
int isBle = msg.arg2;
+ if (mShutdownInProgress) {
+ Slog.i(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.