You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
782 B
43 lines
782 B
10 months ago
|
/*
|
||
|
* Copyright (C) 2024 The LineageOS Project
|
||
|
*
|
||
|
* SPDX-License-Identifier: Apache-2.0
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
namespace aidl {
|
||
|
namespace android {
|
||
|
namespace hardware {
|
||
|
namespace biometrics {
|
||
|
namespace fingerprint {
|
||
|
|
||
|
#define LOCKOUT_TIMED_THRESHOLD 5
|
||
|
#define LOCKOUT_TIMED_DURATION 30 * 1000
|
||
|
#define LOCKOUT_PERMANENT_THRESHOLD 20
|
||
|
|
||
|
enum class LockoutMode {
|
||
|
NONE,
|
||
|
TIMED,
|
||
|
PERMANENT
|
||
|
};
|
||
|
|
||
|
class LockoutTracker {
|
||
|
public:
|
||
|
void reset(bool clearAttemptCounter);
|
||
|
LockoutMode getMode();
|
||
|
void addFailedAttempt();
|
||
|
int64_t getLockoutTimeLeft();
|
||
|
|
||
|
private:
|
||
|
int32_t mFailedCount = 0;
|
||
|
int64_t mLockoutTimedStart;
|
||
|
LockoutMode mCurrentMode;
|
||
|
};
|
||
|
|
||
|
} // namespace fingerprint
|
||
|
} // namespace biometrics
|
||
|
} // namespace hardware
|
||
|
} // namespace android
|
||
|
} // namespace aidl
|