diff options
Diffstat (limited to 'biometrics')
-rw-r--r-- | biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp | 2 | ||||
-rw-r--r-- | biometrics/fingerprint/2.1/default/BiometricsFingerprint.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp index c6774ca222..f68795955a 100644 --- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp +++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.cpp @@ -145,6 +145,7 @@ FingerprintAcquiredInfo BiometricsFingerprint::VendorAcquiredFilter( Return<uint64_t> BiometricsFingerprint::setNotify( const sp<IBiometricsFingerprintClientCallback>& clientCallback) { + std::lock_guard<std::mutex> lock(mClientCallbackMutex); mClientCallback = clientCallback; // This is here because HAL 2.1 doesn't have a way to propagate a // unique token for its driver. Subsequent versions should send a unique @@ -259,6 +260,7 @@ fingerprint_device_t* BiometricsFingerprint::openHal() { void BiometricsFingerprint::notify(const fingerprint_msg_t *msg) { BiometricsFingerprint* thisPtr = static_cast<BiometricsFingerprint*>( BiometricsFingerprint::getInstance()); + std::lock_guard<std::mutex> lock(thisPtr->mClientCallbackMutex); if (thisPtr == nullptr || thisPtr->mClientCallback == nullptr) { ALOGE("Receiving callbacks before the client callback is registered."); return; diff --git a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h index 5923c849c8..6d64e3d38d 100644 --- a/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h +++ b/biometrics/fingerprint/2.1/default/BiometricsFingerprint.h @@ -69,6 +69,7 @@ private: static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode); static BiometricsFingerprint* sInstance; + std::mutex mClientCallbackMutex; sp<IBiometricsFingerprintClientCallback> mClientCallback; fingerprint_device_t *mDevice; }; |