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

Commit 22b672bb authored by Eric Biggers's avatar Eric Biggers Committed by Android (Google) Code Review
Browse files

Merge "Fix locksettings state removal on user removal"

parents 7045f87e 09540157
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -5519,6 +5519,13 @@ public class UserManagerService extends IUserManager.Stub {


    private void removeUserState(final @UserIdInt int userId) {
    private void removeUserState(final @UserIdInt int userId) {
        Slog.i(LOG_TAG, "Removing user state of user " + userId);
        Slog.i(LOG_TAG, "Removing user state of user " + userId);

        // Cleanup lock settings.  This must happen before destroyUserKey(), since the user's DE
        // storage must still be accessible for the lock settings state to be properly cleaned up.
        mLockPatternUtils.removeUser(userId);

        // Evict and destroy the user's CE and DE encryption keys.  At this point, the user's CE and
        // DE storage is made inaccessible, except to delete its contents.
        try {
        try {
            mContext.getSystemService(StorageManager.class).destroyUserKey(userId);
            mContext.getSystemService(StorageManager.class).destroyUserKey(userId);
        } catch (IllegalStateException e) {
        } catch (IllegalStateException e) {
@@ -5526,9 +5533,6 @@ public class UserManagerService extends IUserManager.Stub {
            Slog.i(LOG_TAG, "Destroying key for user " + userId + " failed, continuing anyway", e);
            Slog.i(LOG_TAG, "Destroying key for user " + userId + " failed, continuing anyway", e);
        }
        }


        // Cleanup lock settings
        mLockPatternUtils.removeUser(userId);

        // Cleanup package manager settings
        // Cleanup package manager settings
        mPm.cleanUpUser(this, userId);
        mPm.cleanUpUser(this, userId);