device_lenovo_sdm710-common/fod/FingerprintInscreen.cpp
Peter Cai ff80ac595a sdm710-common: Implement fod hal
* also set fp sensor location overlay

Signed-off-by: SagarMakhar <sagarmakhar@gmail.com>
2019-10-07 22:17:59 +05:30

131 lines
3.2 KiB
C++

/*
* Copyright (C) 2019 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "FingerprintInscreenService"
#include "FingerprintInscreen.h"
#include <hidl/HidlTransportSupport.h>
#include <android-base/logging.h>
#include <fstream>
#include <cmath>
namespace {
template <typename T>
static void set(const std::string& path, const T& value) {
std::ofstream file(path);
file << value;
LOG(INFO) << "wrote path: " << path << ", value: " << value << "\n";
}
template <typename T>
static T get(const std::string& path, const T& def) {
std::ifstream file(path);
T result;
file >> result;
return file.fail() ? def : result;
}
} // anonymous namespace
namespace vendor {
namespace lineage {
namespace biometrics {
namespace fingerprint {
namespace inscreen {
namespace V1_0 {
namespace implementation {
FingerprintInscreen::FingerprintInscreen() {
}
Return<int32_t> FingerprintInscreen::getPositionX() {
return FOD_POS_X;
}
Return<int32_t> FingerprintInscreen::getPositionY() {
return FOD_POS_Y;
}
Return<int32_t> FingerprintInscreen::getSize() {
return FOD_SIZE;
}
Return<void> FingerprintInscreen::onStartEnroll() {
return Void();
}
Return<void> FingerprintInscreen::onFinishEnroll() {
return Void();
}
Return<void> FingerprintInscreen::onPress() {
return Void();
}
Return<void> FingerprintInscreen::onRelease() {
return Void();
}
Return<void> FingerprintInscreen::onShowFODView() {
return Void();
}
Return<void> FingerprintInscreen::onHideFODView() {
return Void();
}
Return<bool> FingerprintInscreen::handleAcquired(int32_t acquiredInfo, int32_t vendorCode) {
LOG(ERROR) << "acquiredInfo: " << acquiredInfo << ", vendorCode: " << vendorCode << "\n";
return false;
}
Return<bool> FingerprintInscreen::handleError(int32_t error, int32_t vendorCode) {
LOG(ERROR) << "error: " << error << ", vendorCode: " << vendorCode << "\n";
return false;
}
Return<void> FingerprintInscreen::setLongPressEnabled(bool) {
return Void();
}
Return<int32_t> FingerprintInscreen::getDimAmount(int32_t) {
int dimAmount = 0;
LOG(INFO) << "dimAmount = " << dimAmount;
return dimAmount;
}
Return<bool> FingerprintInscreen::shouldBoostBrightness() {
return false;
}
Return<void> FingerprintInscreen::setCallback(const sp<::vendor::lineage::biometrics::fingerprint::inscreen::V1_0::IFingerprintInscreenCallback>& callback) {
{
std::lock_guard<std::mutex> _lock(mCallbackLock);
mCallback = callback;
}
return Void();
}
} // namespace implementation
} // namespace V1_0
} // namespace inscreen
} // namespace fingerprint
} // namespace biometrics
} // namespace lineage
} // namespace vendor