diff options
author | Nick Desaulniers <ndesaulniers@google.com> | 2017-08-18 21:22:46 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-08-18 21:22:46 +0000 |
commit | 3c739df2644a098212b9a974bdf724818aad938c (patch) | |
tree | 9f3121465c0f7efef810171ac25b9ee2025b12d1 /biometrics | |
parent | 681ec8c328096ac8b0d9ba0fe98059335cda13f6 (diff) | |
parent | e637aa32b86dec4778ac8dd934266bb3755bc773 (diff) | |
download | platform_hardware_interfaces-3c739df2644a098212b9a974bdf724818aad938c.tar.gz platform_hardware_interfaces-3c739df2644a098212b9a974bdf724818aad938c.tar.bz2 platform_hardware_interfaces-3c739df2644a098212b9a974bdf724818aad938c.zip |
biometrics: fingerprint: add locking to default impl
am: e637aa32b8
Change-Id: Ib9f1d713917a87520353d67b8cdabfcdd1f20048
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; }; |