Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4484bac authored by Lenka Trochtova's avatar Lenka Trochtova
Browse files

Stop and remove the ephemeral user when it goes to background.

BUG: 24883058

Change-Id: I0e15487fafe08234cde5eebfb9f1d7b96fc7f9fe
parent 3510bd9b
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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);
    }