summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2015-04-08 22:55:51 -0700
committerJim Miller <jaggies@google.com>2015-04-11 09:21:56 -0700
commit1e1f7ba5c99a0f715735c347597e3637e3870626 (patch)
tree7d46c41fc6403875dc88787d818d3358319c12c0
parent3d0ed44138bf5ce3649990275eb5fc6c17517ce3 (diff)
downloadhardware_libhardware-1e1f7ba5c99a0f715735c347597e3637e3870626.zip
hardware_libhardware-1e1f7ba5c99a0f715735c347597e3637e3870626.tar.gz
hardware_libhardware-1e1f7ba5c99a0f715735c347597e3637e3870626.tar.bz2
Clean up FingerprintManager API and make it public.
Change-Id: I416dcc42fd70926875cc77e0c2cc958fdfcd9f9d
-rw-r--r--include/hardware/fingerprint.h25
-rw-r--r--modules/fingerprint/fingerprint.c4
-rw-r--r--tests/fingerprint/fingerprint_tests.cpp15
3 files changed, 34 insertions, 10 deletions
diff --git a/include/hardware/fingerprint.h b/include/hardware/fingerprint.h
index 1fe8cc9..1d190a6 100644
--- a/include/hardware/fingerprint.h
+++ b/include/hardware/fingerprint.h
@@ -154,16 +154,26 @@ typedef struct fingerprint_device {
int (*enroll)(struct fingerprint_device *dev, uint32_t gid, uint32_t timeout_sec);
/*
- * Cancel fingerprint enroll request:
- * Switches the HAL state machine back to accept a fingerprint scan mode.
- * (fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENROLLING &&
- * fingerprint_msg.data.enroll.samples_remaining == 0)
+ * Fingerprint pre-enroll enroll request:
+ * Generates a unique token to upper layers to indicate the start of an enrollment transaction.
+ * This token will be wrapped by security for verification and passed to enroll() for
+ * verification before enrollment will be allowed. This is to ensure adding a new fingerprint
+ * template was preceded by some kind of credential confirmation (e.g. device password).
+ *
+ * Function return: 0 if function failed
+ * otherwise, a uint64_t of token
+ */
+ uint64_t (*pre_enroll)(struct fingerprint_device *dev);
+
+ /*
+ * Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED
+ * to all running clients. Switches the HAL state machine back to the idle state.
* will indicate switch back to the scan mode.
*
* Function return: 0 if cancel request is accepted
* -1 otherwise.
*/
- int (*enroll_cancel)(struct fingerprint_device *dev);
+ int (*cancel)(struct fingerprint_device *dev);
/*
* Fingerprint remove request:
@@ -193,7 +203,7 @@ typedef struct fingerprint_device {
* Authenticates an operation identifed by operation_id
*
* Function return: 0 on success
- * -1 if the size is out of bounds.
+ * -1 if the operation cannot be completed
*/
int (*authenticate)(struct fingerprint_device *dev, uint64_t operation_id, uint32_t gid);
@@ -206,8 +216,7 @@ typedef struct fingerprint_device {
* Function return: 0 if callback function is successfuly registered
* -1 otherwise.
*/
- int (*set_notify)(struct fingerprint_device *dev,
- fingerprint_notify_t notify);
+ int (*set_notify)(struct fingerprint_device *dev, fingerprint_notify_t notify);
/*
* Client provided callback function to receive notifications.
diff --git a/modules/fingerprint/fingerprint.c b/modules/fingerprint/fingerprint.c
index 0f11954..f9fd44b 100644
--- a/modules/fingerprint/fingerprint.c
+++ b/modules/fingerprint/fingerprint.c
@@ -38,7 +38,7 @@ static int fingerprint_enroll(struct fingerprint_device __unused *dev,
return FINGERPRINT_ERROR;
}
-static int fingerprint_enroll_cancel(struct fingerprint_device __unused *dev) {
+static int fingerprint_cancel(struct fingerprint_device __unused *dev) {
return FINGERPRINT_ERROR;
}
@@ -81,7 +81,7 @@ static int fingerprint_open(const hw_module_t* module, const char __unused *id,
dev->common.close = fingerprint_close;
dev->enroll = fingerprint_enroll;
- dev->enroll_cancel = fingerprint_enroll_cancel;
+ dev->cancel = fingerprint_cancel;
dev->remove = fingerprint_remove;
dev->set_active_group = fingerprint_set_active_group;
dev->authenticate = fingerprint_authenticate;
diff --git a/tests/fingerprint/fingerprint_tests.cpp b/tests/fingerprint/fingerprint_tests.cpp
index 4ae0d73..db7429c 100644
--- a/tests/fingerprint/fingerprint_tests.cpp
+++ b/tests/fingerprint/fingerprint_tests.cpp
@@ -24,6 +24,16 @@ TEST_F(FingerprintDevice, isThereEnroll) {
<< "enroll() function is not implemented";
}
+TEST_F(FingerprintDevice, isTherePreEnroll) {
+ ASSERT_TRUE(NULL != fp_device()->pre_enroll)
+ << "pre_enroll() function is not implemented";
+}
+
+TEST_F(FingerprintDevice, isThereCancel) {
+ ASSERT_TRUE(NULL != fp_device()->cancel)
+ << "cancel() function is not implemented";
+}
+
TEST_F(FingerprintDevice, isThereRemove) {
ASSERT_TRUE(NULL != fp_device()->remove)
<< "remove() function is not implemented";
@@ -34,6 +44,11 @@ TEST_F(FingerprintDevice, isThereAuthenticate) {
<< "authenticate() function is not implemented";
}
+TEST_F(FingerprintDevice, isThereSetActiveGroup) {
+ ASSERT_TRUE(NULL != fp_device()->set_active_group)
+ << "set_active_group() function is not implemented";
+}
+
TEST_F(FingerprintDevice, isThereSetNotify) {
ASSERT_TRUE(NULL != fp_device()->set_notify)
<< "set_notify() function is not implemented";