Do not remove the k_k until all users are unlocked

The key in keystore is used to encrypt the escrow data. We need to
iterate over all users before deleting it from key store. Otherwise,
the RoR for the 2nd user will fail.

Bug: 172780686
Test: atest CtsAppSecurityHostTestCases:ResumeOnRebootHostTest#resumeOnReboot_TwoUsers_BothUserUnlock_Success
Change-Id: I82d94195fe5716d42e363604be5ead3eb3e300fd
This commit is contained in:
Tianjie
2021-01-13 23:40:18 -08:00
parent 3b26172c84
commit 4ec033ca8a

View File

@@ -224,6 +224,10 @@ class RebootEscrowManager {
for (UserInfo user : rebootEscrowUsers) {
allUsersUnlocked &= restoreRebootEscrowForUser(user.id, escrowKey, kk);
}
// Clear the old key in keystore. A new key will be generated by new RoR requests.
mKeyStoreManager.clearKeyStoreEncryptionKey();
onEscrowRestoreComplete(allUsersUnlocked);
}
@@ -273,9 +277,6 @@ class RebootEscrowManager {
} catch (IOException e) {
Slog.w(TAG, "Could not load reboot escrow data for user " + userId, e);
return false;
} finally {
// Clear the old key in keystore. A new key will be generated by new RoR requests.
mKeyStoreManager.clearKeyStoreEncryptionKey();
}
}