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

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

Reject last full admin user in revokeUserAdmin() under a flag

Commit 35366ec0 added a config flag
(config_disallowRemovingLastAdminUser) to disallow the removal of last
full admin user on the system. When it is enabled, revokeUserAdmin()
should also avoid revoking Admin status from the last full admin user.

Bug: 411194997
Test: atest FrameworksMockingServicesTests:UserManagerServiceMockedTest
Test: Manually test with CL:33082444 as follows:
  $ adb shell cmd user list -v
  2 users:

  0: id=0, type=system.HEADLESS, flags=ADMIN|INITIALIZED|PRIMARY|SYSTEM
  1: id=10, type=full.SECONDARY, flags=ADMIN|FULL|INITIALIZED|MAIN
  $ adb shell cmd user revoke-user-admin 10
  $ adb shell cmd user list -v | grep id=10
  1: id=10, type=full.SECONDARY, flags=ADMIN|FULL|INITIALIZED|MAIN
Flag: android.multiuser.disallow_removing_last_admin_user

Change-Id: I0c7f99dcece6c01967e07c21f06c00b05e00433c
parent f59abc3d
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