* commit '5b78fda91e33b4fc8de5f0a8ab894941202c42cb': reset lockout deadline on device reboot
This commit is contained in:
@@ -1071,12 +1071,22 @@ public class LockPatternUtils {
|
||||
* enter a pattern.
|
||||
*/
|
||||
public long getLockoutAttemptDeadline(int userId) {
|
||||
final long deadline = getLong(LOCKOUT_ATTEMPT_DEADLINE, 0L, userId);
|
||||
long deadline = getLong(LOCKOUT_ATTEMPT_DEADLINE, 0L, userId);
|
||||
final long timeoutMs = getLong(LOCKOUT_ATTEMPT_TIMEOUT_MS, 0L, userId);
|
||||
final long now = SystemClock.elapsedRealtime();
|
||||
if (deadline < now || deadline > (now + timeoutMs)) {
|
||||
if (deadline < now) {
|
||||
// timeout expired
|
||||
setLong(LOCKOUT_ATTEMPT_DEADLINE, 0, userId);
|
||||
setLong(LOCKOUT_ATTEMPT_TIMEOUT_MS, 0, userId);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
if (deadline > (now + timeoutMs)) {
|
||||
// device was rebooted, set new deadline
|
||||
deadline = now + timeoutMs;
|
||||
setLong(LOCKOUT_ATTEMPT_DEADLINE, deadline, userId);
|
||||
}
|
||||
|
||||
return deadline;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user