blob: 4e529d28186da9c2017ac93a37b4dc2187a153c2 [file] [log] [blame]
Tim Zimmermannb7dca122024-01-20 05:54:32 +01001/*
2 * Copyright (C) 2024 The LineageOS Project
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#pragma once
8
9namespace aidl {
10namespace android {
11namespace hardware {
12namespace biometrics {
13namespace fingerprint {
14
15#define LOCKOUT_TIMED_THRESHOLD 5
16#define LOCKOUT_TIMED_DURATION 30 * 1000
17#define LOCKOUT_PERMANENT_THRESHOLD 20
18
19enum class LockoutMode {
20 NONE,
21 TIMED,
22 PERMANENT
23};
24
25class LockoutTracker {
26public:
27 void reset(bool clearAttemptCounter);
28 LockoutMode getMode();
29 void addFailedAttempt();
30 int64_t getLockoutTimeLeft();
31
32private:
33 int32_t mFailedCount = 0;
34 int64_t mLockoutTimedStart;
35 LockoutMode mCurrentMode;
36};
37
38} // namespace fingerprint
39} // namespace biometrics
40} // namespace hardware
41} // namespace android
42} // namespace aidl