Skip to content

Commit fa227e9

Browse files
xdevs23Simon1511
andcommitted
aidl: fingerprint: allow to delay onPointerDown for screen off
Devices with optical Goodix UDFPS sensors fail with TOO_FAST during screen off unlocking due to the screen not being on yet. Defer onPointerDown only during screen off UDFPS unlocking by setting `ro.vendor.fingerprint.screen_off_press_delay` property to the amount of miliseconds that it should be delayed by. Co-authored-by: Simon1511 <me@simon1511.de> Change-Id: Idd5811723ba2d69579f35649fe395b71713c59f5
1 parent 8e4b2d1 commit fa227e9

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

aidl/fingerprint/Session.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2024 The LineageOS Project
2+
* Copyright (C) 2024-2026 The LineageOS Project
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -243,14 +243,23 @@ ndk::ScopedAStatus Session::detectInteractionWithContext(
243243
}
244244

245245
ndk::ScopedAStatus Session::onPointerDownWithContext(const PointerContext& context) {
246+
int screenOffPressDelayMs = FingerprintHalProperties::screen_off_press_delay().value_or(0);
247+
248+
if (screenOffPressDelayMs > 0) {
249+
if (context.isAod && mDisplayState == DisplayState::NO_UI) {
250+
std::this_thread::sleep_for(std::chrono::milliseconds(screenOffPressDelayMs));
251+
}
252+
}
253+
246254
return onPointerDown(context.pointerId, context.x, context.y, context.minor, context.major);
247255
}
248256

249257
ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& context) {
250258
return onPointerUp(context.pointerId);
251259
}
252260

253-
ndk::ScopedAStatus Session::onContextChanged(const OperationContext& /*context*/) {
261+
ndk::ScopedAStatus Session::onContextChanged(const OperationContext& context) {
262+
mDisplayState = context.displayState;
254263
return ndk::ScopedAStatus::ok();
255264
}
256265

aidl/fingerprint/Session.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2024 The LineageOS Project
2+
* Copyright (C) 2024-2026 The LineageOS Project
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -16,6 +16,7 @@
1616

1717
#define FINGERPRINT_DATA_DIR "/data/vendor/biometrics/fp/User_%d/"
1818

19+
using ::aidl::android::hardware::biometrics::common::DisplayState;
1920
using ::aidl::android::hardware::biometrics::common::ICancellationSignal;
2021
using ::aidl::android::hardware::biometrics::common::OperationContext;
2122
using ::aidl::android::hardware::biometrics::fingerprint::PointerContext;
@@ -96,6 +97,8 @@ class Session : public BnSession {
9697

9798
// Binder death handler.
9899
AIBinder_DeathRecipient* mDeathRecipient;
100+
101+
DisplayState mDisplayState;
99102
};
100103

101104
} // namespace fingerprint

aidl/fingerprint/fingerprint.sysprop

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,12 @@ prop {
7676
access: Readonly
7777
api_name: "cancel_on_enroll_completion"
7878
}
79+
80+
# amount of milliseconds by which onPointerDown will be delayed during screen off UDFPS (default: 0)
81+
prop {
82+
prop_name: "ro.vendor.fingerprint.screen_off_press_delay"
83+
type: Integer
84+
scope: Internal
85+
access: Readonly
86+
api_name: "screen_off_press_delay"
87+
}

0 commit comments

Comments
 (0)