From 41de6a3dac5177b9528efd840981f55701f36eb2 Mon Sep 17 00:00:00 2001 From: Jan Altensen Date: Wed, 21 Aug 2019 23:34:48 +0200 Subject: [PATCH] samsung: hidl: fingerprint: call notify on cancel Change-Id: Idb1b3200e571c546441fa9c0cfd1a1728e165a96 --- hidl/fingerprint/Android.mk | 4 ++++ hidl/fingerprint/BiometricsFingerprint.cpp | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/hidl/fingerprint/Android.mk b/hidl/fingerprint/Android.mk index 8f644b06..9070cd85 100644 --- a/hidl/fingerprint/Android.mk +++ b/hidl/fingerprint/Android.mk @@ -31,6 +31,10 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ android.hardware.biometrics.fingerprint@2.1 +ifeq ($(TARGET_SEC_FP_CALL_NOTIFY_ON_CANCEL),true) + LOCAL_CFLAGS += -DCALL_NOTIFY_ON_CANCEL +endif + ifeq ($(TARGET_SEC_FP_USES_PERCENTAGE_SAMPLES),true) LOCAL_CFLAGS += -DUSES_PERCENTAGE_SAMPLES endif diff --git a/hidl/fingerprint/BiometricsFingerprint.cpp b/hidl/fingerprint/BiometricsFingerprint.cpp index bb27999b..f9b3d15f 100644 --- a/hidl/fingerprint/BiometricsFingerprint.cpp +++ b/hidl/fingerprint/BiometricsFingerprint.cpp @@ -173,7 +173,18 @@ Return BiometricsFingerprint::getAuthenticatorId() { } Return BiometricsFingerprint::cancel() { - return ErrorFilter(ss_fingerprint_cancel()); + int32_t ret = ss_fingerprint_cancel(); + +#ifdef CALL_NOTIFY_ON_CANCEL + if (ret == 0) { + fingerprint_msg_t msg{}; + msg.type = FINGERPRINT_ERROR; + msg.data.error = FINGERPRINT_ERROR_CANCELED; + notify(&msg); + } +#endif + + return ErrorFilter(ret); } Return BiometricsFingerprint::enumerate() {