summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
diff options
context:
space:
mode:
authorRahul Sabnis <rahulsabnis@google.com>2022-04-13 15:34:54 -0700
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-14 00:56:58 +0000
commit33abaca7839e483a72a8214fe6920f185c1ecda9 (patch)
tree02e76044bfcaa25cf3bc3e281756e36eb0d47442 /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parent2470d260e42980f4c7d2ade2154cf30021a50613 (diff)
Save off foreground user id before passing the message to the handler on
user switches Tag: #feature Bug: 228920751 Test: Manual Ignore-AOSP-First: Code only present in tm-dev Change-Id: Ic7d3c94880832f240f9d85b850cf2ce9936e3622 (cherry picked from commit eda5120b133e6f55951287b1dd85b4bd290a60e7) Merged-In: Ic7d3c94880832f240f9d85b850cf2ce9936e3622
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothManagerService.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index 4ee392f08d..ff1d861293 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -1548,7 +1548,14 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
if (DBG) {
Log.d(TAG, "User " + userHandle + " switched");
}
- mHandler.obtainMessage(MESSAGE_USER_SWITCHED, userHandle.getIdentifier(), 0).sendToTarget();
+
+ // 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();
}
/**
@@ -2377,12 +2384,6 @@ 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);