Merge "Fix locksettings state removal on user removal"

This commit is contained in:
Eric Biggers
2022-10-19 23:18:03 +00:00
committed by Android (Google) Code Review

View File

@@ -5519,6 +5519,13 @@ public class UserManagerService extends IUserManager.Stub {
private void removeUserState(final @UserIdInt int 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 {
mContext.getSystemService(StorageManager.class).destroyUserKey(userId);
} 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);
}
// Cleanup lock settings
mLockPatternUtils.removeUser(userId);
// Cleanup package manager settings
mPm.cleanUpUser(this, userId);