summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSasha Levitskiy2015-06-09 18:47:09 -0500
committerSasha Levitskiy2015-06-10 16:29:17 -0500
commit53afac018d0c53fdfac68e874c432211fd6ba25a (patch)
treef19b38ed9db6f5b28bcfb59bb24d0ec55eb8da44 /fingerprintd
parent4d7f052afbaf79c7324a2e9dd51168990b062647 (diff)
downloadplatform-system-core-53afac018d0c53fdfac68e874c432211fd6ba25a.tar.gz
platform-system-core-53afac018d0c53fdfac68e874c432211fd6ba25a.tar.xz
platform-system-core-53afac018d0c53fdfac68e874c432211fd6ba25a.zip
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.cpp55
-rw-r--r--fingerprintd/FingerprintDaemonProxy.h4
-rw-r--r--fingerprintd/IFingerprintDaemon.h2
3 files changed, 29 insertions, 32 deletions
diff --git a/fingerprintd/FingerprintDaemonProxy.cpp b/fingerprintd/FingerprintDaemonProxy.cpp
index a8a4024ea..a55f30a2d 100644
--- a/fingerprintd/FingerprintDaemonProxy.cpp
+++ b/fingerprintd/FingerprintDaemonProxy.cpp
@@ -41,7 +41,7 @@ FingerprintDaemonProxy::~FingerprintDaemonProxy() {
41 closeHal(); 41 closeHal();
42} 42}
43 43
44void FingerprintDaemonProxy::hal_notify_callback(fingerprint_msg_t msg) { 44void FingerprintDaemonProxy::hal_notify_callback(const fingerprint_msg_t *msg) {
45 FingerprintDaemonProxy* instance = FingerprintDaemonProxy::getInstance(); 45 FingerprintDaemonProxy* instance = FingerprintDaemonProxy::getInstance();
46 const sp<IFingerprintDaemonCallback> callback = instance->mCallback; 46 const sp<IFingerprintDaemonCallback> callback = instance->mCallback;
47 if (callback == NULL) { 47 if (callback == NULL) {
@@ -49,52 +49,52 @@ void FingerprintDaemonProxy::hal_notify_callback(fingerprint_msg_t msg) {
49 return; 49 return;
50 } 50 }
51 const int64_t device = (int64_t) instance->mDevice; 51 const int64_t device = (int64_t) instance->mDevice;
52 switch (msg.type) { 52 switch (msg->type) {
53 case FINGERPRINT_ERROR: 53 case FINGERPRINT_ERROR:
54 ALOGD("onError(%d)", msg.data.error); 54 ALOGD("onError(%d)", msg->data.error);
55 callback->onError(device, msg.data.error); 55 callback->onError(device, msg->data.error);
56 break; 56 break;
57 case FINGERPRINT_ACQUIRED: 57 case FINGERPRINT_ACQUIRED:
58 ALOGD("onAcquired(%d)", msg.data.acquired.acquired_info); 58 ALOGD("onAcquired(%d)", msg->data.acquired.acquired_info);
59 callback->onAcquired(device, msg.data.acquired.acquired_info); 59 callback->onAcquired(device, msg->data.acquired.acquired_info);
60 break; 60 break;
61 case FINGERPRINT_AUTHENTICATED: 61 case FINGERPRINT_AUTHENTICATED:
62 ALOGD("onAuthenticated(fid=%d, gid=%d)", 62 ALOGD("onAuthenticated(fid=%d, gid=%d)",
63 msg.data.authenticated.finger.fid, 63 msg->data.authenticated.finger.fid,
64 msg.data.authenticated.finger.gid); 64 msg->data.authenticated.finger.gid);
65 if (msg.data.authenticated.finger.fid != 0) { 65 if (msg->data.authenticated.finger.fid != 0) {
66 uint8_t* hat = reinterpret_cast<uint8_t *>(&msg.data.authenticated.hat); 66 const uint8_t* hat = reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat);
67 instance->notifyKeystore(hat, sizeof(msg.data.authenticated.hat)); 67 instance->notifyKeystore(hat, sizeof(msg->data.authenticated.hat));
68 } 68 }
69 callback->onAuthenticated(device, 69 callback->onAuthenticated(device,
70 msg.data.authenticated.finger.fid, 70 msg->data.authenticated.finger.fid,
71 msg.data.authenticated.finger.gid); 71 msg->data.authenticated.finger.gid);
72 break; 72 break;
73 case FINGERPRINT_TEMPLATE_ENROLLING: 73 case FINGERPRINT_TEMPLATE_ENROLLING:
74 ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)", 74 ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)",
75 msg.data.enroll.finger.fid, 75 msg->data.enroll.finger.fid,
76 msg.data.enroll.finger.gid, 76 msg->data.enroll.finger.gid,
77 msg.data.enroll.samples_remaining); 77 msg->data.enroll.samples_remaining);
78 callback->onEnrollResult(device, 78 callback->onEnrollResult(device,
79 msg.data.enroll.finger.fid, 79 msg->data.enroll.finger.fid,
80 msg.data.enroll.finger.gid, 80 msg->data.enroll.finger.gid,
81 msg.data.enroll.samples_remaining); 81 msg->data.enroll.samples_remaining);
82 break; 82 break;
83 case FINGERPRINT_TEMPLATE_REMOVED: 83 case FINGERPRINT_TEMPLATE_REMOVED:
84 ALOGD("onRemove(fid=%d, gid=%d)", 84 ALOGD("onRemove(fid=%d, gid=%d)",
85 msg.data.removed.finger.fid, 85 msg->data.removed.finger.fid,
86 msg.data.removed.finger.gid); 86 msg->data.removed.finger.gid);
87 callback->onRemoved(device, 87 callback->onRemoved(device,
88 msg.data.removed.finger.fid, 88 msg->data.removed.finger.fid,
89 msg.data.removed.finger.gid); 89 msg->data.removed.finger.gid);
90 break; 90 break;
91 default: 91 default:
92 ALOGE("invalid msg: %d", msg.type); 92 ALOGE("invalid msg type: %d", msg->type);
93 return; 93 return;
94 } 94 }
95} 95}
96 96
97void FingerprintDaemonProxy::notifyKeystore(uint8_t *auth_token, size_t auth_token_length) { 97void FingerprintDaemonProxy::notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length) {
98 if (auth_token != NULL && auth_token_length > 0) { 98 if (auth_token != NULL && auth_token_length > 0) {
99 // TODO: cache service? 99 // TODO: cache service?
100 sp < IServiceManager > sm = defaultServiceManager(); 100 sp < IServiceManager > sm = defaultServiceManager();
@@ -151,10 +151,7 @@ int32_t FingerprintDaemonProxy::stopAuthentication() {
151 151
152int32_t FingerprintDaemonProxy::remove(int32_t fingerId, int32_t groupId) { 152int32_t FingerprintDaemonProxy::remove(int32_t fingerId, int32_t groupId) {
153 ALOG(LOG_VERBOSE, LOG_TAG, "remove(fid=%d, gid=%d)\n", fingerId, groupId); 153 ALOG(LOG_VERBOSE, LOG_TAG, "remove(fid=%d, gid=%d)\n", fingerId, groupId);
154 fingerprint_finger_id_t finger; 154 return mDevice->remove(mDevice, groupId, fingerId);
155 finger.fid = fingerId;
156 finger.gid = groupId;
157 return mDevice->remove(mDevice, finger);
158} 155}
159 156
160uint64_t FingerprintDaemonProxy::getAuthenticatorId() { 157uint64_t FingerprintDaemonProxy::getAuthenticatorId() {
diff --git a/fingerprintd/FingerprintDaemonProxy.h b/fingerprintd/FingerprintDaemonProxy.h
index 95c926bda..50d30efd1 100644
--- a/fingerprintd/FingerprintDaemonProxy.h
+++ b/fingerprintd/FingerprintDaemonProxy.h
@@ -48,8 +48,8 @@ class FingerprintDaemonProxy : public BnFingerprintDaemon {
48 FingerprintDaemonProxy(); 48 FingerprintDaemonProxy();
49 virtual ~FingerprintDaemonProxy(); 49 virtual ~FingerprintDaemonProxy();
50 void binderDied(const wp<IBinder>& who); 50 void binderDied(const wp<IBinder>& who);
51 void notifyKeystore(uint8_t *auth_token, size_t auth_token_length); 51 void notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length);
52 static void hal_notify_callback(fingerprint_msg_t msg); 52 static void hal_notify_callback(const fingerprint_msg_t *msg);
53 53
54 static FingerprintDaemonProxy* sInstance; 54 static FingerprintDaemonProxy* sInstance;
55 fingerprint_module_t const* mModule; 55 fingerprint_module_t const* mModule;
diff --git a/fingerprintd/IFingerprintDaemon.h b/fingerprintd/IFingerprintDaemon.h
index fe3f64b93..08cb00857 100644
--- a/fingerprintd/IFingerprintDaemon.h
+++ b/fingerprintd/IFingerprintDaemon.h
@@ -65,7 +65,7 @@ class IFingerprintDaemon : public IInterface, public IBinder::DeathRecipient {
65 65
66 // DECLARE_META_INTERFACE - C++ client interface not needed 66 // DECLARE_META_INTERFACE - C++ client interface not needed
67 static const android::String16 descriptor; 67 static const android::String16 descriptor;
68 static void hal_notify_callback(fingerprint_msg_t msg); 68 static void hal_notify_callback(const fingerprint_msg_t *msg);
69}; 69};
70 70
71// ---------------------------------------------------------------------------- 71// ----------------------------------------------------------------------------