Fingerprint: Add an API to get authenticator id

Change-Id: If45ebc228425eaa43bf9abde934f8bb4e7d97e6c
Signed-off-by: Sasha Levitskiy <sanek@google.com>
This commit is contained in:
Sasha Levitskiy 2015-04-16 14:45:04 -07:00 committed by Andres Morales
parent 6fa82480ae
commit 468b567316
3 changed files with 26 additions and 3 deletions

View file

@ -156,6 +156,16 @@ typedef struct fingerprint_device {
*/
uint64_t (*pre_enroll)(struct fingerprint_device *dev);
/*
* get_authenticator_id:
* Returns a token associated with the current fingerprint set. This value will
* change whenever a new fingerprint is enrolled, thus creating a new fingerprint
* set.
*
* Function return: current authenticator id.
*/
uint64_t (*get_authenticator_id)(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.
@ -214,9 +224,6 @@ typedef struct fingerprint_device {
* Do not set by hand, use the function above instead.
*/
fingerprint_notify_t notify;
/* Reserved for future use. Must be NULL. */
void* reserved[8 - 4];
} fingerprint_device_t;
typedef struct fingerprint_module {

View file

@ -32,6 +32,11 @@ static int fingerprint_close(hw_device_t *dev)
}
}
static uint64_t fingerprint_pre_enroll(struct fingerprint_device __unused *dev) {
return FINGERPRINT_ERROR;
}
static int fingerprint_enroll(struct fingerprint_device __unused *dev,
const hw_auth_token_t __unused *hat,
uint32_t __unused gid,
@ -39,6 +44,10 @@ static int fingerprint_enroll(struct fingerprint_device __unused *dev,
return FINGERPRINT_ERROR;
}
static uint64_t fingerprint_get_auth_id(struct fingerprint_device __unused *dev) {
return FINGERPRINT_ERROR;
}
static int fingerprint_cancel(struct fingerprint_device __unused *dev) {
return FINGERPRINT_ERROR;
}
@ -81,7 +90,9 @@ static int fingerprint_open(const hw_module_t* module, const char __unused *id,
dev->common.module = (struct hw_module_t*) module;
dev->common.close = fingerprint_close;
dev->pre_enroll = fingerprint_pre_enroll;
dev->enroll = fingerprint_enroll;
dev->get_authenticator_id = fingerprint_get_auth_id;
dev->cancel = fingerprint_cancel;
dev->remove = fingerprint_remove;
dev->set_active_group = fingerprint_set_active_group;

View file

@ -29,6 +29,11 @@ TEST_F(FingerprintDevice, isTherePreEnroll) {
<< "pre_enroll() function is not implemented";
}
TEST_F(FingerprintDevice, isThereGetAuthenticatorId) {
ASSERT_TRUE(NULL != fp_device()->get_authenticator_id)
<< "get_authenticator_id() function is not implemented";
}
TEST_F(FingerprintDevice, isThereCancel) {
ASSERT_TRUE(NULL != fp_device()->cancel)
<< "cancel() function is not implemented";