Fingerprint: Plumb enumerate support.

Change-Id: I5794f80404faf68d04f7b3f3b7346b9e28c99881
Signed-off-by: Sasha Levitskiy <sanek@google.com>
This commit is contained in:
Sasha Levitskiy 2015-12-03 13:50:53 -08:00
parent 2089758475
commit e270da9421
6 changed files with 33 additions and 6 deletions

View File

@ -88,6 +88,16 @@ void FingerprintDaemonProxy::hal_notify_callback(const fingerprint_msg_t *msg) {
msg->data.removed.finger.fid,
msg->data.removed.finger.gid);
break;
case FINGERPRINT_TEMPLATE_ENUMERATING:
ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)",
msg->data.enumerated.finger.fid,
msg->data.enumerated.finger.gid,
msg->data.enumerated.remaining_templates);
callback->onEnumerate(device,
msg->data.enumerated.finger.fid,
msg->data.enumerated.finger.gid,
msg->data.enumerated.remaining_templates);
break;
default:
ALOGE("invalid msg type: %d", msg->type);
return;
@ -158,6 +168,11 @@ int32_t FingerprintDaemonProxy::remove(int32_t fingerId, int32_t groupId) {
return mDevice->remove(mDevice, groupId, fingerId);
}
int32_t FingerprintDaemonProxy::enumerate() {
ALOG(LOG_VERBOSE, LOG_TAG, "enumerate()\n");
return mDevice->enumerate(mDevice);
}
uint64_t FingerprintDaemonProxy::getAuthenticatorId() {
return mDevice->get_authenticator_id(mDevice);
}

View File

@ -40,6 +40,7 @@ class FingerprintDaemonProxy : public BnFingerprintDaemon {
virtual int32_t authenticate(uint64_t sessionId, uint32_t groupId);
virtual int32_t stopAuthentication();
virtual int32_t remove(int32_t fingerId, int32_t groupId);
virtual int32_t enumerate();
virtual uint64_t getAuthenticatorId();
virtual int32_t setActiveGroup(int32_t groupId, const uint8_t* path, ssize_t pathLen);
virtual int64_t openHal();

View File

@ -125,6 +125,16 @@ status_t BnFingerprintDaemon::onTransact(uint32_t code, const Parcel& data, Parc
reply->writeInt32(ret);
return NO_ERROR;
}
case ENUMERATE: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {
return PERMISSION_DENIED;
}
const int32_t ret = enumerate();
reply->writeNoException();
reply->writeInt32(ret);
return NO_ERROR;
}
case GET_AUTHENTICATOR_ID: {
CHECK_INTERFACE(IFingerprintDaemon, data, reply);
if (!checkPermission(HAL_FINGERPRINT_PERMISSION)) {

View File

@ -44,6 +44,7 @@ class IFingerprintDaemon : public IInterface, public IBinder::DeathRecipient {
CLOSE_HAL = IBinder::FIRST_CALL_TRANSACTION + 9,
INIT = IBinder::FIRST_CALL_TRANSACTION + 10,
POST_ENROLL = IBinder::FIRST_CALL_TRANSACTION + 11,
ENUMERATE = IBinder::FIRST_CALL_TRANSACTION + 12,
};
IFingerprintDaemon() { }
@ -60,6 +61,7 @@ class IFingerprintDaemon : public IInterface, public IBinder::DeathRecipient {
virtual int32_t authenticate(uint64_t sessionId, uint32_t groupId) = 0;
virtual int32_t stopAuthentication() = 0;
virtual int32_t remove(int32_t fingerId, int32_t groupId) = 0;
virtual int32_t enumerate() = 0;
virtual uint64_t getAuthenticatorId() = 0;
virtual int32_t setActiveGroup(int32_t groupId, const uint8_t* path, ssize_t pathLen) = 0;
virtual int64_t openHal() = 0;

View File

@ -74,13 +74,13 @@ public:
return remote()->transact(ON_REMOVED, data, &reply, IBinder::FLAG_ONEWAY);
}
virtual status_t onEnumerate(int64_t devId, const int32_t* fpIds, const int32_t* gpIds,
int32_t sz) {
virtual status_t onEnumerate(int64_t devId, int32_t fpId, int32_t gpId, int32_t rem) {
Parcel data, reply;
data.writeInterfaceToken(IFingerprintDaemonCallback::getInterfaceDescriptor());
data.writeInt64(devId);
data.writeInt32Array(sz, fpIds);
data.writeInt32Array(sz, gpIds);
data.writeInt32(fpId);
data.writeInt32(gpId);
data.writeInt32(rem);
return remote()->transact(ON_ENUMERATE, data, &reply, IBinder::FLAG_ONEWAY);
}
};

View File

@ -44,8 +44,7 @@ class IFingerprintDaemonCallback : public IInterface {
virtual status_t onAuthenticated(int64_t devId, int32_t fingerId, int32_t groupId) = 0;
virtual status_t onError(int64_t devId, int32_t error) = 0;
virtual status_t onRemoved(int64_t devId, int32_t fingerId, int32_t groupId) = 0;
virtual status_t onEnumerate(int64_t devId, const int32_t* fpIds, const int32_t* gpIds,
int32_t sz) = 0;
virtual status_t onEnumerate(int64_t devId, int32_t fingerId, int32_t groupId, int32_t rem) = 0;
DECLARE_META_INTERFACE(FingerprintDaemonCallback);
};