sm8150-common: fod: Implement handleAcquire, handleError()

Change-Id: Ica796fbd468e2df0ee666a0d0c6cbde628d6989f
This commit is contained in:
LuK1337 2019-07-02 15:05:43 +02:00
parent e0bb872092
commit 9f7ed6cc78
2 changed files with 33 additions and 3 deletions

View File

@ -21,6 +21,8 @@
#include <hidl/HidlTransportSupport.h>
#include <fstream>
#define FINGERPRINT_ACQUIRED_VENDOR 6
#define OP_ENABLE_FP_LONGPRESS 3
#define OP_DISABLE_FP_LONGPRESS 4
#define OP_RESUME_FP_ENROLL 8
@ -123,8 +125,35 @@ Return<void> FingerprintInscreen::onHideFODView() {
return Void();
}
Return<bool> FingerprintInscreen::shouldHandleError(int32_t error) {
return error != 8;
Return<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t 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;
}
Return<bool> FingerprintInscreen::handleError(int32_t, int32_t) {
return false;
}
Return<void> FingerprintInscreen::setLongPressEnabled(bool enabled) {

View File

@ -44,7 +44,8 @@ class FingerprintInscreen : public IFingerprintInscreen {
Return<void> onRelease() override;
Return<void> onShowFODView() override;
Return<void> onHideFODView() override;
Return<bool> shouldHandleError(int32_t error) override;
Return<bool> handleAcquired(int32_t acquiredInfo, int32_t vendorCode) override;
Return<bool> handleError(int32_t error, int32_t vendorCode) override;
Return<void> setLongPressEnabled(bool enabled) override;
Return<int32_t> getDimAmount(int32_t cur_brightness) override;
Return<bool> shouldBoostBrightness() override;