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

Commit 4ad301ad authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Count incorrect password attempts from shell."

parents 6de67840 c07067d9
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -156,21 +156,24 @@ class LockSettingsShellCommand extends ShellCommand {
        getOutPrintWriter().println("Lock screen disabled set to " + disabled);
    }

    private boolean checkCredential() throws RemoteException, RequestThrottledException {
    private boolean checkCredential() throws RemoteException {
        final boolean havePassword = mLockPatternUtils.isLockPasswordEnabled(mCurrentUserId);
        final boolean havePattern = mLockPatternUtils.isLockPatternEnabled(mCurrentUserId);
        if (havePassword || havePattern) {
            boolean result;
            try {
                final boolean result;
                if (havePassword) {
                    result = mLockPatternUtils.checkPassword(mOld, mCurrentUserId);
                } else {
                result = mLockPatternUtils.checkPattern(stringToPattern(mOld),
                        mCurrentUserId);
                    result = mLockPatternUtils.checkPattern(stringToPattern(mOld), mCurrentUserId);
                }
            if (result) {
                return true;
            } else {
                if (!result) {
                    mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId);
                    getOutPrintWriter().println("Old password '" + mOld + "' didn't match");
                }
                return result;
            } catch (RequestThrottledException e) {
                getOutPrintWriter().println("Request throttled");
                return false;
            }
        } else {