samsung: hidl: fingerprint: call notify on cancel
authorJan Altensen <info@stricted.net>
Wed, 21 Aug 2019 21:34:48 +0000 (23:34 +0200)
committerJan Altensen <info@stricted.net>
Tue, 10 Mar 2020 14:41:39 +0000 (15:41 +0100)
Change-Id: Idb1b3200e571c546441fa9c0cfd1a1728e165a96

hidl/fingerprint/Android.mk
hidl/fingerprint/BiometricsFingerprint.cpp

index 8f644b068ee38b1dfc4ab161bd3931db885d887f..9070cd855640a4ff99280dc53f25f19ab0ee7f30 100644 (file)
@@ -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
index bb27999b85b9fe89e344fd00ebb58a1c1e72b72c..f9b3d15f04cb3aa9fa83e728d1f3b464b208c02d 100644 (file)
@@ -173,7 +173,18 @@ Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
 }
 
 Return<RequestStatus> 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<RequestStatus> BiometricsFingerprint::enumerate() {