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

Commit 79b37bdb authored by Yasin Kilicdere's avatar Yasin Kilicdere Committed by Android (Google) Code Review
Browse files

Merge "Move UMS.markEphemeralUsersForRemoval earlier in the boot." into main

parents 6d0093ab 01b3bcaa
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -1060,8 +1060,6 @@ public class UserManagerService extends IUserManager.Stub {
        if (isAutoLockingPrivateSpaceOnRestartsEnabled()) {
            autoLockPrivateSpace();
        }

        markEphemeralUsersForRemoval();
    }

    private boolean isAutoLockingPrivateSpaceOnRestartsEnabled() {
@@ -1098,21 +1096,6 @@ public class UserManagerService extends IUserManager.Stub {
        }
    }

    /** Marks all ephemeral users as slated for deletion. **/
    private void markEphemeralUsersForRemoval() {
        synchronized (mUsersLock) {
            final int userSize = mUsers.size();
            for (int i = 0; i < userSize; i++) {
                final UserInfo ui = mUsers.valueAt(i).info;
                if (ui.isEphemeral() && !ui.preCreated && ui.id != UserHandle.USER_SYSTEM) {
                    addRemovingUserIdLocked(ui.id);
                    ui.partial = true;
                    ui.flags |= UserInfo.FLAG_DISABLED;
                }
            }
        }
    }

    /* Prunes out any partially created or partially removed users. */
    private void cleanupPartialUsers() {
        ArrayList<UserInfo> partials = new ArrayList<>();
@@ -4223,6 +4206,13 @@ public class UserManagerService extends IUserManager.Stub {
                                            || mNextSerialNumber <= userData.info.id) {
                                        mNextSerialNumber = userData.info.id + 1;
                                    }
                                    if (userData.info.isEphemeral() && !userData.info.preCreated
                                            && userData.info.id != UserHandle.USER_SYSTEM) {
                                        // Mark ephemeral user as slated for deletion.
                                        addRemovingUserIdLocked(userData.info.id);
                                        userData.info.partial = true;
                                        userData.info.flags |= UserInfo.FLAG_DISABLED;
                                    }
                                }
                            }
                        } else if (name.equals(TAG_GUEST_RESTRICTIONS)) {