Allow user without a password to clear credentials

Currently the code assumes that the user always has a pin or
password or pattern. If there's no password confirmKeyGuard() will
return false, so the acttivity will finish without doing anything.
With this change if there's no PIN/password/pattern, the credential
clearing task will be launched straightaway as the user presses "OK"
the confirmation prompt.

Bug: 127697771
Test: manual
Change-Id: Iac4af0abfc7430ed197e04f833bf203c3f66f52e
This commit is contained in:
Pavel Grafov
2019-04-10 16:12:55 +01:00
parent b5d6ba4caa
commit 0a67bbf89f

View File

@@ -242,15 +242,21 @@ public final class CredentialStorage extends FragmentActivity {
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
if (mResetConfirmed) { if (!mResetConfirmed) {
mResetConfirmed = false; finish();
if (confirmKeyGuard(CONFIRM_CLEAR_SYSTEM_CREDENTIAL_REQUEST)) {
// will return password value via onActivityResult
return; return;
} }
}
mResetConfirmed = false;
if (!mUtils.isSecure(UserHandle.myUserId())) {
// This task will call finish() in the end.
new ResetKeyStoreAndKeyChain().execute();
} else if (!confirmKeyGuard(CONFIRM_CLEAR_SYSTEM_CREDENTIAL_REQUEST)) {
Log.w(TAG, "Failed to launch credential confirmation for a secure user.");
finish(); finish();
} }
// Confirmation result will be handled in onActivityResult if needed.
}
} }
/** /**