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

Commit cc5d2c82 authored by Momoko Hattori's avatar Momoko Hattori
Browse files

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
parent 6c97f898
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment