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

Commit f19e0217 authored by Yuncheol Heo's avatar Yuncheol Heo
Browse files

Allow to show non-current users.

- Traditionally, we only show the current user and its profile users.
  But, to support the multi-display, multi-user system, we'd like to
  show the background users too.
- This CL will replace WMS.isCurrentProfile() with UMI.isUserVisible().

Bug: 239828153
Test: atest WmTests
Change-Id: Ie432e413aab256b6bac5d4537d19bdcbb0dd8956
parent 833fb8b8
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -373,12 +373,6 @@
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/TransitionController.java"
      "at": "com\/android\/server\/wm\/TransitionController.java"
    },
    },
    "-1750384749": {
      "message": "Launch on display check: allow launch on public display",
      "level": "DEBUG",
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/ActivityTaskSupervisor.java"
    },
    "-1750206390": {
    "-1750206390": {
      "message": "Exception thrown when creating surface for client %s (%s). %s",
      "message": "Exception thrown when creating surface for client %s (%s). %s",
      "level": "WARN",
      "level": "WARN",
@@ -907,6 +901,12 @@
      "group": "WM_DEBUG_BOOT",
      "group": "WM_DEBUG_BOOT",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    },
    "-1253056469": {
      "message": "Launch on display check: %s launch for userId=%d on displayId=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/ActivityTaskSupervisor.java"
    },
    "-1248645819": {
    "-1248645819": {
      "message": "\tAdd container=%s",
      "message": "\tAdd container=%s",
      "level": "DEBUG",
      "level": "DEBUG",
+1 −2
Original line number Original line Diff line number Diff line
@@ -1628,7 +1628,7 @@ class UserController implements Handler.Callback {
                }
                }
                mInjector.updateUserConfiguration();
                mInjector.updateUserConfiguration();
                updateCurrentProfileIds();
                updateCurrentProfileIds();
                mInjector.getWindowManager().setCurrentUser(userId, getCurrentProfileIds());
                mInjector.getWindowManager().setCurrentUser(userId);
                mInjector.reportCurWakefulnessUsageEvent();
                mInjector.reportCurWakefulnessUsageEvent();
                // Once the internal notion of the active user has switched, we lock the device
                // Once the internal notion of the active user has switched, we lock the device
                // with the option to show the user switcher on the keyguard.
                // with the option to show the user switcher on the keyguard.
@@ -1642,7 +1642,6 @@ class UserController implements Handler.Callback {
            } else {
            } else {
                final Integer currentUserIdInt = mCurrentUserId;
                final Integer currentUserIdInt = mCurrentUserId;
                updateCurrentProfileIds();
                updateCurrentProfileIds();
                mInjector.getWindowManager().setCurrentProfileIds(getCurrentProfileIds());
                synchronized (mLock) {
                synchronized (mLock) {
                    mUserLru.remove(currentUserIdInt);
                    mUserLru.remove(currentUserIdInt);
                    mUserLru.add(currentUserIdInt);
                    mUserLru.add(currentUserIdInt);
+1 −1
Original line number Original line Diff line number Diff line
@@ -9519,7 +9519,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A


    @Override
    @Override
    boolean showToCurrentUser() {
    boolean showToCurrentUser() {
        return mShowForAllUsers || mWmService.isCurrentProfile(mUserId);
        return mShowForAllUsers || mWmService.isUserVisible(mUserId);
    }
    }


    @Override
    @Override
+8 −4
Original line number Original line Diff line number Diff line
@@ -1183,10 +1183,14 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        }
        }


        if (!displayContent.isPrivate()) {
        if (!displayContent.isPrivate()) {
            // Anyone can launch on a public display.
            // Checks if the caller can be shown in the given public display.
            ProtoLog.d(WM_DEBUG_TASKS, "Launch on display check: allow launch on public "
            int userId = UserHandle.getUserId(callingUid);
                    + "display");
            int displayId = display.getDisplayId();
            return true;
            boolean allowed = mWindowManager.mUmInternal.isUserVisible(userId, displayId);
            ProtoLog.d(WM_DEBUG_TASKS,
                    "Launch on display check: %s launch for userId=%d on displayId=%d",
                    (allowed ? "allow" : "disallow"), userId, displayId);
            return allowed;
        }
        }


        // Check if the caller is the owner of the display.
        // Check if the caller is the owner of the display.
+1 −1
Original line number Original line Diff line number Diff line
@@ -2904,7 +2904,7 @@ class Task extends TaskFragment {
    @Override
    @Override
    boolean showToCurrentUser() {
    boolean showToCurrentUser() {
        return mForceShowForAllUsers || showForAllUsers()
        return mForceShowForAllUsers || showForAllUsers()
                || mWmService.isCurrentProfile(getTopMostTask().mUserId);
                || mWmService.isUserVisible(getTopMostTask().mUserId);
    }
    }


    void setForceShowForAllUsers(boolean forceShowForAllUsers) {
    void setForceShowForAllUsers(boolean forceShowForAllUsers) {
Loading