Continue to remove users when destroyUserKey fails.

destroyUserKey can fail if the user is partially created; even when
something fails it still destroys all it can. Its failure shouldn't
halt user removal.

Bug: 26847403
Change-Id: Iab1f551d19fd777198387b463b270c2508d07fd5
This commit is contained in:
Paul Crowley
2016-03-25 15:23:07 -07:00
parent 91628f6cf3
commit 91293794bf

View File

@@ -2189,7 +2189,13 @@ public class UserManagerService extends IUserManager.Stub {
}
private void removeUserState(final int userHandle) {
mContext.getSystemService(StorageManager.class).destroyUserKey(userHandle);
try {
mContext.getSystemService(StorageManager.class).destroyUserKey(userHandle);
} catch (IllegalStateException e) {
// This may be simply because the user was partially created.
Slog.i(LOG_TAG,
"Destroying key for user " + userHandle + " failed, continuing anyway", e);
}
// Cleanup package manager settings
mPm.cleanUpUser(this, userHandle);