diff options
author | Sasha Levitskiy <sanek@google.com> | 2015-06-09 16:47:09 -0700 |
---|---|---|
committer | Sasha Levitskiy <sanek@google.com> | 2015-06-10 14:29:17 -0700 |
commit | 53afac018d0c53fdfac68e874c432211fd6ba25a (patch) | |
tree | f19b38ed9db6f5b28bcfb59bb24d0ec55eb8da44 /fingerprintd | |
parent | 4d7f052afbaf79c7324a2e9dd51168990b062647 (diff) | |
download | system_core-53afac018d0c53fdfac68e874c432211fd6ba25a.zip system_core-53afac018d0c53fdfac68e874c432211fd6ba25a.tar.gz system_core-53afac018d0c53fdfac68e874c432211fd6ba25a.tar.bz2 |
Fingerprint: Use integral types for remove()
Bug 21282699
Change-Id: I8fdb2112f3f930f080571da6a6b908f5f0581bdd
Signed-off-by: Sasha Levitskiy <sanek@google.com>
Diffstat (limited to 'fingerprintd')
-rw-r--r-- | fingerprintd/FingerprintDaemonProxy.cpp | 55 | ||||
-rw-r--r-- | fingerprintd/FingerprintDaemonProxy.h | 4 | ||||
-rw-r--r-- | fingerprintd/IFingerprintDaemon.h | 2 |
3 files changed, 29 insertions, 32 deletions
diff --git a/fingerprintd/FingerprintDaemonProxy.cpp b/fingerprintd/FingerprintDaemonProxy.cpp index a8a4024..a55f30a 100644 --- a/fingerprintd/FingerprintDaemonProxy.cpp +++ b/fingerprintd/FingerprintDaemonProxy.cpp @@ -41,7 +41,7 @@ FingerprintDaemonProxy::~FingerprintDaemonProxy() { closeHal(); } -void FingerprintDaemonProxy::hal_notify_callback(fingerprint_msg_t msg) { +void FingerprintDaemonProxy::hal_notify_callback(const fingerprint_msg_t *msg) { FingerprintDaemonProxy* instance = FingerprintDaemonProxy::getInstance(); const sp<IFingerprintDaemonCallback> callback = instance->mCallback; if (callback == NULL) { @@ -49,52 +49,52 @@ void FingerprintDaemonProxy::hal_notify_callback(fingerprint_msg_t msg) { return; } const int64_t device = (int64_t) instance->mDevice; - switch (msg.type) { + switch (msg->type) { case FINGERPRINT_ERROR: - ALOGD("onError(%d)", msg.data.error); - callback->onError(device, msg.data.error); + ALOGD("onError(%d)", msg->data.error); + callback->onError(device, msg->data.error); break; case FINGERPRINT_ACQUIRED: - ALOGD("onAcquired(%d)", msg.data.acquired.acquired_info); - callback->onAcquired(device, msg.data.acquired.acquired_info); + ALOGD("onAcquired(%d)", msg->data.acquired.acquired_info); + callback->onAcquired(device, msg->data.acquired.acquired_info); break; case FINGERPRINT_AUTHENTICATED: ALOGD("onAuthenticated(fid=%d, gid=%d)", - msg.data.authenticated.finger.fid, - msg.data.authenticated.finger.gid); - if (msg.data.authenticated.finger.fid != 0) { - uint8_t* hat = reinterpret_cast<uint8_t *>(&msg.data.authenticated.hat); - instance->notifyKeystore(hat, sizeof(msg.data.authenticated.hat)); + msg->data.authenticated.finger.fid, + msg->data.authenticated.finger.gid); + if (msg->data.authenticated.finger.fid != 0) { + const uint8_t* hat = reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat); + instance->notifyKeystore(hat, sizeof(msg->data.authenticated.hat)); } callback->onAuthenticated(device, - msg.data.authenticated.finger.fid, - msg.data.authenticated.finger.gid); + msg->data.authenticated.finger.fid, + msg->data.authenticated.finger.gid); break; case FINGERPRINT_TEMPLATE_ENROLLING: ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)", - msg.data.enroll.finger.fid, - msg.data.enroll.finger.gid, - msg.data.enroll.samples_remaining); + msg->data.enroll.finger.fid, + msg->data.enroll.finger.gid, + msg->data.enroll.samples_remaining); callback->onEnrollResult(device, - msg.data.enroll.finger.fid, - msg.data.enroll.finger.gid, - msg.data.enroll.samples_remaining); + msg->data.enroll.finger.fid, + msg->data.enroll.finger.gid, + msg->data.enroll.samples_remaining); break; case FINGERPRINT_TEMPLATE_REMOVED: ALOGD("onRemove(fid=%d, gid=%d)", - msg.data.removed.finger.fid, - msg.data.removed.finger.gid); + msg->data.removed.finger.fid, + msg->data.removed.finger.gid); callback->onRemoved(device, - msg.data.removed.finger.fid, - msg.data.removed.finger.gid); + msg->data.removed.finger.fid, + msg->data.removed.finger.gid); break; default: - ALOGE("invalid msg: %d", msg.type); + ALOGE("invalid msg type: %d", msg->type); return; } } -void FingerprintDaemonProxy::notifyKeystore(uint8_t *auth_token, size_t auth_token_length) { +void FingerprintDaemonProxy::notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length) { if (auth_token != NULL && auth_token_length > 0) { // TODO: cache service? sp < IServiceManager > sm = defaultServiceManager(); @@ -151,10 +151,7 @@ int32_t FingerprintDaemonProxy::stopAuthentication() { int32_t FingerprintDaemonProxy::remove(int32_t fingerId, int32_t groupId) { ALOG(LOG_VERBOSE, LOG_TAG, "remove(fid=%d, gid=%d)\n", fingerId, groupId); - fingerprint_finger_id_t finger; - finger.fid = fingerId; - finger.gid = groupId; - return mDevice->remove(mDevice, finger); + return mDevice->remove(mDevice, groupId, fingerId); } uint64_t FingerprintDaemonProxy::getAuthenticatorId() { diff --git a/fingerprintd/FingerprintDaemonProxy.h b/fingerprintd/FingerprintDaemonProxy.h index 95c926b..50d30ef 100644 --- a/fingerprintd/FingerprintDaemonProxy.h +++ b/fingerprintd/FingerprintDaemonProxy.h @@ -48,8 +48,8 @@ class FingerprintDaemonProxy : public BnFingerprintDaemon { FingerprintDaemonProxy(); virtual ~FingerprintDaemonProxy(); void binderDied(const wp<IBinder>& who); - void notifyKeystore(uint8_t *auth_token, size_t auth_token_length); - static void hal_notify_callback(fingerprint_msg_t msg); + void notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length); + static void hal_notify_callback(const fingerprint_msg_t *msg); static FingerprintDaemonProxy* sInstance; fingerprint_module_t const* mModule; diff --git a/fingerprintd/IFingerprintDaemon.h b/fingerprintd/IFingerprintDaemon.h index fe3f64b..08cb008 100644 --- a/fingerprintd/IFingerprintDaemon.h +++ b/fingerprintd/IFingerprintDaemon.h @@ -65,7 +65,7 @@ class IFingerprintDaemon : public IInterface, public IBinder::DeathRecipient { // DECLARE_META_INTERFACE - C++ client interface not needed static const android::String16 descriptor; - static void hal_notify_callback(fingerprint_msg_t msg); + static void hal_notify_callback(const fingerprint_msg_t *msg); }; // ---------------------------------------------------------------------------- |