diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-14 01:54:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-14 01:54:55 +0000 |
commit | 950b40e0aa27f44c3eb3b7d18c16166449d5f82b (patch) | |
tree | 07e2c67443b52961d4487214db0f26d68122e1ae /service/java/com/android/server/bluetooth/BluetoothManagerService.java | |
parent | 625d6a1000afeb1c2b35425f2dcc5728069fb43d (diff) | |
parent | 89a006312b0dc1b326abf48dddfb62e78495db2d (diff) |
Merge cherrypicks of [17749071] into tm-release.
Change-Id: Ib5dcc6e61670c0cf160e8d02d74dc04537b5ec4c
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r-- | service/java/com/android/server/bluetooth/BluetoothManagerService.java | 15 |
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); |