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

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

Further improvements on isUserVisibleOnDisplay(userId, displayId).

Commit d4c41e18ca3b4767907ca6ca57ce8341cdae9f25 changed this method
behavior to always return true to the current user (and their
profiles); that should be the case on most cases, except when
the display is assigned to another user (i.e., a background user
that was started on that display).

This CL partially fixes that issue - it only returns true for the
current / user profile when a display is not assigned to another
user. It's not the ideal solution yet, because it would still fail
in 2 scenarios:

- It would allow the current user to be visible in a secondary
  display that is not being used by a passenger yet.
- It would not handle the case where the a virtual display should
  be visible only to the user that created it.

This CL also:

* Changed it to always return false for INVALID_DISPLAY
* Changed the is-user-visible command to allow INVALID_DISPLAY.
* Fixed startUserInternal() so assignUserToDisplay() is only called
  after checking if the user exists.

Test: atest FrameworksMockingServicesTests:com.android.server.pm.UserManagerServiceTest UserManagerInternalTest
Test: adb shell am start-user --display 42 13 && \
      adb shell cmd user is-user-visible --display 42 0 &&
      adb shell cmd user is-user-visible --display -1 0

Bug: 244644281
Change-Id: I2803e0b5d49b8a729266e534bbe203e346720417
parent c1527fea
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