diff --git a/hidl/fingerprint/BiometricsFingerprint.cpp b/hidl/fingerprint/BiometricsFingerprint.cpp index e8db272d..bb27999b 100644 --- a/hidl/fingerprint/BiometricsFingerprint.cpp +++ b/hidl/fingerprint/BiometricsFingerprint.cpp @@ -288,19 +288,17 @@ void BiometricsFingerprint::notify(const fingerprint_msg_t* msg) { } } break; case FINGERPRINT_TEMPLATE_ENROLLING: +#ifdef USES_PERCENTAGE_SAMPLES + const_cast(msg)->data.enroll.samples_remaining = + 100 - msg->data.enroll.samples_remaining; +#endif LOG(DEBUG) << "onEnrollResult(fid=" << msg->data.enroll.finger.fid << ", gid=" << msg->data.enroll.finger.gid << ", rem=" << msg->data.enroll.samples_remaining << ")"; - if (thisPtr->mClientCallback + if (!thisPtr->mClientCallback ->onEnrollResult(devId, msg->data.enroll.finger.fid, msg->data.enroll.finger.gid, msg->data.enroll.samples_remaining) .isOk()) { -#ifdef USES_PERCENTAGE_SAMPLES - fingerprint_msg_t* newMsg = (fingerprint_msg_t*)msg; - newMsg->data.enroll.samples_remaining = 100 - msg->data.enroll.samples_remaining; - msg = newMsg; -#endif - } else { LOG(ERROR) << "failed to invoke fingerprint onEnrollResult callback"; } break;