Adb shell correctly resets the failed password attempts count.
Fixes: 110945754
Test: in adb shell, before this change was in effect, the following
commands would result in a wipe, when the max password failures is set
to 3 in TestDPC. Now they do not:
cmd lock_settings verify --user 0 --old "wrongpassword"
cmd lock_settings verify --user 0 --old "wrongpassword"
cmd lock_settings verify --user 0 --old "correctpassword"
cmd lock_settings verify --user 0 --old "wrongpassword"
Change-Id: Iba949c2942beb5038f8d83e76da8818cb11918c8
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
index 085d17d..07f23ce 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsShellCommand.java
@@ -228,6 +228,9 @@
mLockPatternUtils.reportFailedPasswordAttempt(mCurrentUserId);
}
getOutPrintWriter().println("Old password '" + mOld + "' didn't match");
+ } else {
+ // Resets the counter for failed password attempts to 0.
+ mLockPatternUtils.reportSuccessfulPasswordAttempt(mCurrentUserId);
}
return result;
} catch (RequestThrottledException e) {