summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2017-06-16 12:25:57 -0700
committerbohu <bohu@google.com>2017-06-20 12:07:59 -0700
commitb1d1115d36557d141d89f62613f695a3b48f7675 (patch)
treefebfd021a0a8b8ea7a054e28c9da86a09dd27ffb
parentd9c01dcea4eedf396ba3af46405c51ec7634100e (diff)
downloadandroid_device_generic_goldfish-b1d1115d36557d141d89f62613f695a3b48f7675.tar.gz
android_device_generic_goldfish-b1d1115d36557d141d89f62613f695a3b48f7675.tar.bz2
android_device_generic_goldfish-b1d1115d36557d141d89f62613f695a3b48f7675.zip
emu-hal: fix fingerprint VTS failure in enroll/remove
1. the test wants no failure on any input, except for fatal errors such as device is not initialized. in this case, a negative error from errno.h should return. 2. the test wants notify on any input; when non-fatal error happens, test expects function returns 0 and the callback gets notified. BUG: 62138703 Test: build sdk_gphone_x86-userdebug, launch emulator run vts -m VtsHalBiometricsFingerprintV2_1Target Change-Id: Ie9317c7015f23581ec3df985cb0d7cdaa604adab
-rw-r--r--fingerprint/fingerprint.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/fingerprint/fingerprint.c b/fingerprint/fingerprint.c
index 6041005..dd37770 100644
--- a/fingerprint/fingerprint.c
+++ b/fingerprint/fingerprint.c
@@ -308,11 +308,15 @@ static int fingerprint_enroll(struct fingerprint_device *device,
const hw_auth_token_t *hat,
uint32_t __unused gid,
uint32_t __unused timeout_sec) {
+ fingerprint_msg_t msg = {0, {0}};
+ msg.type = FINGERPRINT_ERROR;
+ msg.data.error = FINGERPRINT_ERROR_UNABLE_TO_PROCESS;
ALOGD("fingerprint_enroll");
qemu_fingerprint_device_t* dev = (qemu_fingerprint_device_t*)device;
if (!hat) {
ALOGW("%s: null auth token", __func__);
- return -EPROTONOSUPPORT;
+ dev->device.notify(&msg);
+ return 0;
}
if (hat->challenge == dev->challenge) {
// The secure_user_id retrieved from the auth token should be stored
@@ -324,10 +328,12 @@ static int fingerprint_enroll(struct fingerprint_device *device,
}
if (hat->version != HW_AUTH_TOKEN_VERSION) {
- return -EPROTONOSUPPORT;
+ dev->device.notify(&msg);
+ return 0;
}
if (hat->challenge != dev->challenge && !(hat->authenticator_type & HW_AUTH_FINGERPRINT)) {
- return -EPERM;
+ dev->device.notify(&msg);
+ return 0;
}
dev->user_id = hat->user_id;
@@ -447,7 +453,7 @@ static int fingerprint_remove(struct fingerprint_device *device,
ALOGE("Can't remove fingerprint (gid=%d, fid=%d); "
"device not initialized properly",
gid, fid);
- return -1;
+ return -ENODEV;
}
qemu_fingerprint_device_t* qdev = (qemu_fingerprint_device_t*)device;
@@ -472,6 +478,7 @@ static int fingerprint_remove(struct fingerprint_device *device,
pthread_mutex_unlock(&qdev->lock);
msg.type = FINGERPRINT_TEMPLATE_REMOVED;
msg.data.removed.finger.fid = theFid;
+ msg.data.removed.finger.gid = qdev->group_id;
device->notify(&msg);
// Because we released the mutex, the list
@@ -486,6 +493,7 @@ static int fingerprint_remove(struct fingerprint_device *device,
pthread_mutex_unlock(&qdev->lock);
msg.type = FINGERPRINT_TEMPLATE_REMOVED;
msg.data.removed.finger.fid = 0;
+ msg.data.removed.finger.gid = qdev->group_id;
device->notify(&msg);
} else {
// Delete one fingerprint
@@ -502,7 +510,15 @@ static int fingerprint_remove(struct fingerprint_device *device,
qdev->listener.state = STATE_IDLE;
pthread_mutex_unlock(&qdev->lock);
ALOGE("Fingerprint ID %d not found", fid);
- return FINGERPRINT_ERROR;
+ //msg.type = FINGERPRINT_ERROR;
+ //msg.data.error = FINGERPRINT_ERROR_UNABLE_TO_REMOVE;
+ //device->notify(&msg);
+ msg.type = FINGERPRINT_TEMPLATE_REMOVED;
+ msg.data.removed.finger.fid = 0;
+ msg.data.removed.finger.gid = qdev->group_id;
+ msg.data.removed.remaining_templates = 0;
+ device->notify(&msg);
+ return 0;
}
qdev->listener.secureid[idx] = 0;