davinci: fod: Implement handleAcquire()

Change-Id: Ica796fbd468e2df0ee666a0d0c6cbde628d6989f
This commit is contained in:
LuK1337 2019-07-02 15:05:43 +02:00 committed by Arian
parent 48c907ba7c
commit 42d82f7684
No known key found for this signature in database
GPG Key ID: 48029380598CE3B9
2 changed files with 34 additions and 2 deletions

View File

@ -22,6 +22,8 @@
#include <fstream>
#include <cmath>
#define FINGERPRINT_ACQUIRED_VENDOR 6
#define COMMAND_NIT 10
#define PARAM_NIT_FOD 1
#define PARAM_NIT_NONE 0
@ -113,7 +115,29 @@ Return<void> FingerprintInscreen::onHideFODView() {
}
Return<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t vendorCode) {
LOG(ERROR) << "acquiredInfo: " << acquiredInfo << ", vendorCode: " << vendorCode;
std::lock_guard<std::mutex> _lock(mCallbackLock);
if (mCallback == nullptr) {
return false;
}
if (acquiredInfo == FINGERPRINT_ACQUIRED_VENDOR) {
if (vendorCode == 0) {
Return<void> ret = mCallback->onFingerDown();
if (!ret.isOk()) {
LOG(ERROR) << "FingerDown() error: " << ret.description();
}
return true;
}
if (vendorCode == 1) {
Return<void> ret = mCallback->onFingerUp();
if (!ret.isOk()) {
LOG(ERROR) << "FingerUp() error: " << ret.description();
}
return true;
}
}
return false;
}
@ -143,7 +167,12 @@ Return<bool> FingerprintInscreen::shouldBoostBrightness() {
return false;
}
Return<void> FingerprintInscreen::setCallback(const sp<IFingerprintInscreenCallback>& /* callback */) {
Return<void> FingerprintInscreen::setCallback(const sp<IFingerprintInscreenCallback>& callback) {
{
std::lock_guard<std::mutex> _lock(mCallbackLock);
mCallback = callback;
}
return Void();
}

View File

@ -54,6 +54,9 @@ public:
private:
sp<IXiaomiFingerprint> xiaomiFingerprintService;
std::mutex mCallbackLock;
sp<IFingerprintInscreenCallback> mCallback;
};
} // namespace implementation