Loading services/core/java/com/android/server/am/ActivityManagerShellCommand.java +28 −22 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.app.IActivityManager; import android.app.IActivityTaskManager; import android.app.IStopUserCallback; import android.app.IUidObserver; import android.app.IUserSwitchObserver; import android.app.KeyguardManager; import android.app.ProfilerInfo; import android.app.RemoteServiceException.CrashedByAdbException; Loading Loading @@ -1951,15 +1952,17 @@ final class ActivityManagerShellCommand extends ShellCommand { // Register switch observer. final CountDownLatch switchLatch = new CountDownLatch(1); mInterface.registerUserSwitchObserver( new UserSwitchObserver() { final IUserSwitchObserver userSwitchObserver = new UserSwitchObserver() { @Override public void onUserSwitchComplete(int newUserId) { if (userId == newUserId) { switchLatch.countDown(); } } }, ActivityManagerShellCommand.class.getName()); }; try { mInterface.registerUserSwitchObserver(userSwitchObserver, ActivityManagerShellCommand.class.getName()); // Switch. boolean switched = mInterface.switchUser(userId); Loading @@ -1976,6 +1979,9 @@ final class ActivityManagerShellCommand extends ShellCommand { } return switched; } finally { mInterface.unregisterUserSwitchObserver(userSwitchObserver); } } int runSwitchUser(PrintWriter pw) throws RemoteException { Loading Loading
services/core/java/com/android/server/am/ActivityManagerShellCommand.java +28 −22 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.app.IActivityManager; import android.app.IActivityTaskManager; import android.app.IStopUserCallback; import android.app.IUidObserver; import android.app.IUserSwitchObserver; import android.app.KeyguardManager; import android.app.ProfilerInfo; import android.app.RemoteServiceException.CrashedByAdbException; Loading Loading @@ -1951,15 +1952,17 @@ final class ActivityManagerShellCommand extends ShellCommand { // Register switch observer. final CountDownLatch switchLatch = new CountDownLatch(1); mInterface.registerUserSwitchObserver( new UserSwitchObserver() { final IUserSwitchObserver userSwitchObserver = new UserSwitchObserver() { @Override public void onUserSwitchComplete(int newUserId) { if (userId == newUserId) { switchLatch.countDown(); } } }, ActivityManagerShellCommand.class.getName()); }; try { mInterface.registerUserSwitchObserver(userSwitchObserver, ActivityManagerShellCommand.class.getName()); // Switch. boolean switched = mInterface.switchUser(userId); Loading @@ -1976,6 +1979,9 @@ final class ActivityManagerShellCommand extends ShellCommand { } return switched; } finally { mInterface.unregisterUserSwitchObserver(userSwitchObserver); } } int runSwitchUser(PrintWriter pw) throws RemoteException { Loading