fingerprint: bauth: convert % completed to remaining

* Samsung uses fingerprint enrollment % completed
  while AOSP uses fingerprint sample remaining.

* This patch converts this data to AOSP-friendly one via (x = 100 - x).

Change-Id: I27034cb148e0f33f7d3efae9c75123715452f178
Signed-off-by: Jesse Chan <jc@linux.com>
tirimbino
Jesse Chan 8 years ago committed by Paul Keith
parent b23aaf793d
commit cd60dd84b0
  1. 21
      fingerprint/bauth/fingerprint.c

@ -43,6 +43,8 @@ typedef struct {
bauth_server_handle_t* bauth_handle;
static fingerprint_notify_t original_notify;
static int load_bauth_server(void)
{
bauth_handle = (bauth_server_handle_t *)malloc(sizeof(bauth_server_handle_t));
@ -71,6 +73,22 @@ no_memory:
return -ENOMEM;
}
static void hal_notify_convert(const fingerprint_msg_t *msg)
{
fingerprint_msg_t *new_msg = (fingerprint_msg_t *)msg;
switch (msg->type) {
case FINGERPRINT_TEMPLATE_ENROLLING:
new_msg->data.enroll.samples_remaining = 100 - msg->data.enroll.samples_remaining;
break;
default:
break;
}
return original_notify(new_msg);
}
static int fingerprint_close(hw_device_t *dev)
{
bauth_handle->ss_fingerprint_close();
@ -128,7 +146,8 @@ static int set_notify_callback(struct fingerprint_device *dev, fingerprint_notif
{
/* Decorate with locks */
dev->notify = notify;
return bauth_handle->ss_set_notify_callback(notify);
original_notify = notify;
return bauth_handle->ss_set_notify_callback(hal_notify_convert);
}
static int fingerprint_open(const hw_module_t* module, const char *id, hw_device_t** device)

Loading…
Cancel
Save