Loading core/java/android/app/ActivityManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -3329,6 +3329,23 @@ public class ActivityManager { } } /** * Logs out current current foreground user by switching to the system user and stopping the * user being switched from. * @hide */ public static void logoutCurrentUser() { int currentUser = ActivityManager.getCurrentUser(); if (currentUser != UserHandle.USER_SYSTEM) { try { ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM); ActivityManagerNative.getDefault().stopUser(currentUser, /* force= */ false, null); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } } /** {@hide} */ public static final int FLAG_OR_STOPPED = 1 << 0; /** {@hide} */ Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +2 −10 Original line number Diff line number Diff line Loading @@ -315,8 +315,8 @@ public class UserSwitcherController { public void logoutCurrentUser() { int currentUser = ActivityManager.getCurrentUser(); if (currentUser != UserHandle.USER_SYSTEM) { switchToUserId(UserHandle.USER_SYSTEM); stopUserId(currentUser); pauseRefreshUsers(); ActivityManager.logoutCurrentUser(); } } Loading Loading @@ -384,14 +384,6 @@ public class UserSwitcherController { } } private void stopUserId(int id) { try { ActivityManagerNative.getDefault().stopUser(id, /* force= */ false, null); } catch (RemoteException e) { Log.e(TAG, "Couldn't stop user.", e); } } private void showExitGuestDialog(int id) { if (mExitGuestDialog != null && mExitGuestDialog.isShowing()) { mExitGuestDialog.cancel(); Loading Loading
core/java/android/app/ActivityManager.java +17 −0 Original line number Diff line number Diff line Loading @@ -3329,6 +3329,23 @@ public class ActivityManager { } } /** * Logs out current current foreground user by switching to the system user and stopping the * user being switched from. * @hide */ public static void logoutCurrentUser() { int currentUser = ActivityManager.getCurrentUser(); if (currentUser != UserHandle.USER_SYSTEM) { try { ActivityManagerNative.getDefault().switchUser(UserHandle.USER_SYSTEM); ActivityManagerNative.getDefault().stopUser(currentUser, /* force= */ false, null); } catch (RemoteException e) { e.rethrowFromSystemServer(); } } } /** {@hide} */ public static final int FLAG_OR_STOPPED = 1 << 0; /** {@hide} */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +2 −10 Original line number Diff line number Diff line Loading @@ -315,8 +315,8 @@ public class UserSwitcherController { public void logoutCurrentUser() { int currentUser = ActivityManager.getCurrentUser(); if (currentUser != UserHandle.USER_SYSTEM) { switchToUserId(UserHandle.USER_SYSTEM); stopUserId(currentUser); pauseRefreshUsers(); ActivityManager.logoutCurrentUser(); } } Loading Loading @@ -384,14 +384,6 @@ public class UserSwitcherController { } } private void stopUserId(int id) { try { ActivityManagerNative.getDefault().stopUser(id, /* force= */ false, null); } catch (RemoteException e) { Log.e(TAG, "Couldn't stop user.", e); } } private void showExitGuestDialog(int id) { if (mExitGuestDialog != null && mExitGuestDialog.isShowing()) { mExitGuestDialog.cancel(); Loading