Loading services/core/java/com/android/server/am/UserController.java +10 −5 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ import android.util.SparseArray; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; import android.view.Display; import android.window.DesktopExperienceFlags; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -2266,7 +2267,7 @@ class UserController implements Handler.Callback { // it should be moved outside, but for now it's not as there are many calls to // external components here afterwards updateProfileRelatedCaches(); mInjector.getWindowManager().setCurrentUser(userId); mInjector.getWindowManager().setCurrentUser(userId, uss); mInjector.reportCurWakefulnessUsageEvent(); // 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. Loading Loading @@ -3221,12 +3222,16 @@ class UserController implements Handler.Callback { } private void moveUserToForeground(UserState uss, int newUserId) { if (DesktopExperienceFlags.ENABLE_APPLY_DESK_ACTIVATION_ON_USER_SWITCH.isTrue()) { mInjector.taskSupervisorResumeFocusedStackTopActivity(); } else { boolean homeInFront = mInjector.taskSupervisorSwitchUser(newUserId, uss); if (homeInFront) { mInjector.startHomeActivity(newUserId, "moveUserToForeground"); } else { mInjector.taskSupervisorResumeFocusedStackTopActivity(); } } EventLogTags.writeAmSwitchUser(newUserId); } Loading services/core/java/com/android/server/wm/WindowManagerService.java +7 −1 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.UiThread; import com.android.server.Watchdog; import com.android.server.am.UserState; import com.android.server.input.InputManagerService; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.pm.UserManagerInternal; Loading Loading @@ -3930,7 +3931,8 @@ public class WindowManagerService extends IWindowManager.Stub confirm); } public void setCurrentUser(@UserIdInt int newUserId) { /** Update the current user. */ public void setCurrentUser(@UserIdInt int newUserId, UserState uss) { synchronized (mGlobalLock) { final TransitionController controller = mAtmService.getTransitionController(); final Runnable applyUserChange = () -> { Loading @@ -3941,6 +3943,10 @@ public class WindowManagerService extends IWindowManager.Stub // Hide windows that should not be seen by the new user. mRoot.switchUser(newUserId); if (DesktopExperienceFlags.ENABLE_APPLY_DESK_ACTIVATION_ON_USER_SWITCH.isTrue()) { // Restore the new user's previous windows or home. mRoot.switchUser(newUserId, uss); } mWindowPlacerLocked.performSurfacePlacement(); // Notify whether the root docked task exists for the current user Loading services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ import android.os.Build; import android.os.IBinder; import android.os.InputConfig; import android.os.RemoteException; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; Loading Loading @@ -127,6 +128,7 @@ import androidx.test.filters.SmallTest; import com.android.compatibility.common.util.SystemUtil; import com.android.internal.R; import com.android.server.am.UserState; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.testutils.StubTransaction; import com.android.server.wm.SensitiveContentPackages.PackageInfo; Loading Loading @@ -932,7 +934,7 @@ public class WindowStateTests extends WindowTestsBase { Settings.Secure.putIntForUser(cr, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MAGNIFY_NAV_AND_IME, 0, 1); mWm.setCurrentUser(1); mWm.setCurrentUser(1, new UserState(UserHandle.of(1))); assertFalse(mWm.isMagnifyImeEnabled()); } Loading @@ -945,7 +947,7 @@ public class WindowStateTests extends WindowTestsBase { Settings.Secure.putIntForUser(cr, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MAGNIFY_NAV_AND_IME, 1, 2); mWm.setCurrentUser(2); mWm.setCurrentUser(2, new UserState(UserHandle.of(2))); assertTrue(mWm.isMagnifyImeEnabled()); } Loading Loading
services/core/java/com/android/server/am/UserController.java +10 −5 Original line number Diff line number Diff line Loading @@ -124,6 +124,7 @@ import android.util.SparseArray; import android.util.SparseIntArray; import android.util.proto.ProtoOutputStream; import android.view.Display; import android.window.DesktopExperienceFlags; import com.android.internal.R; import com.android.internal.annotations.GuardedBy; Loading Loading @@ -2266,7 +2267,7 @@ class UserController implements Handler.Callback { // it should be moved outside, but for now it's not as there are many calls to // external components here afterwards updateProfileRelatedCaches(); mInjector.getWindowManager().setCurrentUser(userId); mInjector.getWindowManager().setCurrentUser(userId, uss); mInjector.reportCurWakefulnessUsageEvent(); // 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. Loading Loading @@ -3221,12 +3222,16 @@ class UserController implements Handler.Callback { } private void moveUserToForeground(UserState uss, int newUserId) { if (DesktopExperienceFlags.ENABLE_APPLY_DESK_ACTIVATION_ON_USER_SWITCH.isTrue()) { mInjector.taskSupervisorResumeFocusedStackTopActivity(); } else { boolean homeInFront = mInjector.taskSupervisorSwitchUser(newUserId, uss); if (homeInFront) { mInjector.startHomeActivity(newUserId, "moveUserToForeground"); } else { mInjector.taskSupervisorResumeFocusedStackTopActivity(); } } EventLogTags.writeAmSwitchUser(newUserId); } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +7 −1 Original line number Diff line number Diff line Loading @@ -358,6 +358,7 @@ import com.android.server.FgThread; import com.android.server.LocalServices; import com.android.server.UiThread; import com.android.server.Watchdog; import com.android.server.am.UserState; import com.android.server.input.InputManagerService; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.pm.UserManagerInternal; Loading Loading @@ -3930,7 +3931,8 @@ public class WindowManagerService extends IWindowManager.Stub confirm); } public void setCurrentUser(@UserIdInt int newUserId) { /** Update the current user. */ public void setCurrentUser(@UserIdInt int newUserId, UserState uss) { synchronized (mGlobalLock) { final TransitionController controller = mAtmService.getTransitionController(); final Runnable applyUserChange = () -> { Loading @@ -3941,6 +3943,10 @@ public class WindowManagerService extends IWindowManager.Stub // Hide windows that should not be seen by the new user. mRoot.switchUser(newUserId); if (DesktopExperienceFlags.ENABLE_APPLY_DESK_ACTIVATION_ON_USER_SWITCH.isTrue()) { // Restore the new user's previous windows or home. mRoot.switchUser(newUserId, uss); } mWindowPlacerLocked.performSurfacePlacement(); // Notify whether the root docked task exists for the current user Loading
services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +4 −2 Original line number Diff line number Diff line Loading @@ -99,6 +99,7 @@ import android.os.Build; import android.os.IBinder; import android.os.InputConfig; import android.os.RemoteException; import android.os.UserHandle; import android.platform.test.annotations.DisableFlags; import android.platform.test.annotations.EnableFlags; import android.platform.test.annotations.Presubmit; Loading Loading @@ -127,6 +128,7 @@ import androidx.test.filters.SmallTest; import com.android.compatibility.common.util.SystemUtil; import com.android.internal.R; import com.android.server.am.UserState; import com.android.server.inputmethod.InputMethodManagerInternal; import com.android.server.testutils.StubTransaction; import com.android.server.wm.SensitiveContentPackages.PackageInfo; Loading Loading @@ -932,7 +934,7 @@ public class WindowStateTests extends WindowTestsBase { Settings.Secure.putIntForUser(cr, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MAGNIFY_NAV_AND_IME, 0, 1); mWm.setCurrentUser(1); mWm.setCurrentUser(1, new UserState(UserHandle.of(1))); assertFalse(mWm.isMagnifyImeEnabled()); } Loading @@ -945,7 +947,7 @@ public class WindowStateTests extends WindowTestsBase { Settings.Secure.putIntForUser(cr, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MAGNIFY_NAV_AND_IME, 1, 2); mWm.setCurrentUser(2); mWm.setCurrentUser(2, new UserState(UserHandle.of(2))); assertTrue(mWm.isMagnifyImeEnabled()); } Loading