From dae483764fef7cc8a3c5b48ec5cd73cdbe477a17 Mon Sep 17 00:00:00 2001 From: Sasha Levitskiy Date: Fri, 10 Jul 2015 14:24:30 -0700 Subject: [PATCH] Fingerprint: Add HAL close() code Bug 22248856 Bug 22374372 Change-Id: I06a59bc7050a227307c857fc7db0985b84fd293a Signed-off-by: Sasha Levitskiy --- fingerprintd/FingerprintDaemonProxy.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/fingerprintd/FingerprintDaemonProxy.cpp b/fingerprintd/FingerprintDaemonProxy.cpp index c310160af..beb95de73 100644 --- a/fingerprintd/FingerprintDaemonProxy.cpp +++ b/fingerprintd/FingerprintDaemonProxy.cpp @@ -225,11 +225,26 @@ int64_t FingerprintDaemonProxy::openHal() { } int32_t FingerprintDaemonProxy::closeHal() { - return -ENOSYS; // TODO + ALOG(LOG_VERBOSE, LOG_TAG, "nativeCloseHal()\n"); + if (mDevice == NULL) { + ALOGE("No valid device"); + return -ENOSYS; + } + int err; + if (0 != (err = mDevice->common.close(reinterpret_cast(mDevice)))) { + ALOGE("Can't close fingerprint module, error: %d", err); + return err; + } + mDevice = NULL; + return 0; } void FingerprintDaemonProxy::binderDied(const wp& who) { ALOGD("binder died"); + int err; + if (0 != (err = closeHal())) { + ALOGE("Can't close fingerprint device, error: %d", err); + } if (IInterface::asBinder(mCallback) == who) { mCallback = NULL; }