Loading services/core/java/com/android/server/am/ActivityManagerShellCommand.java +12 −5 Original line number Diff line number Diff line Loading @@ -1759,7 +1759,7 @@ final class ActivityManagerShellCommand extends ShellCommand { return 0; } private void switchUserAndWaitForComplete(int userId) throws RemoteException { private boolean switchUserAndWaitForComplete(int userId) throws RemoteException { // Register switch observer. final CountDownLatch switchLatch = new CountDownLatch(1); mInterface.registerUserSwitchObserver( Loading @@ -1773,7 +1773,7 @@ final class ActivityManagerShellCommand extends ShellCommand { }, ActivityManagerShellCommand.class.getName()); // Switch. mInterface.switchUser(userId); boolean switched = mInterface.switchUser(userId); // Wait. try { Loading @@ -1781,6 +1781,7 @@ final class ActivityManagerShellCommand extends ShellCommand { } catch (InterruptedException e) { getErrPrintWriter().println("Thread interrupted unexpectedly."); } return switched; } int runSwitchUser(PrintWriter pw) throws RemoteException { Loading @@ -1802,12 +1803,18 @@ final class ActivityManagerShellCommand extends ShellCommand { } int userId = Integer.parseInt(getNextArgRequired()); boolean switched; if (wait) { switchUserAndWaitForComplete(userId); switched = switchUserAndWaitForComplete(userId); } else { mInterface.switchUser(userId); switched = mInterface.switchUser(userId); } if (switched) { return 0; } else { pw.printf("Failed to switch to user %d\n", userId); return 1; } } int runGetCurrentUser(PrintWriter pw) throws RemoteException { Loading Loading
services/core/java/com/android/server/am/ActivityManagerShellCommand.java +12 −5 Original line number Diff line number Diff line Loading @@ -1759,7 +1759,7 @@ final class ActivityManagerShellCommand extends ShellCommand { return 0; } private void switchUserAndWaitForComplete(int userId) throws RemoteException { private boolean switchUserAndWaitForComplete(int userId) throws RemoteException { // Register switch observer. final CountDownLatch switchLatch = new CountDownLatch(1); mInterface.registerUserSwitchObserver( Loading @@ -1773,7 +1773,7 @@ final class ActivityManagerShellCommand extends ShellCommand { }, ActivityManagerShellCommand.class.getName()); // Switch. mInterface.switchUser(userId); boolean switched = mInterface.switchUser(userId); // Wait. try { Loading @@ -1781,6 +1781,7 @@ final class ActivityManagerShellCommand extends ShellCommand { } catch (InterruptedException e) { getErrPrintWriter().println("Thread interrupted unexpectedly."); } return switched; } int runSwitchUser(PrintWriter pw) throws RemoteException { Loading @@ -1802,12 +1803,18 @@ final class ActivityManagerShellCommand extends ShellCommand { } int userId = Integer.parseInt(getNextArgRequired()); boolean switched; if (wait) { switchUserAndWaitForComplete(userId); switched = switchUserAndWaitForComplete(userId); } else { mInterface.switchUser(userId); switched = mInterface.switchUser(userId); } if (switched) { return 0; } else { pw.printf("Failed to switch to user %d\n", userId); return 1; } } int runGetCurrentUser(PrintWriter pw) throws RemoteException { Loading