Check if current profile is being removed in IMMS
This adds a check in onUserRemoved inside IMMS, for the userId to be removed matching currentImeUserId. If the user is on a work profile app, goes directly to the lock screen (which is locked with a pattern / pin), and triggers a work profile wipe due to failed unlock attempt, the currentImeUserId in IMMS will remain on the now removed work profile, which will essentially block any further requests to start an input connection. The requests are blocked in startInputOrWindowGainedFocus, as the passed in userId will not be one of the profiles associated with the currentImeUserId (as this was removed, so it won't have any profiles). This still passes in the majority of the cases as we reach the check mentioned above before the currentImeUserId is fully removed from UserManager. If the currentImeUserId is being removed, we can simply fall back to the currentUserId of ActivityManager, which is a non-profile user. The only case where the currentImeUserId can be the one being removed is when it is actually a profile user. When a non-profile user is the current user, it cannot be removed, so it would require switching to a different non-profile user, which we handle in onUserSwitched already. Falling back to the current non-profile user will recover gracefully in all situations, as we allow starting input on any profile of currentImeUserId. Flag: EXEMPT bugfix Bug: 341078907 Test: MultiUserMockImeTest#testRemoveCurrentProfileCanStartInputOnOtherUser Change-Id: I0d22aae115705381f5f74dfd4cf878443eef6027
Loading
Please register or sign in to comment