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

Skip to content
Commit ecdc6fb6 authored by Felipe Leme's avatar Felipe Leme
Browse files

Fixed (again :-( `am start-user` for profiles.

Previously it was requiring the caller to explicitly pass
--force-invisible to start a profile invisible when its parent is not
the current user, but that would break existing CTS tests.

Here's an example on how to reproduce the issue:

$ adb shell pm create-user --profileOf 0 --user-type android.os.usertype.profile.CLONE DollyTheSheep
Success: created user id 12

$ adb shell pm create-user Homer
Success: created user id 13

$ adb shell am switch-user 13
$ adb shell cmd user list --all -v

3 users:

0: id=0, name=Owner, type=full.SYSTEM, flags=ADMIN|FULL|INITIALIZED|MAIN|PRIMARY|SYSTEM (running)
1: id=12, name=DollyTheSheep, type=profile.CLONE, flags=PROFILE (parentId=0)
2: id=13, name=Homer, type=full.SECONDARY, flags=FULL|INITIALIZED (running) (current) (visible)

$ adb shell am start-user 12
Error: could not start user

03-07 22:56:32.621 22936 28819 W UserVisibilityMediator: getUserVisibilityOnStartLocked(12, 0, BACKGROUND_VISIBLE, 0) failed: cannot start profile user visible when its parent is not visible in that display

$ adb shell cmd user is-user-visible 12
false

And how it's working now:

$ adb shell am get-current-user
13

$ adb shell am start-user 12
Success: user started

$ adb shell cmd user is-user-visible 12
false

$ adb shell cmd user list --all -v

3 users:

0: id=0, name=Owner, type=full.SYSTEM, flags=ADMIN|FULL|INITIALIZED|MAIN|PRIMARY|SYSTEM (running)
1: id=12, name=DollyTheSheep, type=profile.CLONE, flags=INITIALIZED|PROFILE (parentId=0) (running)
2: id=13, name=Homer, type=full.SECONDARY, flags=FULL|INITIALIZED (running) (current) (visible)

Test: see above
Fixes: 272089437

Change-Id: Ib9cc2d3bf4092bf7899a7b7e9d9bb4bf904c5a4a
parent 3fd4802d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment