sm8350-common: fod: Implement handleAcquire()

Change-Id: Ica796fbd468e2df0ee666a0d0c6cbde628d6989f
This commit is contained in:
LuK1337 2019-07-02 15:05:43 +02:00 committed by Cosmin Tanislav
parent 5d0056c142
commit aba98c92b9
2 changed files with 32 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
@ -101,7 +103,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;
}
@ -122,7 +146,10 @@ 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