Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a0327f0b authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Reset mTargetUserId and dismiss UserSwitchingDialog if startUser fails

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
we would end up with a wrong mTargetUserId and an undismissed
UserSwitchingDialog.

If UserSwitchingDialog is not dismissed, device would be unusable.
If mTargetUserId holds wrong value, ActivityManager.getCurrentUser()
would return a wrong current user id since the call chain ends in
UserController.getCurrentOrTargetUserId(), which would return the
mTargetUserId since it won't be UserHandle.USER_NULL.

This CL resets mTargetUserId and dismisses UserSwitchingDialog if
UserController.startUserInForeground() fails.

Bug: 264999003
Test: atest FrameworksServicesTests:UserControllerTest
Change-Id: I308cc017518a0899b10fc87a86273a9e84f6b70f
parent 719d7559
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment