diff options
author | Joner Lin <jonerlin@google.com> | 2022-03-23 06:34:39 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-23 06:34:39 +0000 |
commit | 95f48fa108b13e07c7f75c76c6c5cf3761b31f0d (patch) | |
tree | f8c678b9f0a5bf6f5840f2785daafef49faf1a3a /service/java/com/android/server/bluetooth/BluetoothManagerService.java | |
parent | c8f48254d3c9894d38f837424e7e7f8322ec5fb3 (diff) | |
parent | c5741e1775d36bdd2dda363d06b0ace1219b0fbd (diff) |
Merge changes from topic "Handle Shutdown Intent" am: bd01f52b72 am: c5741e1775
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2032224
Change-Id: Ide192bd17ce20476f0838b80ce2e695e00f4ac93
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r-- | service/java/com/android/server/bluetooth/BluetoothManagerService.java | 7 |
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 4786b2d027..4bd707e3f1 100644 --- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java +++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java @@ -213,6 +213,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); @@ -475,6 +476,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; @@ -1957,6 +1959,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. |