summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2022-04-14 17:26:47 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-14 23:18:57 +0000
commitce9ddee0cc908cfa97a161bb56941293978554b7 (patch)
treefb9478cf7ee6795052bd6bbe8d044ba580ae0e3b
parent950b40e0aa27f44c3eb3b7d18c16166449d5f82b (diff)
Revert "Save off foreground user id before passing the message to the handler on"
This reverts commit eda5120b133e6f55951287b1dd85b4bd290a60e7. Reason for revert: The issue in the bug is still reproducible after this change was landed Tag: #feature Bug: 228920751 Test: Manual Ignore-AOSP-First: Change only present in tm-dev Change-Id: I8d818370bcd6694b17c77545538f25fa2bbe2e34 (cherry picked from commit 2fece9705427955c24e47ce197fe4a0c595c7860) Merged-In: I8d818370bcd6694b17c77545538f25fa2bbe2e34
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothManagerService.java15
1 files changed, 7 insertions, 8 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index ff1d861293..4ee392f08d 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1548,14 +1548,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
if (DBG) {
Log.d(TAG, "User " + userHandle + " switched");
}
-
- // Save the foreground user id and propagate to BT process after it's restarted
- int toUserId = userHandle.getIdentifier();
- if (mForegroundUserId != toUserId) {
- mForegroundUserId = toUserId;
- }
-
- mHandler.obtainMessage(MESSAGE_USER_SWITCHED, toUserId, 0).sendToTarget();
+ mHandler.obtainMessage(MESSAGE_USER_SWITCHED, userHandle.getIdentifier(), 0).sendToTarget();
}
/**
@@ -2384,6 +2377,12 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
}
mHandler.removeMessages(MESSAGE_USER_SWITCHED);
+ // Save the foreground user id and propagate to BT process after it's restarted
+ int toUserId = msg.arg1;
+ if (mForegroundUserId != toUserId) {
+ mForegroundUserId = toUserId;
+ }
+
/* disable and enable BT when detect a user switch */
if (mBluetooth != null && isEnabled()) {
restartForReason(BluetoothProtoEnums.ENABLE_DISABLE_REASON_USER_SWITCH);