Update getUserSwitchability() to handle different user ids and Auto

User switcher is in SystemUI which runs in User 0.
UserManager.getUserSwitchability() currently checks for the
DISALLOW_USER_SWITCH only on the process's user id rather than the
foreground user's id. This is causing a bug where we're using the wrong
user to check for user restrictions.

This CL updates getUserSwitchability to handle different user ids and
updates UserSwitcherController to use the new API.

This also introduces Headless System User support which only runs a
subset of the logic.

Fixes: 143298605
Test: [1] Enable multi-user
[2] Create a new secondary user
[3] Switch to new secondary user (assume to be user 10)
[4] adb root && adb shell pm set-user-restriction --user 10 no_user_switch 1
[5] Can't user switch
[6] adb root && adb shell pm set-user-restriction --user 10 no_user_switch 0
[7] Can user switch

Change-Id: Id039e2afd01a53116700c08177eb4e599a871946
2 files changed