Clean up FingerprintManager API and make it public.

Change-Id: I416dcc42fd70926875cc77e0c2cc958fdfcd9f9d
This commit is contained in:
Jim Miller 2015-04-08 22:55:51 -07:00
parent 3d0ed44138
commit 1e1f7ba5c9
3 changed files with 34 additions and 10 deletions

View file

@ -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.

View file

@ -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;

View file

@ -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";