summaryrefslogtreecommitdiff
path: root/services/coverage/java
diff options
context:
space:
mode:
author Yasin Kilicdere <tyk@google.com> 2023-01-11 21:23:17 +0000
committer Yasin Kilicdere <tyk@google.com> 2023-01-17 11:43:22 +0000
commit85da667c3391309b6e2128dc8efa0b4975b3d3b0 (patch)
treeb2927afe76fc44aeba1be6ad9ab150ed95cd6953 /services/coverage/java
parentc1de654155fb1c6b820916a92134441905ba0c50 (diff)
Prevent removing the current user or the target user of user switch.
UserController.switchUser and UserController.startUserInternal both share a validation check logic but the validation code is duplicated. When switching a user, switchUser runs the validation checks, and if they pass, it sets mTargetUserId and starts a call chain that eventually calls startUserInternal. Currently the validation checks are in sync, but if some other validation would be added to startUserInternal but not in switchUser, then even though switchUser returns true, it can fail asynchronously while starting the user in startUserInternal. So it's not safe to remove the current user after starting a switch. Also currently it is possible to remove the target user during an ongoing switch, which is also wrong. This CL prevents removing the current user, or both current and target users in case there is an ongoing user switch. This CL also changes exiting tests to work with these new rules and also adds new tests for coverage. Bug: 264667155 Test: atest FrameworksServicesTests:com.android.server.pm.UserLifecycleStressTest#switchToExistingGuestAndStartOverStressTest Test: atest FrameworksMockingServicesTests:com.android.server.pm.UserManagerServiceTest#testGetCurrentAndTargetUserIds Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserShouldNotRemoveCurrentUser Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserShouldNotRemoveCurrentUser_DuringUserSwitch Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserShouldNotRemoveTargetUser_DuringUserSwitch Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserWhenPossible_currentUserSetEphemeral_duringUserSwitch Test: atest FrameworksServicesTests:com.android.server.pm.UserManagerTest#testRemoveUserWhenPossible_targetUserSetEphemeral_duringUserSwitch Change-Id: I8db44b6bbc3c1c57b9bebe0d27be068ea2b654ed
Diffstat (limited to 'services/coverage/java')
0 files changed, 0 insertions, 0 deletions