From: Nick Desaulniers Date: Mon, 20 Mar 2017 21:06:19 +0000 (-0700) Subject: fingerprint: check return status of hwbinder calls X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=8174a847f24b09262166f43fa16dc218ea715a35;p=android-x86%2Fhardware-interfaces.git fingerprint: check return status of hwbinder calls If system_server dies, and return codes of hwbinder calls are not checked, an abort of the HAL service will occur. In this case, warn in the logs, but allow system_server to reopen HAL. Bug: 34867134 Change-Id: I9fe1c2c0f1c03e8debafb56bff8a7490ccbbcec0 --- diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp index b1064817..5b00675e 100644 --- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp +++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp @@ -264,27 +264,35 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) { case FINGERPRINT_ERROR: { int32_t vendorCode = 0; FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode); - thisPtr->mClientCallback->onError(devId, result, vendorCode); + if (!thisPtr->mClientCallback->onError(devId, result, vendorCode).isOk()) { + ALOGE("failed to invoke fingerprint onError callback"); + } } break; case FINGERPRINT_ACQUIRED: { int32_t vendorCode = 0; FingerprintAcquiredInfo result = VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode); - thisPtr->mClientCallback->onAcquired(devId, result, vendorCode); + if (!thisPtr->mClientCallback->onAcquired(devId, result, vendorCode).isOk()) { + ALOGE("failed to invoke fingerprint onAcquired callback"); + } } break; case FINGERPRINT_TEMPLATE_ENROLLING: - thisPtr->mClientCallback->onEnrollResult(devId, - msg->data.enroll.finger.fid, - msg->data.enroll.finger.gid, - msg->data.enroll.samples_remaining); + if (!thisPtr->mClientCallback->onEnrollResult(devId, + msg->data.enroll.finger.fid, + msg->data.enroll.finger.gid, + msg->data.enroll.samples_remaining).isOk()) { + ALOGE("failed to invoke fingerprint onEnrollResult callback"); + } break; case FINGERPRINT_TEMPLATE_REMOVED: - thisPtr->mClientCallback->onRemoved(devId, - msg->data.removed.finger.fid, - msg->data.removed.finger.gid, - msg->data.removed.remaining_templates); + if (!thisPtr->mClientCallback->onRemoved(devId, + msg->data.removed.finger.fid, + msg->data.removed.finger.gid, + msg->data.removed.remaining_templates).isOk()) { + ALOGE("failed to invoke fingerprint onRemoved callback"); + } break; case FINGERPRINT_AUTHENTICATED: if (msg->data.authenticated.finger.fid != 0) { @@ -292,23 +300,29 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) { reinterpret_cast(&msg->data.authenticated.hat); const hidl_vec token( std::vector(hat, hat + sizeof(msg->data.authenticated.hat))); - thisPtr->mClientCallback->onAuthenticated(devId, - msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, - token); + if (!thisPtr->mClientCallback->onAuthenticated(devId, + msg->data.authenticated.finger.fid, + msg->data.authenticated.finger.gid, + token).isOk()) { + ALOGE("failed to invoke fingerprint onAuthenticated callback"); + } } else { // Not a recognized fingerprint - thisPtr->mClientCallback->onAuthenticated(devId, - msg->data.authenticated.finger.fid, - msg->data.authenticated.finger.gid, - hidl_vec()); + if (!thisPtr->mClientCallback->onAuthenticated(devId, + msg->data.authenticated.finger.fid, + msg->data.authenticated.finger.gid, + hidl_vec()).isOk()) { + ALOGE("failed to invoke fingerprint onAuthenticated callback"); + } } break; case FINGERPRINT_TEMPLATE_ENUMERATING: - thisPtr->mClientCallback->onEnumerate(devId, - msg->data.enumerated.finger.fid, - msg->data.enumerated.finger.gid, - msg->data.enumerated.remaining_templates); + if (!thisPtr->mClientCallback->onEnumerate(devId, + msg->data.enumerated.finger.fid, + msg->data.enumerated.finger.gid, + msg->data.enumerated.remaining_templates).isOk()) { + ALOGE("failed to invoke fingerprint onEnumerate callback"); + } break; } }