Update require permission tag for CarUserManager
Bug: 184292607
Test: atest CarServiceUnitTest:com.android.car.user.CarUserServiceTest
atest CarServiceUnitTest:com.android.car.user.CarUserManagerUnitTest
atest CarSecurityPermissionTest:com.android.car.user.CarUserManagerPermissionTest
Change-Id: I5919d0f25e9b4df32cd546bb7e40f219d7faebb0
diff --git a/service/src/com/android/car/user/CarUserService.java b/service/src/com/android/car/user/CarUserService.java
index b80be81..685a7ce 100644
--- a/service/src/com/android/car/user/CarUserService.java
+++ b/service/src/com/android/car/user/CarUserService.java
@@ -960,6 +960,10 @@
Objects.requireNonNull(receiver);
UserInfo targetUser = mUserManager.getUserInfo(targetUserId);
Preconditions.checkArgument(targetUser != null, "Target user doesn't exist");
+ if (mUserManager.getUserSwitchability() != UserManager.SWITCHABILITY_STATUS_OK) {
+ sendUserSwitchResult(receiver, UserSwitchResult.STATUS_NOT_SWITCHABLE);
+ return;
+ }
mHandler.post(()-> switchUserInternal(targetUser, timeoutMs, receiver));
}