Reject profiles, guest users and restricted profiles in setUserAdmin()
These users should not be allowed to become admin.
Bug: 411194997
Test: atest FrameworksServicesTests
--test-filter=".UserManagerTest#testSetUserAdmin.*"
Test: Manually test with CL:33082444 as follows:
$ adb shell pm create-user --profileOf cur --managed "User11"
Success: created user id 11
$ adb shell cmd user set-user-admin 11
$ adb shell cmd user list -v | grep id=11
2: id=11, ... flags=MANAGED_PROFILE|PROFILE (parentId=10)
$ adb shell pm create-user --guest "User12"
$ adb shell cmd user set-user-admin 12
$ adb shell cmd user list -v | grep id=12
3: id=12, ... flags=EPHEMERAL|EPHEMERAL_ON_CREATE|FULL|GUEST
$ adb shell pm create-user --profileOf cur --restricted "User13"
$ adb shell cmd user set-user-admin 13
$ adb shell cmd user list -v | grep id=13
4: id=13, ... flag=FULL|RESTRICTED
Flag: EXEMPT bug fix
Change-Id: Icd65f536a71c7e18dae6bacebaae09aa09a3794f
Loading
Please register or sign in to comment