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

Commit 0a67bbf8 authored by Pavel Grafov's avatar Pavel Grafov
Browse files

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
parent b5d6ba4c
Loading
Loading
Loading
Loading
+13 −7
Original line number Original line Diff line number Diff line
@@ -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.
        }
    }
    }


    /**
    /**