Fixed current user on legacy Android switch HAL call.
Test: atest CarUserServiceTest UserHalHelperTest
Fixes: 158259354
Change-Id: I8b8097f09f74f7691e950fb80bd596a5fa2642e9
diff --git a/service/src/com/android/car/user/CarUserService.java b/service/src/com/android/car/user/CarUserService.java
index bd45abb..62b01f0 100644
--- a/service/src/com/android/car/user/CarUserService.java
+++ b/service/src/com/android/car/user/CarUserService.java
@@ -1626,11 +1626,17 @@
private void notifyHalLegacySwitch(@UserIdInt int fromUserId, @UserIdInt int toUserId) {
synchronized (mLockUser) {
- if (mUserIdForUserSwitchInProcess != UserHandle.USER_NULL) return;
+ if (mUserIdForUserSwitchInProcess != UserHandle.USER_NULL) {
+ if (Log.isLoggable(TAG_USER, Log.DEBUG)) {
+ Log.d(TAG, "notifyHalLegacySwitch(" + fromUserId + ", " + toUserId
+ + "): not needed, normal switch for " + mUserIdForUserSwitchInProcess);
+ }
+ return;
+ }
}
// switch HAL user
- UsersInfo usersInfo = UserHalHelper.newUsersInfo(mUserManager);
+ UsersInfo usersInfo = UserHalHelper.newUsersInfo(mUserManager, fromUserId);
SwitchUserRequest request = createUserSwitchRequest(toUserId, usersInfo);
mHal.legacyUserSwitch(request);
}