diff options
| -rw-r--r-- | services/core/java/com/android/server/am/UserController.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java index 43d4e775a098..20b1e6058224 100644 --- a/services/core/java/com/android/server/am/UserController.java +++ b/services/core/java/com/android/server/am/UserController.java @@ -432,6 +432,10 @@ final class UserController { synchronized (mService) { mService.mStackSupervisor.removeUserLocked(userId); } + // Remove the user if it is ephemeral. + if (getUserInfo(userId).isEphemeral()) { + mUserManager.removeUser(userId); + } } } @@ -478,9 +482,9 @@ final class UserController { } /** - * Stops the guest user if it has gone to the background. + * Stops the guest or ephemeral user if it has gone to the background. */ - private void stopGuestUserIfBackground() { + private void stopGuestOrEphemeralUserIfBackground() { synchronized (mService) { final int num = mUserLru.size(); for (int i = 0; i < num; i++) { @@ -492,7 +496,7 @@ final class UserController { continue; } UserInfo userInfo = getUserInfo(oldUserId); - if (userInfo.isGuest()) { + if (userInfo.isGuest() || userInfo.isEphemeral()) { // This is a user to be stopped. stopUsersLocked(oldUserId, true, null); break; @@ -918,7 +922,7 @@ final class UserController { mHandler.sendMessage(mHandler.obtainMessage(REPORT_USER_SWITCH_COMPLETE_MSG, newUserId, 0)); } - stopGuestUserIfBackground(); + stopGuestOrEphemeralUserIfBackground(); stopBackgroundUsersIfEnforced(oldUserId); } |