Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
290ea62e4c | ||
| d71e30aa7d | |||
|
|
fb6bc4908e | ||
|
|
7979a73bf3 |
@@ -5,9 +5,9 @@
|
||||
#
|
||||
|
||||
PRODUCT_MAKEFILES := \
|
||||
$(LOCAL_DIR)/evolution_raphael.mk
|
||||
$(LOCAL_DIR)/lineage_raphael.mk
|
||||
|
||||
COMMON_LUNCH_CHOICES := \
|
||||
evolution_raphael-user \
|
||||
evolution_raphael-userdebug \
|
||||
evolution_raphael-eng
|
||||
lineage_raphael-user \
|
||||
lineage_raphael-userdebug \
|
||||
lineage_raphael-eng
|
||||
|
||||
@@ -46,10 +46,10 @@ TARGET_HAS_HDR_DISPLAY := true
|
||||
TARGET_HAS_WIDE_COLOR_DISPLAY := true
|
||||
|
||||
# Camera
|
||||
TARGET_CAMERA_USES_NEWER_HIDL_OVERRIDE_FORMAT := true
|
||||
TARGET_INCLUDES_MIUI_CAMERA := true
|
||||
MALLOC_SVELTE := true
|
||||
MALLOC_SVELTE_FOR_LIBC32 := true
|
||||
TARGET_CAMERA_OVERRIDE_FORMAT_FROM_RESERVED := true
|
||||
|
||||
# Camera - Miui
|
||||
TARGET_CAMERA_PACKAGE_NAME := com.android.camera
|
||||
|
||||
# Display
|
||||
TARGET_DISABLED_UBWC := true
|
||||
@@ -66,7 +66,7 @@ TARGET_FS_CONFIG_GEN := $(DEVICE_PATH)/config.fs
|
||||
|
||||
# Fingerprint
|
||||
TARGET_INPUTDISPATCHER_SKIP_EVENT_KEY := 338
|
||||
TARGET_SURFACEFLINGER_UDFPS_LIB := //$(DEVICE_PATH):libudfps_extension.xiaomi_raphael
|
||||
TARGET_SURFACEFLINGER_UDFPS_LIB := //hardware/xiaomi:libudfps_extension.xiaomi
|
||||
TARGET_USES_FOD_ZPOS := true
|
||||
|
||||
# FM
|
||||
@@ -74,7 +74,7 @@ BOARD_HAVE_QCOM_FM := true
|
||||
|
||||
# HIDL
|
||||
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
|
||||
vendor/evolution/config/device_framework_matrix.xml
|
||||
vendor/lineage/config/device_framework_matrix.xml
|
||||
DEVICE_MANIFEST_FILE := $(DEVICE_PATH)/hidl/manifest.xml
|
||||
DEVICE_MATRIX_FILE := $(DEVICE_PATH)/hidl/compatibility_matrix.xml
|
||||
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE := $(DEVICE_PATH)/hidl/framework_compatibility_matrix.xml
|
||||
@@ -101,14 +101,7 @@ BOARD_KERNEL_IMAGE_NAME := Image.gz-dtb
|
||||
BOARD_KERNEL_PAGESIZE := 4096
|
||||
BOARD_KERNEL_SEPARATED_DTBO := true
|
||||
BOARD_RAMDISK_USE_LZ4 := true
|
||||
TARGET_KERNEL_CLANG_VERSION := boolx-clang
|
||||
TARGET_KERNEL_CLANG_PATH := $(shell pwd)/prebuilts/clang/host/linux-x86/$(TARGET_KERNEL_CLANG_VERSION)
|
||||
TARGET_KERNEL_CLANG_COMPILE := true
|
||||
TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(TARGET_KERNEL_CLANG_PATH)/bin/aarch64-linux-gnu-
|
||||
TARGET_KERNEL_CROSS_COMPILE_ARM32_PREFIX := $(TARGET_KERNEL_CLANG_PATH)/bin/arm-linux-gnueabi-
|
||||
TARGET_KERNEL_ADDITIONAL_FLAGS := LLVM=1 LLVM_IAS=1
|
||||
KERNEL_SUPPORTS_LLVM_TOOLS := true
|
||||
KERNEL_LD := LD=ld.lld
|
||||
TARGET_KERNEL_CLANG_VERSION := r522817
|
||||
TARGET_KERNEL_SOURCE := kernel/xiaomi/raphael
|
||||
TARGET_KERNEL_CONFIG := raphael_defconfig
|
||||
|
||||
|
||||
@@ -157,11 +157,6 @@ PRODUCT_PACKAGES += \
|
||||
vendor.qti.hardware.btconfigstore@1.0.vendor \
|
||||
vendor.qti.hardware.btconfigstore@2.0.vendor
|
||||
|
||||
# Blur
|
||||
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
|
||||
ro.sf.blurs_are_expensive=1 \
|
||||
ro.surface_flinger.supports_background_blur=1
|
||||
|
||||
# Board
|
||||
PRODUCT_USES_QCOM_HARDWARE := true
|
||||
PRODUCT_BOARD_PLATFORM := msmnile
|
||||
@@ -242,7 +237,9 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Fingerprint
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael
|
||||
android.hardware.biometrics.fingerprint@2.3-service.xiaomi \
|
||||
vendor.goodix.hardware.biometrics.fingerprint@2.1.vendor \
|
||||
libudfpshandler
|
||||
|
||||
# FM
|
||||
PRODUCT_PACKAGES += \
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
[
|
||||
{
|
||||
"repository": "onettboots/bool-x_xiaomi_raphael",
|
||||
"target_path": "kernel/xiaomi/raphael",
|
||||
"remote": "github",
|
||||
"branch": "dev/DSPcassOcd"
|
||||
},
|
||||
{
|
||||
"repository": "vendor_xiaomi_raphael",
|
||||
"target_path": "vendor/xiaomi/raphael"
|
||||
},
|
||||
{
|
||||
"repository": "evo-x/vendor_xiaomi_miuicamera",
|
||||
"target_path": "vendor/xiaomi/miuicamera",
|
||||
"remote": "bb"
|
||||
},
|
||||
{
|
||||
"repository": "packages_apps_ViPER4AndroidFX",
|
||||
"target_path": "packages/apps/ViPER4AndroidFX"
|
||||
}
|
||||
{
|
||||
"repository": "vendor_xiaomi_raphael",
|
||||
"target_path": "vendor/xiaomi/raphael"
|
||||
},
|
||||
{
|
||||
"repository": "hardware_xiaomi",
|
||||
"target_path": "hardware/xiaomi"
|
||||
},
|
||||
{
|
||||
"repository": "packages_apps_ViPER4AndroidFX",
|
||||
"target_path": "packages/apps/ViPER4AndroidFX"
|
||||
},
|
||||
{
|
||||
"repository": "vendor_xiaomi_miuicamera",
|
||||
"target_path": "vendor/xiaomi/miuicamera",
|
||||
"remote": "evo-main"
|
||||
},
|
||||
{
|
||||
"repository": "SOVIET-ANDROID/kernel_xiaomi_raphael",
|
||||
"target_path": "kernel/xiaomi/raphael",
|
||||
"remote": "github-non-los",
|
||||
"branch": "14.0-matrix"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2017-2020 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.
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael",
|
||||
relative_install_path: "hw",
|
||||
defaults: ["hidl_defaults"],
|
||||
init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael.rc"],
|
||||
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael.xml"],
|
||||
srcs: ["service.cpp", "BiometricsFingerprint.cpp"],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libhardware",
|
||||
"libhidlbase",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"libcutils",
|
||||
"android.hardware.biometrics.fingerprint@2.1",
|
||||
"android.hardware.biometrics.fingerprint@2.2",
|
||||
"android.hardware.biometrics.fingerprint@2.3",
|
||||
"vendor.goodix.hardware.biometrics.fingerprint@2.1",
|
||||
"vendor.xiaomi.hardware.fingerprintextension@1.0",
|
||||
"android.hardware.power-V1-ndk",
|
||||
"pixel-power-ext-V1-ndk",
|
||||
"libbinder_ndk",
|
||||
],
|
||||
proprietary: true,
|
||||
lto: {
|
||||
thin: true,
|
||||
},
|
||||
whole_program_vtables: true,
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "libudfps_extension.xiaomi_raphael",
|
||||
srcs: ["UdfpsExtension.cpp"],
|
||||
include_dirs: [
|
||||
"frameworks/native/services/surfaceflinger/CompositionEngine/include"
|
||||
],
|
||||
header_libs: [
|
||||
"generated_kernel_headers",
|
||||
],
|
||||
lto: {
|
||||
thin: true,
|
||||
},
|
||||
whole_program_vtables: true,
|
||||
}
|
||||
@@ -1,595 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2018-2020 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 "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael"
|
||||
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
#include <android/binder_manager.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/hw_auth_token.h>
|
||||
#include <inttypes.h>
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <thread>
|
||||
|
||||
#include <aidl/android/hardware/power/IPower.h>
|
||||
#include <aidl/google/hardware/power/extension/pixel/IPowerExt.h>
|
||||
|
||||
using ::aidl::android::hardware::power::IPower;
|
||||
using ::aidl::google::hardware::power::extension::pixel::IPowerExt;
|
||||
|
||||
#define COMMAND_NIT 10
|
||||
#define PARAM_NIT_FOD 1
|
||||
#define PARAM_NIT_NONE 0
|
||||
|
||||
#define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status"
|
||||
#define FOD_STATUS_ON 1
|
||||
#define FOD_STATUS_OFF 0
|
||||
|
||||
#define FOD_UI_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui"
|
||||
|
||||
namespace {
|
||||
|
||||
template <typename T>
|
||||
static void set(const std::string& path, const T& value) {
|
||||
std::ofstream file(path);
|
||||
file << value;
|
||||
}
|
||||
|
||||
static bool readBool(int fd) {
|
||||
char c;
|
||||
int rc;
|
||||
|
||||
rc = lseek(fd, 0, SEEK_SET);
|
||||
if (rc) {
|
||||
ALOGE("failed to seek fd, err: %d", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = read(fd, &c, sizeof(char));
|
||||
if (rc != 1) {
|
||||
ALOGE("failed to read bool from fd, err: %d", rc);
|
||||
return false;
|
||||
}
|
||||
|
||||
return c != '0';
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_3 {
|
||||
namespace implementation {
|
||||
|
||||
// Supported fingerprint HAL version
|
||||
static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1);
|
||||
constexpr char kBoostHint[] = "LAUNCH";
|
||||
constexpr int32_t kBoostDurationMs = 2000;
|
||||
|
||||
using RequestStatus = android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
|
||||
|
||||
BiometricsFingerprint* BiometricsFingerprint::sInstance = nullptr;
|
||||
|
||||
BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr), mBoostHintIsSupported(false), mBoostHintSupportIsChecked(false), mPowerHalExtAidl(nullptr) {
|
||||
sInstance = this; // keep track of the most recent instance
|
||||
mDevice = openHal();
|
||||
if (!mDevice) {
|
||||
ALOGE("Can't open HAL module");
|
||||
}
|
||||
|
||||
std::thread([this]() {
|
||||
int fd = open(FOD_UI_PATH, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
ALOGE("failed to open fd, err: %d", fd);
|
||||
return;
|
||||
}
|
||||
|
||||
struct pollfd fodUiPoll = {
|
||||
.fd = fd,
|
||||
.events = POLLERR | POLLPRI,
|
||||
.revents = 0,
|
||||
};
|
||||
|
||||
while (true) {
|
||||
int rc = poll(&fodUiPoll, 1, -1);
|
||||
if (rc < 0) {
|
||||
ALOGE("failed to poll fd, err: %d", rc);
|
||||
continue;
|
||||
}
|
||||
|
||||
bool fingerDown = readBool(fd);
|
||||
ALOGI("fod_ui status: %d", fingerDown);
|
||||
extCmd(COMMAND_NIT, fingerDown ? PARAM_NIT_FOD : PARAM_NIT_NONE);
|
||||
if (!fingerDown) {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
|
||||
}
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
|
||||
int32_t BiometricsFingerprint::connectPowerHalExt() {
|
||||
if (mPowerHalExtAidl) {
|
||||
return android::NO_ERROR;
|
||||
}
|
||||
const std::string kInstance = std::string(IPower::descriptor) + "/default";
|
||||
ndk::SpAIBinder pwBinder = ndk::SpAIBinder(AServiceManager_getService(kInstance.c_str()));
|
||||
ndk::SpAIBinder pwExtBinder;
|
||||
AIBinder_getExtension(pwBinder.get(), pwExtBinder.getR());
|
||||
mPowerHalExtAidl = IPowerExt::fromBinder(pwExtBinder);
|
||||
if (!mPowerHalExtAidl) {
|
||||
ALOGE("failed to connect power HAL extension");
|
||||
return -EINVAL;
|
||||
}
|
||||
ALOGI("connect power HAL extension successfully");
|
||||
return android::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t BiometricsFingerprint::checkPowerHalExtBoostSupport(const std::string &boost) {
|
||||
if (boost.empty() || connectPowerHalExt() != android::NO_ERROR) {
|
||||
return -EINVAL;
|
||||
}
|
||||
bool isSupported = false;
|
||||
auto ret = mPowerHalExtAidl->isBoostSupported(boost.c_str(), &isSupported);
|
||||
if (!ret.isOk()) {
|
||||
ALOGE("failed to check power HAL extension hint: boost=%s", boost.c_str());
|
||||
if (ret.getExceptionCode() == EX_TRANSACTION_FAILED) {
|
||||
/*
|
||||
* PowerHAL service may crash due to some reasons, this could end up
|
||||
* binder transaction failure. Set nullptr here to trigger re-connection.
|
||||
*/
|
||||
ALOGE("binder transaction failed for power HAL extension hint");
|
||||
mPowerHalExtAidl = nullptr;
|
||||
return -ENOTCONN;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!isSupported) {
|
||||
ALOGW("power HAL extension hint is not supported: boost=%s", boost.c_str());
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
ALOGI("power HAL extension hint is supported: boost=%s", boost.c_str());
|
||||
return android::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t BiometricsFingerprint::sendPowerHalExtBoost(const std::string &boost,
|
||||
int32_t durationMs) {
|
||||
if (boost.empty() || connectPowerHalExt() != android::NO_ERROR) {
|
||||
return -EINVAL;
|
||||
}
|
||||
auto ret = mPowerHalExtAidl->setBoost(boost.c_str(), durationMs);
|
||||
if (!ret.isOk()) {
|
||||
ALOGE("failed to send power HAL extension hint: boost=%s, duration=%d", boost.c_str(),
|
||||
durationMs);
|
||||
if (ret.getExceptionCode() == EX_TRANSACTION_FAILED) {
|
||||
/*
|
||||
* PowerHAL service may crash due to some reasons, this could end up
|
||||
* binder transaction failure. Set nullptr here to trigger re-connection.
|
||||
*/
|
||||
ALOGE("binder transaction failed for power HAL extension hint");
|
||||
mPowerHalExtAidl = nullptr;
|
||||
return -ENOTCONN;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
return android::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t BiometricsFingerprint::isBoostHintSupported() {
|
||||
int32_t ret = android::NO_ERROR;
|
||||
if (mBoostHintSupportIsChecked) {
|
||||
ret = mBoostHintIsSupported ? android::NO_ERROR : -EOPNOTSUPP;
|
||||
return ret;
|
||||
}
|
||||
ret = checkPowerHalExtBoostSupport(kBoostHint);
|
||||
if (ret == android::NO_ERROR) {
|
||||
mBoostHintIsSupported = true;
|
||||
mBoostHintSupportIsChecked = true;
|
||||
ALOGI("Boost hint is supported");
|
||||
} else if (ret == -EOPNOTSUPP) {
|
||||
mBoostHintSupportIsChecked = true;
|
||||
ALOGI("Boost hint is unsupported");
|
||||
} else {
|
||||
ALOGW("Failed to check the support of boost hint, ret %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t BiometricsFingerprint::sendAuthenticatedBoostHint() {
|
||||
int32_t ret = isBoostHintSupported();
|
||||
if (ret != android::NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
ret = sendPowerHalExtBoost(kBoostHint, kBoostDurationMs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
BiometricsFingerprint::~BiometricsFingerprint() {
|
||||
ALOGV("~BiometricsFingerprint()");
|
||||
if (mDevice == nullptr) {
|
||||
ALOGE("No valid device");
|
||||
return;
|
||||
}
|
||||
int err;
|
||||
if (0 != (err = mDevice->common.close(reinterpret_cast<hw_device_t*>(mDevice)))) {
|
||||
ALOGE("Can't close fingerprint module, error: %d", err);
|
||||
return;
|
||||
}
|
||||
mDevice = nullptr;
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::ErrorFilter(int32_t error) {
|
||||
switch (error) {
|
||||
case 0:
|
||||
return RequestStatus::SYS_OK;
|
||||
case -2:
|
||||
return RequestStatus::SYS_ENOENT;
|
||||
case -4:
|
||||
return RequestStatus::SYS_EINTR;
|
||||
case -5:
|
||||
return RequestStatus::SYS_EIO;
|
||||
case -11:
|
||||
return RequestStatus::SYS_EAGAIN;
|
||||
case -12:
|
||||
return RequestStatus::SYS_ENOMEM;
|
||||
case -13:
|
||||
return RequestStatus::SYS_EACCES;
|
||||
case -14:
|
||||
return RequestStatus::SYS_EFAULT;
|
||||
case -16:
|
||||
return RequestStatus::SYS_EBUSY;
|
||||
case -22:
|
||||
return RequestStatus::SYS_EINVAL;
|
||||
case -28:
|
||||
return RequestStatus::SYS_ENOSPC;
|
||||
case -110:
|
||||
return RequestStatus::SYS_ETIMEDOUT;
|
||||
default:
|
||||
ALOGE("An unknown error returned from fingerprint vendor library: %d", error);
|
||||
return RequestStatus::SYS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
// Translate from errors returned by traditional HAL (see fingerprint.h) to
|
||||
// HIDL-compliant FingerprintError.
|
||||
FingerprintError BiometricsFingerprint::VendorErrorFilter(int32_t error, int32_t* vendorCode) {
|
||||
*vendorCode = 0;
|
||||
switch (error) {
|
||||
case FINGERPRINT_ERROR_HW_UNAVAILABLE:
|
||||
return FingerprintError::ERROR_HW_UNAVAILABLE;
|
||||
case FINGERPRINT_ERROR_UNABLE_TO_PROCESS:
|
||||
return FingerprintError::ERROR_UNABLE_TO_PROCESS;
|
||||
case FINGERPRINT_ERROR_TIMEOUT:
|
||||
return FingerprintError::ERROR_TIMEOUT;
|
||||
case FINGERPRINT_ERROR_NO_SPACE:
|
||||
return FingerprintError::ERROR_NO_SPACE;
|
||||
case FINGERPRINT_ERROR_CANCELED:
|
||||
return FingerprintError::ERROR_CANCELED;
|
||||
case FINGERPRINT_ERROR_UNABLE_TO_REMOVE:
|
||||
return FingerprintError::ERROR_UNABLE_TO_REMOVE;
|
||||
case FINGERPRINT_ERROR_LOCKOUT:
|
||||
return FingerprintError::ERROR_LOCKOUT;
|
||||
default:
|
||||
if (error >= FINGERPRINT_ERROR_VENDOR_BASE) {
|
||||
// vendor specific code.
|
||||
*vendorCode = error - FINGERPRINT_ERROR_VENDOR_BASE;
|
||||
return FingerprintError::ERROR_VENDOR;
|
||||
}
|
||||
}
|
||||
ALOGE("Unknown error from fingerprint vendor library: %d", error);
|
||||
return FingerprintError::ERROR_UNABLE_TO_PROCESS;
|
||||
}
|
||||
|
||||
// Translate acquired messages returned by traditional HAL (see fingerprint.h)
|
||||
// to HIDL-compliant FingerprintAcquiredInfo.
|
||||
FingerprintAcquiredInfo BiometricsFingerprint::VendorAcquiredFilter(int32_t info,
|
||||
int32_t* vendorCode) {
|
||||
*vendorCode = 0;
|
||||
switch (info) {
|
||||
case FINGERPRINT_ACQUIRED_GOOD:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_GOOD;
|
||||
case FINGERPRINT_ACQUIRED_PARTIAL:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_PARTIAL;
|
||||
case FINGERPRINT_ACQUIRED_INSUFFICIENT:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
|
||||
case FINGERPRINT_ACQUIRED_IMAGER_DIRTY:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_IMAGER_DIRTY;
|
||||
case FINGERPRINT_ACQUIRED_TOO_SLOW:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_TOO_SLOW;
|
||||
case FINGERPRINT_ACQUIRED_TOO_FAST:
|
||||
return FingerprintAcquiredInfo::ACQUIRED_TOO_FAST;
|
||||
default:
|
||||
if (info >= FINGERPRINT_ACQUIRED_VENDOR_BASE) {
|
||||
// vendor specific code.
|
||||
*vendorCode = info - FINGERPRINT_ACQUIRED_VENDOR_BASE;
|
||||
return FingerprintAcquiredInfo::ACQUIRED_GOOD;
|
||||
}
|
||||
}
|
||||
ALOGE("Unknown acquiredmsg from fingerprint vendor library: %d", info);
|
||||
return FingerprintAcquiredInfo::ACQUIRED_INSUFFICIENT;
|
||||
}
|
||||
|
||||
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
|
||||
// token for each call to setNotify(). This is fine as long as there's only
|
||||
// one fingerprint device on the platform.
|
||||
return reinterpret_cast<uint64_t>(mDevice);
|
||||
}
|
||||
|
||||
Return<uint64_t> BiometricsFingerprint::preEnroll() {
|
||||
return mDevice->pre_enroll(mDevice);
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::enroll(const hidl_array<uint8_t, 69>& hat,
|
||||
uint32_t gid, uint32_t timeoutSec) {
|
||||
const hw_auth_token_t* authToken = reinterpret_cast<const hw_auth_token_t*>(hat.data());
|
||||
return ErrorFilter(mDevice->enroll(mDevice, authToken, gid, timeoutSec));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::postEnroll() {
|
||||
return ErrorFilter(mDevice->cancel(mDevice));
|
||||
}
|
||||
|
||||
Return<uint64_t> BiometricsFingerprint::getAuthenticatorId() {
|
||||
return mDevice->get_authenticator_id(mDevice);
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::cancel() {
|
||||
return ErrorFilter(mDevice->cancel(mDevice));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::enumerate() {
|
||||
return ErrorFilter(mDevice->enumerate(mDevice));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::remove(uint32_t gid, uint32_t fid) {
|
||||
return ErrorFilter(mDevice->remove(mDevice, gid, fid));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::setActiveGroup(uint32_t gid,
|
||||
const hidl_string& storePath) {
|
||||
if (storePath.size() >= PATH_MAX || storePath.size() <= 0) {
|
||||
ALOGE("Bad path length: %zd", storePath.size());
|
||||
return RequestStatus::SYS_EINVAL;
|
||||
}
|
||||
std::string mutableStorePath = storePath;
|
||||
if (android::base::StartsWith(mutableStorePath, "/data/system/users/")) {
|
||||
mutableStorePath = "/data/vendor_de/";
|
||||
mutableStorePath +=
|
||||
static_cast<std::string>(storePath).substr(strlen("/data/system/users/"));
|
||||
}
|
||||
if (access(mutableStorePath.c_str(), W_OK)) {
|
||||
return RequestStatus::SYS_EINVAL;
|
||||
}
|
||||
|
||||
return ErrorFilter(mDevice->set_active_group(mDevice, gid, mutableStorePath.c_str()));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId, uint32_t gid) {
|
||||
return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid));
|
||||
}
|
||||
|
||||
IBiometricsFingerprint* BiometricsFingerprint::getInstance() {
|
||||
if (!sInstance) {
|
||||
sInstance = new BiometricsFingerprint();
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
void setFpVendorProp(const char* fp_vendor) {
|
||||
property_set("persist.vendor.sys.fp.vendor", fp_vendor);
|
||||
}
|
||||
|
||||
fingerprint_device_t* getDeviceForVendor(const char* class_name) {
|
||||
const hw_module_t* hw_module = nullptr;
|
||||
int err;
|
||||
|
||||
err = hw_get_module_by_class(FINGERPRINT_HARDWARE_MODULE_ID, class_name, &hw_module);
|
||||
if (err) {
|
||||
ALOGE("Failed to get fingerprint module: class %s, error %d", class_name, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (hw_module == nullptr) {
|
||||
ALOGE("No valid fingerprint module: class %s", class_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_module_t const* fp_module = reinterpret_cast<const fingerprint_module_t*>(hw_module);
|
||||
|
||||
if (fp_module->common.methods->open == nullptr) {
|
||||
ALOGE("No valid open method: class %s", class_name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
hw_device_t* device = nullptr;
|
||||
|
||||
err = fp_module->common.methods->open(hw_module, nullptr, &device);
|
||||
if (err) {
|
||||
ALOGE("Can't open fingerprint methods, class %s, error: %d", class_name, err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (kVersion != device->version) {
|
||||
ALOGE("Wrong fingerprint version: expected %d, got %d", kVersion, device->version);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_device_t* fp_device = reinterpret_cast<fingerprint_device_t*>(device);
|
||||
|
||||
ALOGI("Loaded fingerprint module: class %s", class_name);
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
fingerprint_device_t* getFingerprintDevice() {
|
||||
fingerprint_device_t* fp_device;
|
||||
|
||||
fp_device = getDeviceForVendor("goodix_fod");
|
||||
if (fp_device == nullptr) {
|
||||
ALOGE("Failed to load goodix_fod fingerprint module");
|
||||
} else {
|
||||
setFpVendorProp("goodix_fod");
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
setFpVendorProp("none");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_device_t* BiometricsFingerprint::openHal() {
|
||||
int err;
|
||||
|
||||
fingerprint_device_t* fp_device;
|
||||
fp_device = getFingerprintDevice();
|
||||
if (fp_device == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (0 != (err = fp_device->set_notify(fp_device, BiometricsFingerprint::notify))) {
|
||||
ALOGE("Can't register fingerprint module callback, error: %d", err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return fp_device;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
const uint64_t devId = reinterpret_cast<uint64_t>(thisPtr->mDevice);
|
||||
switch (msg->type) {
|
||||
case FINGERPRINT_ERROR: {
|
||||
int32_t vendorCode = 0;
|
||||
FingerprintError result = VendorErrorFilter(msg->data.error, &vendorCode);
|
||||
ALOGD("onError(%d)", result);
|
||||
if (!thisPtr->mClientCallback->onError(devId, result, vendorCode).isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onError callback");
|
||||
}
|
||||
} break;
|
||||
case FINGERPRINT_ACQUIRED: {
|
||||
int32_t vendorCode = 0;
|
||||
FingerprintAcquiredInfo result =
|
||||
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
|
||||
ALOGD("onAcquired(%d)", result);
|
||||
if (!thisPtr->mClientCallback->onAcquired(devId, result, vendorCode).isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onAcquired callback");
|
||||
}
|
||||
} break;
|
||||
case FINGERPRINT_TEMPLATE_ENROLLING:
|
||||
ALOGD("onEnrollResult(fid=%d, gid=%d, rem=%d)", msg->data.enroll.finger.fid,
|
||||
msg->data.enroll.finger.gid, msg->data.enroll.samples_remaining);
|
||||
if (!thisPtr->mClientCallback
|
||||
->onEnrollResult(devId, msg->data.enroll.finger.fid,
|
||||
msg->data.enroll.finger.gid,
|
||||
msg->data.enroll.samples_remaining)
|
||||
.isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onEnrollResult callback");
|
||||
}
|
||||
break;
|
||||
case FINGERPRINT_TEMPLATE_REMOVED:
|
||||
ALOGD("onRemove(fid=%d, gid=%d, rem=%d)", msg->data.removed.finger.fid,
|
||||
msg->data.removed.finger.gid, msg->data.removed.remaining_templates);
|
||||
if (!thisPtr->mClientCallback
|
||||
->onRemoved(devId, msg->data.removed.finger.fid, msg->data.removed.finger.gid,
|
||||
msg->data.removed.remaining_templates)
|
||||
.isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onRemoved callback");
|
||||
}
|
||||
break;
|
||||
case FINGERPRINT_AUTHENTICATED:
|
||||
if (msg->data.authenticated.finger.fid != 0) {
|
||||
ALOGD("onAuthenticated(fid=%d, gid=%d)", msg->data.authenticated.finger.fid,
|
||||
msg->data.authenticated.finger.gid);
|
||||
const uint8_t* hat = reinterpret_cast<const uint8_t*>(&msg->data.authenticated.hat);
|
||||
const hidl_vec<uint8_t> token(
|
||||
std::vector<uint8_t>(hat, hat + sizeof(msg->data.authenticated.hat)));
|
||||
if (!thisPtr->mClientCallback
|
||||
->onAuthenticated(devId, msg->data.authenticated.finger.fid,
|
||||
msg->data.authenticated.finger.gid, token)
|
||||
.isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onAuthenticated callback");
|
||||
} else {
|
||||
if (thisPtr->sendAuthenticatedBoostHint() != android::NO_ERROR) {
|
||||
ALOGE("failed to send authenticated boost");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Not a recognized fingerprint
|
||||
if (!thisPtr->mClientCallback
|
||||
->onAuthenticated(devId, msg->data.authenticated.finger.fid,
|
||||
msg->data.authenticated.finger.gid, hidl_vec<uint8_t>())
|
||||
.isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onAuthenticated callback");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case FINGERPRINT_TEMPLATE_ENUMERATING:
|
||||
ALOGD("onEnumerate(fid=%d, gid=%d, rem=%d)", msg->data.enumerated.finger.fid,
|
||||
msg->data.enumerated.finger.gid, msg->data.enumerated.remaining_templates);
|
||||
if (!thisPtr->mClientCallback
|
||||
->onEnumerate(devId, msg->data.enumerated.finger.fid,
|
||||
msg->data.enumerated.finger.gid,
|
||||
msg->data.enumerated.remaining_templates)
|
||||
.isOk()) {
|
||||
ALOGE("failed to invoke fingerprint onEnumerate callback");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Return<int32_t> BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) {
|
||||
return mDevice->extCmd(mDevice, cmd, param);
|
||||
}
|
||||
|
||||
Return<bool> BiometricsFingerprint::isUdfps(uint32_t /* sensorId */) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerDown(uint32_t /* x */, uint32_t /* y */,
|
||||
float /* minor */, float /* major */) {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_ON);
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> BiometricsFingerprint::onFingerUp() {
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_3
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
|
||||
#include <android/hardware/biometrics/fingerprint/2.3/IBiometricsFingerprint.h>
|
||||
#include <android/log.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <log/log.h>
|
||||
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
|
||||
|
||||
#include "fingerprint.h"
|
||||
|
||||
namespace aidl {
|
||||
namespace google {
|
||||
namespace hardware {
|
||||
namespace power {
|
||||
namespace extension {
|
||||
namespace pixel {
|
||||
|
||||
class IPowerExt;
|
||||
|
||||
} // namespace pixel
|
||||
} // namespace extension
|
||||
} // namespace power
|
||||
} // namespace hardware
|
||||
} // namespace google
|
||||
} // namespace aidl
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_3 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintError;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
|
||||
|
||||
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
|
||||
|
||||
struct BiometricsFingerprint : public IBiometricsFingerprint, public IXiaomiFingerprint {
|
||||
BiometricsFingerprint();
|
||||
~BiometricsFingerprint();
|
||||
|
||||
status_t registerAsSystemService();
|
||||
|
||||
// Method to wrap legacy HAL with BiometricsFingerprint class
|
||||
static IBiometricsFingerprint* getInstance();
|
||||
|
||||
// Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint follow.
|
||||
Return<uint64_t> setNotify(
|
||||
const sp<IBiometricsFingerprintClientCallback>& clientCallback) override;
|
||||
Return<uint64_t> preEnroll() override;
|
||||
Return<RequestStatus> enroll(const hidl_array<uint8_t, 69>& hat, uint32_t gid,
|
||||
uint32_t timeoutSec) override;
|
||||
Return<RequestStatus> postEnroll() override;
|
||||
Return<uint64_t> getAuthenticatorId() override;
|
||||
Return<RequestStatus> cancel() override;
|
||||
Return<RequestStatus> enumerate() override;
|
||||
Return<RequestStatus> remove(uint32_t gid, uint32_t fid) override;
|
||||
Return<RequestStatus> setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
|
||||
Return<RequestStatus> authenticate(uint64_t operationId, uint32_t gid) override;
|
||||
|
||||
Return<int32_t> extCmd(int32_t cmd, int32_t param) override;
|
||||
|
||||
static fingerprint_device_t* openHal();
|
||||
int32_t connectPowerHalExt();
|
||||
int32_t checkPowerHalExtBoostSupport(const std::string &boost);
|
||||
int32_t sendPowerHalExtBoost(const std::string &boost, int32_t durationMs);
|
||||
int32_t isBoostHintSupported();
|
||||
int32_t sendAuthenticatedBoostHint();
|
||||
static void notify(
|
||||
const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
|
||||
static Return<RequestStatus> ErrorFilter(int32_t error);
|
||||
static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode);
|
||||
static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode);
|
||||
static BiometricsFingerprint* sInstance;
|
||||
|
||||
std::mutex mClientCallbackMutex;
|
||||
sp<IBiometricsFingerprintClientCallback> mClientCallback;
|
||||
fingerprint_device_t* mDevice;
|
||||
|
||||
bool mBoostHintIsSupported;
|
||||
bool mBoostHintSupportIsChecked;
|
||||
std::shared_ptr<aidl::google::hardware::power::extension::pixel::IPowerExt> mPowerHalExtAidl;
|
||||
|
||||
// Methods from ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint follow.
|
||||
Return<bool> isUdfps(uint32_t sensorId) override;
|
||||
Return<void> onFingerDown(uint32_t x, uint32_t y, float minor, float major) override;
|
||||
Return<void> onFingerUp() override;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_3
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_3_BIOMETRICSFINGERPRINT_H
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <drm/sde_drm.h>
|
||||
#include <compositionengine/UdfpsExtension.h>
|
||||
|
||||
uint32_t getUdfpsZOrder(uint32_t z, bool touched) {
|
||||
if (touched) {
|
||||
z |= FOD_PRESSED_LAYER_ZORDER;
|
||||
}
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
uint64_t getUdfpsUsageBits(uint64_t usageBits, bool) {
|
||||
return usageBits;
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael
|
||||
class late_start
|
||||
user system
|
||||
group system input uhid
|
||||
task_profiles ProcessCapacityHigh HighPerformance
|
||||
priority -20
|
||||
|
||||
on init
|
||||
chmod 0666 /dev/goodix_fp
|
||||
chown system system /dev/goodix_fp
|
||||
chmod 0664 /dev/fortsense_fp
|
||||
chown system system /dev/fortsense_fp
|
||||
|
||||
on boot
|
||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui
|
||||
chown system system /sys/devices/virtual/touch/tp_dev/fod_status
|
||||
chmod 0660 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui
|
||||
chmod 0660 /sys/devices/virtual/touch/tp_dev/fod_status
|
||||
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
|
||||
|
||||
chmod 0666 /dev/input/event2
|
||||
|
||||
on post-fs-data
|
||||
mkdir /data/vendor/fpc 0770 system system
|
||||
mkdir /data/vendor/goodix 0770 system system
|
||||
mkdir /data/vendor/fpdump 0770 system system
|
||||
mkdir /data/vendor/fortsense 0770 system system
|
||||
mkdir /mnt/vendor/persist/goodix 0770 system system
|
||||
mkdir /mnt/vendor/persist/fpc 0770 system system
|
||||
@@ -1,12 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<transport>hwbinder</transport>
|
||||
<fqname>@2.3::IBiometricsFingerprint/default</fqname>
|
||||
</hal>
|
||||
<hal format="hidl">
|
||||
<name>vendor.xiaomi.hardware.fingerprintextension</name>
|
||||
<transport>hwbinder</transport>
|
||||
<fqname>@1.0::IXiaomiFingerprint/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -1,282 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
|
||||
#define ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include <hardware/hw_auth_token.h>
|
||||
|
||||
#define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
|
||||
#define FINGERPRINT_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
|
||||
#define FINGERPRINT_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1)
|
||||
#define FINGERPRINT_MODULE_API_VERSION_3_0 HARDWARE_MODULE_API_VERSION(3, 0)
|
||||
#define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint"
|
||||
|
||||
typedef enum fingerprint_msg_type {
|
||||
FINGERPRINT_ERROR = -1,
|
||||
FINGERPRINT_ACQUIRED = 1,
|
||||
FINGERPRINT_TEMPLATE_ENROLLING = 3,
|
||||
FINGERPRINT_TEMPLATE_REMOVED = 4,
|
||||
FINGERPRINT_AUTHENTICATED = 5,
|
||||
FINGERPRINT_TEMPLATE_ENUMERATING = 6,
|
||||
} fingerprint_msg_type_t;
|
||||
|
||||
/*
|
||||
* Fingerprint errors are meant to tell the framework to terminate the current operation and ask
|
||||
* for the user to correct the situation. These will almost always result in messaging and user
|
||||
* interaction to correct the problem.
|
||||
*
|
||||
* For example, FINGERPRINT_ERROR_CANCELED should follow any acquisition message that results in
|
||||
* a situation where the current operation can't continue without user interaction. For example,
|
||||
* if the sensor is dirty during enrollment and no further enrollment progress can be made,
|
||||
* send FINGERPRINT_ACQUIRED_IMAGER_DIRTY followed by FINGERPRINT_ERROR_CANCELED.
|
||||
*/
|
||||
typedef enum fingerprint_error {
|
||||
FINGERPRINT_ERROR_HW_UNAVAILABLE = 1, /* The hardware has an error that can't be resolved. */
|
||||
FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2, /* Bad data; operation can't continue */
|
||||
FINGERPRINT_ERROR_TIMEOUT = 3, /* The operation has timed out waiting for user input. */
|
||||
FINGERPRINT_ERROR_NO_SPACE = 4, /* No space available to store a template */
|
||||
FINGERPRINT_ERROR_CANCELED = 5, /* The current operation can't proceed. See above. */
|
||||
FINGERPRINT_ERROR_UNABLE_TO_REMOVE = 6, /* fingerprint with given id can't be removed */
|
||||
FINGERPRINT_ERROR_LOCKOUT = 7, /* the fingerprint hardware is in lockout due to too many attempts */
|
||||
FINGERPRINT_ERROR_VENDOR_BASE = 1000 /* vendor-specific error messages start here */
|
||||
} fingerprint_error_t;
|
||||
|
||||
/*
|
||||
* Fingerprint acquisition info is meant as feedback for the current operation. Anything but
|
||||
* FINGERPRINT_ACQUIRED_GOOD will be shown to the user as feedback on how to take action on the
|
||||
* current operation. For example, FINGERPRINT_ACQUIRED_IMAGER_DIRTY can be used to tell the user
|
||||
* to clean the sensor. If this will cause the current operation to fail, an additional
|
||||
* FINGERPRINT_ERROR_CANCELED can be sent to stop the operation in progress (e.g. enrollment).
|
||||
* In general, these messages will result in a "Try again" message.
|
||||
*/
|
||||
typedef enum fingerprint_acquired_info {
|
||||
FINGERPRINT_ACQUIRED_GOOD = 0,
|
||||
FINGERPRINT_ACQUIRED_PARTIAL = 1, /* sensor needs more data, i.e. longer swipe. */
|
||||
FINGERPRINT_ACQUIRED_INSUFFICIENT = 2, /* image doesn't contain enough detail for recognition*/
|
||||
FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3, /* sensor needs to be cleaned */
|
||||
FINGERPRINT_ACQUIRED_TOO_SLOW = 4, /* mostly swipe-type sensors; not enough data collected */
|
||||
FINGERPRINT_ACQUIRED_TOO_FAST = 5, /* for swipe and area sensors; tell user to slow down*/
|
||||
FINGERPRINT_ACQUIRED_DETECTED = 6, /* when the finger is first detected. Used to optimize wakeup.
|
||||
Should be followed by one of the above messages */
|
||||
FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000 /* vendor-specific acquisition messages start here */
|
||||
} fingerprint_acquired_info_t;
|
||||
|
||||
typedef struct fingerprint_finger_id {
|
||||
uint32_t gid;
|
||||
uint32_t fid;
|
||||
} fingerprint_finger_id_t;
|
||||
|
||||
typedef struct fingerprint_enroll {
|
||||
fingerprint_finger_id_t finger;
|
||||
/* samples_remaining goes from N (no data collected, but N scans needed)
|
||||
* to 0 (no more data is needed to build a template). */
|
||||
uint32_t samples_remaining;
|
||||
uint64_t msg; /* Vendor specific message. Used for user guidance */
|
||||
} fingerprint_enroll_t;
|
||||
|
||||
typedef struct fingerprint_iterator {
|
||||
fingerprint_finger_id_t finger;
|
||||
uint32_t remaining_templates;
|
||||
} fingerprint_iterator_t;
|
||||
|
||||
typedef fingerprint_iterator_t fingerprint_enumerated_t;
|
||||
typedef fingerprint_iterator_t fingerprint_removed_t;
|
||||
|
||||
typedef struct fingerprint_acquired {
|
||||
fingerprint_acquired_info_t acquired_info; /* information about the image */
|
||||
} fingerprint_acquired_t;
|
||||
|
||||
typedef struct fingerprint_authenticated {
|
||||
fingerprint_finger_id_t finger;
|
||||
hw_auth_token_t hat;
|
||||
} fingerprint_authenticated_t;
|
||||
|
||||
typedef struct fingerprint_msg {
|
||||
fingerprint_msg_type_t type;
|
||||
union {
|
||||
fingerprint_error_t error;
|
||||
fingerprint_enroll_t enroll;
|
||||
fingerprint_enumerated_t enumerated;
|
||||
fingerprint_removed_t removed;
|
||||
fingerprint_acquired_t acquired;
|
||||
fingerprint_authenticated_t authenticated;
|
||||
} data;
|
||||
} fingerprint_msg_t;
|
||||
|
||||
/* Callback function type */
|
||||
typedef void (*fingerprint_notify_t)(const fingerprint_msg_t* msg);
|
||||
|
||||
/* Synchronous operation */
|
||||
typedef struct fingerprint_device {
|
||||
/**
|
||||
* Common methods of the fingerprint device. This *must* be the first member
|
||||
* of fingerprint_device as users of this structure will cast a hw_device_t
|
||||
* to fingerprint_device pointer in contexts where it's known
|
||||
* the hw_device_t references a fingerprint_device.
|
||||
*/
|
||||
struct hw_device_t common;
|
||||
|
||||
/*
|
||||
* Client provided callback function to receive notifications.
|
||||
* Do not set by hand, use the function above instead.
|
||||
*/
|
||||
fingerprint_notify_t notify;
|
||||
|
||||
/*
|
||||
* Set notification callback:
|
||||
* Registers a user function that would receive notifications from the HAL
|
||||
* The call will block if the HAL state machine is in busy state until HAL
|
||||
* leaves the busy state.
|
||||
*
|
||||
* Function return: 0 if callback function is successfuly registered
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*set_notify)(struct fingerprint_device* dev, fingerprint_notify_t notify);
|
||||
|
||||
/*
|
||||
* Fingerprint pre-enroll enroll request:
|
||||
* Generates a unique token to upper layers to indicate the start of an enrollment transaction.
|
||||
* This token will be wrapped by security for verification and passed to enroll() for
|
||||
* verification before enrollment will be allowed. This is to ensure adding a new fingerprint
|
||||
* template was preceded by some kind of credential confirmation (e.g. device password).
|
||||
*
|
||||
* Function return: 0 if function failed
|
||||
* otherwise, a uint64_t of token
|
||||
*/
|
||||
uint64_t (*pre_enroll)(struct fingerprint_device* dev);
|
||||
|
||||
/*
|
||||
* Fingerprint enroll request:
|
||||
* Switches the HAL state machine to collect and store a new fingerprint
|
||||
* template. Switches back as soon as enroll is complete
|
||||
* (fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENROLLING &&
|
||||
* fingerprint_msg.data.enroll.samples_remaining == 0)
|
||||
* or after timeout_sec seconds.
|
||||
* The fingerprint template will be assigned to the group gid. User has a choice
|
||||
* to supply the gid or set it to 0 in which case a unique group id will be generated.
|
||||
*
|
||||
* Function return: 0 if enrollment process can be successfully started
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
* A notify() function may be called indicating the error condition.
|
||||
*/
|
||||
int (*enroll)(struct fingerprint_device* dev, const hw_auth_token_t* hat, uint32_t gid,
|
||||
uint32_t timeout_sec);
|
||||
|
||||
/*
|
||||
* Finishes the enroll operation and invalidates the pre_enroll() generated challenge.
|
||||
* This will be called at the end of a multi-finger enrollment session to indicate
|
||||
* that no more fingers will be added.
|
||||
*
|
||||
* Function return: 0 if the request is accepted
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*post_enroll)(struct fingerprint_device* dev);
|
||||
|
||||
/*
|
||||
* get_authenticator_id:
|
||||
* Returns a token associated with the current fingerprint set. This value will
|
||||
* change whenever a new fingerprint is enrolled, thus creating a new fingerprint
|
||||
* set.
|
||||
*
|
||||
* Function return: current authenticator id or 0 if function failed.
|
||||
*/
|
||||
uint64_t (*get_authenticator_id)(struct fingerprint_device* dev);
|
||||
|
||||
/*
|
||||
* Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED
|
||||
* to all running clients. Switches the HAL state machine back to the idle state.
|
||||
* Unlike enroll_done() doesn't invalidate the pre_enroll() challenge.
|
||||
*
|
||||
* Function return: 0 if cancel request is accepted
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*cancel)(struct fingerprint_device* dev);
|
||||
|
||||
/*
|
||||
* Enumerate all the fingerprint templates found in the directory set by
|
||||
* set_active_group()
|
||||
* For each template found a notify() will be called with:
|
||||
* fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENUMERATED
|
||||
* fingerprint_msg.data.enumerated.finger indicating a template id
|
||||
* fingerprint_msg.data.enumerated.remaining_templates indicating how many more
|
||||
* enumeration messages to expect.
|
||||
* Note: If there are no fingerprints, then this should return 0 and the first fingerprint
|
||||
* enumerated should have fingerid=0 and remaining=0
|
||||
* Function return: 0 if enumerate request is accepted
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*enumerate)(struct fingerprint_device* dev);
|
||||
|
||||
/*
|
||||
* Fingerprint remove request:
|
||||
* Deletes a fingerprint template.
|
||||
* Works only within the path set by set_active_group().
|
||||
* The fid parameter can be used as a widcard:
|
||||
* * fid == 0 -- delete all the templates in the group.
|
||||
* * fid != 0 -- delete this specific template from the group.
|
||||
* For each template found a notify() will be called with:
|
||||
* fingerprint_msg.type == FINGERPRINT_TEMPLATE_REMOVED
|
||||
* fingerprint_msg.data.removed.finger indicating a template id deleted
|
||||
* fingerprint_msg.data.removed.remaining_templates indicating how many more
|
||||
* templates will be deleted by this operation.
|
||||
*
|
||||
* Function return: 0 if fingerprint template(s) can be successfully deleted
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*remove)(struct fingerprint_device* dev, uint32_t gid, uint32_t fid);
|
||||
|
||||
/*
|
||||
* Restricts the HAL operation to a set of fingerprints belonging to a
|
||||
* group provided.
|
||||
* The caller must provide a path to a storage location within the user's
|
||||
* data directory.
|
||||
*
|
||||
* Function return: 0 on success
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*set_active_group)(struct fingerprint_device* dev, uint32_t gid, const char* store_path);
|
||||
|
||||
/*
|
||||
* Authenticates an operation identifed by operation_id
|
||||
*
|
||||
* Function return: 0 on success
|
||||
* or a negative number in case of error, generally from the errno.h set.
|
||||
*/
|
||||
int (*authenticate)(struct fingerprint_device* dev, uint64_t operation_id, uint32_t gid);
|
||||
|
||||
/**
|
||||
* Call a Xiaomi fingerprint extension command.
|
||||
*/
|
||||
int (*extCmd)(struct fingerprint_device* dev, int32_t cmd, int32_t param);
|
||||
|
||||
/* Reserved for backward binary compatibility */
|
||||
void* reserved[4];
|
||||
} fingerprint_device_t;
|
||||
|
||||
typedef struct fingerprint_module {
|
||||
/**
|
||||
* Common methods of the fingerprint module. This *must* be the first member
|
||||
* of fingerprint_module as users of this structure will cast a hw_module_t
|
||||
* to fingerprint_module pointer in contexts where it's known
|
||||
* the hw_module_t references a fingerprint_module.
|
||||
*/
|
||||
struct hw_module_t common;
|
||||
} fingerprint_module_t;
|
||||
|
||||
#endif /* ANDROID_INCLUDE_HARDWARE_FINGERPRINT_H */
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
* Copyright (C) 2020 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 "android.hardware.biometrics.fingerprint@2.3-service.xiaomi_raphael"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
// libhwbinder:
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
|
||||
// Generated HIDL files
|
||||
using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
|
||||
using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint;
|
||||
|
||||
using android::status_t;
|
||||
|
||||
status_t BiometricsFingerprint::registerAsSystemService() {
|
||||
status_t ret = 0;
|
||||
|
||||
ret = IBiometricsFingerprint::registerAsService();
|
||||
if (ret != 0) {
|
||||
ALOGE("Failed to register IBiometricsFingerprint (%d)", ret);
|
||||
goto fail;
|
||||
} else {
|
||||
ALOGI("Successfully registered IBiometricsFingerprint");
|
||||
}
|
||||
|
||||
ret = IXiaomiFingerprint::registerAsService();
|
||||
if (ret != 0) {
|
||||
ALOGE("Failed to register IXiaomiFingerprint (%d)", ret);
|
||||
goto fail;
|
||||
} else {
|
||||
ALOGI("Successfully registered IXiaomiFingerprint");
|
||||
}
|
||||
|
||||
fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main() {
|
||||
android::sp<IBiometricsFingerprint> service = BiometricsFingerprint::getInstance();
|
||||
|
||||
if (service == nullptr) {
|
||||
ALOGE("Instance of BiometricsFingerprint is null");
|
||||
return 1;
|
||||
}
|
||||
|
||||
android::hardware::setMinSchedulerPolicy(service, SCHED_RR, -20);
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
status_t status = service->registerAsService();
|
||||
if (status != android::OK) {
|
||||
ALOGE("Cannot register service for Fingerprint HAL(%d).", status);
|
||||
return 1;
|
||||
}
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return 0; // should never get here
|
||||
}
|
||||
@@ -12,21 +12,21 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/product_launched_with_p.mk)
|
||||
# Inherit from raphael device
|
||||
$(call inherit-product, device/xiaomi/raphael/device.mk)
|
||||
|
||||
# Inherit some common Evolution X stuff.
|
||||
$(call inherit-product, vendor/evolution/config/common_full_phone.mk)
|
||||
# Inherit from common lineage configuration
|
||||
$(call inherit-product, vendor/lineage/config/common_full_phone.mk)
|
||||
|
||||
EVO_BUILD_TYPE := OFFICIAL
|
||||
EXTRA_UDFPS_ANIMATIONS := true
|
||||
EVO_BUILD_TYPE := Official
|
||||
TARGET_DISABLE_EPPE := true
|
||||
TARGET_BOOT_ANIMATION_RES := 1080
|
||||
TARGET_BUILD_APERTURE_CAMERA := false
|
||||
TARGET_SUPPORTS_QUICK_TAP := true
|
||||
TARGET_HAS_UDFPS := true
|
||||
|
||||
# Boot animation
|
||||
TARGET_SCREEN_HEIGHT := 2340
|
||||
TARGET_SCREEN_WIDTH := 1080
|
||||
|
||||
# Device identifier. This must come after all inclusions.
|
||||
PRODUCT_NAME := evolution_raphael
|
||||
PRODUCT_NAME := lineage_raphael
|
||||
PRODUCT_DEVICE := raphael
|
||||
PRODUCT_BRAND := Xiaomi
|
||||
PRODUCT_MANUFACTURER := Xiaomi
|
||||
@@ -34,3 +34,6 @@ PRODUCT_MANUFACTURER := Xiaomi
|
||||
PRODUCT_CHARACTERISTICS := nosdcard
|
||||
|
||||
PRODUCT_GMS_CLIENTID_BASE := android-xiaomi
|
||||
|
||||
# Set BUILD_FINGERPRINT variable to be picked up by both system and vendor build.prop
|
||||
BUILD_FINGERPRINT := Xiaomi/raphael/raphael:11/RKQ1.200826.002/V12.5.2.0.RFKMIXM:user/release-keys
|
||||
@@ -43,6 +43,12 @@ on init
|
||||
chmod 0660 /dev/drv8846_dev
|
||||
chmod 0660 /dev/akm09970
|
||||
|
||||
# Goodix fingerprint
|
||||
chmod 0666 /dev/goodix_fp
|
||||
chown system system /dev/goodix_fp
|
||||
chmod 0664 /dev/fortsense_fp
|
||||
chown system system /dev/fortsense_fp
|
||||
|
||||
on property:sys.boot_completed=1
|
||||
setprop vendor.powerhal.init 1
|
||||
|
||||
@@ -53,12 +59,55 @@ on post-fs-data
|
||||
chmod 0644 /dev/elliptic0
|
||||
chmod 0644 /dev/elliptic1
|
||||
|
||||
mkdir /data/vendor/fpc 0770 system system
|
||||
mkdir /data/vendor/goodix 0770 system system
|
||||
mkdir /data/vendor/fpdump 0770 system system
|
||||
mkdir /data/vendor/fortsense 0770 system system
|
||||
mkdir /mnt/vendor/persist/goodix 0770 system system
|
||||
mkdir /mnt/vendor/persist/fpc 0770 system system
|
||||
|
||||
on boot
|
||||
# Create persist for camera calibration data
|
||||
mkdir /mnt/vendor/persist/camera 0755 system cameraserver
|
||||
|
||||
chown system system /sys/class/thermal/thermal_message/sconfig
|
||||
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/irq_enable
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/fingerdown_wait
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chown system system /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/wakeup_enable
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/hw_reset
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/device_prepare
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/vendor
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/simulate_irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/finger_irq
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/request_vreg
|
||||
chmod 0700 /sys/bus/platform/devices/soc:fingerprint_fpc/power_cfg
|
||||
chown system system /sys/class/drm/card0-DSI-1/disp_param
|
||||
chmod 0700 /sys/class/drm/card0-DSI-1/disp_param
|
||||
chown system system /sys/class/drm/card0-DSI-1/panel_info
|
||||
chmod 0744 /sys/class/drm/card0-DSI-1/panel_info
|
||||
chmod 0666 /dev/input/event2
|
||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui
|
||||
chmod 0444 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui
|
||||
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
|
||||
chmod 0444 /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
|
||||
chown system system /sys/touchpanel/fod_status
|
||||
chmod 0644 /sys/touchpanel/fod_status
|
||||
chown system system /sys/devices/virtual/touch/tp_dev/fod_status
|
||||
chmod 0644 /sys/devices/virtual/touch/tp_dev/fod_status
|
||||
|
||||
on charger
|
||||
mkdir /mnt/vendor/persist
|
||||
chown root system /mnt/vendor/persist
|
||||
|
||||
@@ -7204,4 +7204,138 @@
|
||||
<carrier_config mcc="901" mnc="18">
|
||||
<boolean name="carrier_volte_available_bool" value="false" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="400" mnc="02">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="404">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="editable_wfc_roaming_mode_bool" value="true" />
|
||||
<boolean name="carrier_wfc_supports_ims_preferred_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="404" mnc="02,03,06,10,16,31,40,45,49,61,70,90,92,93,94,95,97,98">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="405" mnc="51,52,53,54,55,56">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="01">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="02">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="04">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="05">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="06">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="452" mnc="08">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="01">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="02">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="03">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="04">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="05">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="06">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="07">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="470" mnc="08">
|
||||
<boolean name="rtt_supported_bool" value="true" />
|
||||
<boolean name="rtt_supported_for_vt_bool" value="true"/>
|
||||
<boolean name="rtt_upgrade_supported_bool" value="true"/>
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_vt_available_bool" value="false" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
<boolean name="carrier_volte_tty_supported_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="502" mnc="16">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="502" mnc="18">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
<boolean name="carrier_wfc_ims_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="01">
|
||||
<boolean name="carrier_volte_available_bool" value="true"/>
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="07">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="08">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="09">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="10">
|
||||
<boolean name="carrier_volte_available_bool" value="true"/>
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="11">
|
||||
<boolean name="carrier_volte_available_bool" value="true"/>
|
||||
</carrier_config>
|
||||
<carrier_config mcc="510" mnc="89">
|
||||
<boolean name="carrier_volte_available_bool" value="true" />
|
||||
</carrier_config>
|
||||
</carrier_config_list>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
<bool name="config_multiColorBatteryLed">false</bool>
|
||||
|
||||
<!-- Pocket Lock -->
|
||||
<bool name="config_pocketModeSupported">true</bool>
|
||||
<bool name="config_pocketUseLightSensor">false</bool>
|
||||
|
||||
<!-- Shows the required view for Screen OFF FOD -->
|
||||
<bool name="config_supportsScreenOffUdfps">true</bool>
|
||||
<!-- Whether devices supports in-display fingerprint when screen is off -->
|
||||
<bool name="config_supportScreenOffUdfps">true</bool>
|
||||
|
||||
<!-- The list of package IDs that are allowed to use aux cameras.
|
||||
NOTE: If this list is empty then all apps will be able to use aux cameras. -->
|
||||
@@ -50,7 +50,4 @@
|
||||
<!-- Defines the sysfs attribute path used by the device
|
||||
to enable/disable DC dimming. -->
|
||||
<string name="config_deviceDcDimmingSysfsNode">/sys/devices/platform/soc/soc:qcom,dsi-display-primary/dc_dim</string>
|
||||
|
||||
<!-- Whether to enable Lineage Health Service -->
|
||||
<bool name="config_lineageHealthSupported">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
-->
|
||||
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- Device specific doze package -->
|
||||
<string name="config_customDozePackage" translatable="false">org.lineageos.settings/org.lineageos.settings.doze.DozeSettingsActivity</string>
|
||||
|
||||
<!-- The number of vibration intensity levels supported by the device.
|
||||
|
||||
Note that this should correspond to the ability to vary the vibration amplitude, with
|
||||
@@ -40,8 +43,11 @@
|
||||
<!-- Whether to show the Preference for Adaptive connectivity -->
|
||||
<bool name="config_show_adaptive_connectivity">false</bool>
|
||||
|
||||
<!-- Whether to show min/max refresh rate in display settings -->
|
||||
<bool name="config_show_refresh_rate_controls">true</bool>
|
||||
<!-- Whether to show peak refresh rate in display settings -->
|
||||
<bool name="config_show_peak_refresh_rate_switch">true</bool>
|
||||
|
||||
<!-- Whether to show min refresh rate in display settings -->
|
||||
<bool name="config_show_min_refresh_rate_switch">true</bool>
|
||||
|
||||
<!-- Whether device supports increased touch sensitvity -->
|
||||
<bool name="config_show_touch_sensitivity">true</bool>
|
||||
@@ -51,4 +57,13 @@
|
||||
|
||||
<!-- Show battery cycle count -->
|
||||
<bool name="config_show_battery_cycle_count" translatable="false">true</bool>
|
||||
|
||||
<!-- Whether to show double tap ambient settings -->
|
||||
<bool name="config_supports_double_tap_ambient" translatable="false">true</bool>
|
||||
|
||||
<!-- Whether to show volume steps settings -->
|
||||
<bool name="config_supports_volume_steps" translatable="false">true</bool>
|
||||
|
||||
<!-- Whether to show vendor security patch level -->
|
||||
<bool name="config_show_vendor_patch_level" translatable="false">false</bool>
|
||||
</resources>
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 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.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Battery health -->
|
||||
<string name="config_batteryRemainingCapacityNode">/sys/class/power_supply/bms/charge_full</string>
|
||||
<string name="config_batteryDesignCapacityNode">/sys/class/power_supply/bms/charge_full_design</string>
|
||||
<string name="config_batteryChargeCycles">/sys/class/power_supply/bms/cycle_count</string>
|
||||
</resources>
|
||||
@@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019-2023 Evolution X
|
||||
Copyright (C) 2019-2024 Evolution X
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
<!-- About device screen, build maintainer -->
|
||||
<string name="build_device_url">https://t.me/EvolutionXRaphael_v2</string>
|
||||
<string name="build_maintainer_summary">Joey Huab</string>
|
||||
<string name="build_maintainer_donate_url">https://linktr.ee/shaazice</string>
|
||||
<string name="build_maintainer_donate_url">https://linktr.ee/joeyhuab</string>
|
||||
</resources>
|
||||
|
||||
@@ -63,10 +63,4 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
<!-- Should we vibrate on an icon animation of the shelf. This should only be active if the
|
||||
vibrator is capable of subtle vibrations -->
|
||||
<bool name="config_vibrateOnIconAnimation">true</bool>
|
||||
|
||||
<!-- Whether to show a warning notification when device's skin temperature is high. -->
|
||||
<integer name="config_showTemperatureWarning">1</integer>
|
||||
|
||||
<!-- Whether to show a alarm dialog when device's usb port is overheating. -->
|
||||
<integer name="config_showUsbPortAlarm">1</integer>
|
||||
</resources>
|
||||
|
||||
@@ -32,4 +32,10 @@
|
||||
|
||||
<!-- Update battery info every second when device is charging -->
|
||||
<bool name="config_alternateFastchargeInfoUpdate">true</bool>
|
||||
|
||||
<!-- Whether show refresh rate QS tile -->
|
||||
<bool name="config_showRefreshRateQsTile">true</bool>
|
||||
|
||||
<!-- FPSInfoService FPS node file path -->
|
||||
<string name="config_fpsInfoSysNode" translatable="false">/sys/class/drm/sde-crtc-0/measured_fps</string>
|
||||
</resources>
|
||||
|
||||
@@ -4,9 +4,6 @@
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<resources>
|
||||
<!-- Bottom margin size when fingerprint in display is active -->
|
||||
<dimen name="keyguard_indication_margin_bottom_fingerprint_in_display">25dp</dimen>
|
||||
|
||||
<!-- UDFPS recognizing animation vertical position offset -->
|
||||
<dimen name="udfps_animation_offset">35dp</dimen>
|
||||
</resources>
|
||||
|
||||
2
sepolicy/vendor/file_contexts
vendored
2
sepolicy/vendor/file_contexts
vendored
@@ -23,7 +23,7 @@
|
||||
/sys/devices/virtual/touch/tp_dev/fp_state u:object_r:vendor_sysfs_sensors:s0
|
||||
|
||||
# HALs
|
||||
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.xiaomi_raphael u:object_r:hal_fingerprint_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.3-service\.xiaomi u:object_r:hal_fingerprint_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.light@2\.0-service\.xiaomi_raphael u:object_r:hal_light_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.power-service\.pixel-libperfmgr u:object_r:hal_power_default_exec:s0
|
||||
/vendor/bin/hw/android\.hardware\.power\.stats@1\.0-service\.raphael u:object_r:hal_power_stats_default_exec:s0
|
||||
|
||||
3
sepolicy/vendor/hal_fingerprint_default.te
vendored
3
sepolicy/vendor/hal_fingerprint_default.te
vendored
@@ -27,3 +27,6 @@ allow hal_fingerprint_default vendor_sysfs_graphics:file r_file_perms;
|
||||
|
||||
allow hal_fingerprint_default vendor_sysfs_spss:dir { search };
|
||||
allow hal_fingerprint_default vendor_sysfs_spss:file { open read };
|
||||
|
||||
allow hal_fingerprint_default sysfs_touchpanel:dir search;
|
||||
allow hal_fingerprint_default sysfs_touchpanel:file rw_file_perms;
|
||||
|
||||
17
udfps/Android.bp
Normal file
17
udfps/Android.bp
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Copyright (C) 2022 The LineageOS Project
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
cc_library {
|
||||
name: "libudfpshandler",
|
||||
vendor: true,
|
||||
srcs: ["UdfpsHandler.cpp"],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
],
|
||||
header_libs: [
|
||||
"//hardware/xiaomi:xiaomifingerprint_headers",
|
||||
],
|
||||
}
|
||||
134
udfps/UdfpsHandler.cpp
Normal file
134
udfps/UdfpsHandler.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "UdfpsHandler.raphael"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <poll.h>
|
||||
#include <thread>
|
||||
|
||||
#include "UdfpsHandler.h"
|
||||
|
||||
// Fingerprint hwmodule commands
|
||||
#define COMMAND_NIT 10
|
||||
#define PARAM_NIT_UDFPS 1
|
||||
#define PARAM_NIT_NONE 0
|
||||
|
||||
// Touchscreen and HBM
|
||||
#define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status"
|
||||
#define FOD_UI_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui"
|
||||
|
||||
#define FOD_STATUS_OFF 0
|
||||
#define FOD_STATUS_ON 1
|
||||
|
||||
template <typename T>
|
||||
static void set(const std::string& path, const T& value) {
|
||||
std::ofstream file(path);
|
||||
file << value;
|
||||
}
|
||||
|
||||
static bool readBool(int fd) {
|
||||
char c;
|
||||
int rc;
|
||||
|
||||
rc = lseek(fd, 0, SEEK_SET);
|
||||
if (rc) {
|
||||
LOG(ERROR) << "failed to seek fd, err: " << rc;
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = read(fd, &c, sizeof(char));
|
||||
if (rc != 1) {
|
||||
LOG(ERROR) << "failed to read bool from fd, err: " << rc;
|
||||
return false;
|
||||
}
|
||||
|
||||
return c != '0';
|
||||
}
|
||||
|
||||
class RaphaelUdfpsHandler : public UdfpsHandler {
|
||||
public:
|
||||
void init(fingerprint_device_t* device) {
|
||||
mDevice = device;
|
||||
|
||||
std::thread([this]() {
|
||||
int fd = open(FOD_UI_PATH, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
LOG(ERROR) << "failed to open fd, err: " << fd;
|
||||
return;
|
||||
}
|
||||
|
||||
struct pollfd fodUiPoll = {
|
||||
.fd = fd,
|
||||
.events = POLLERR | POLLPRI,
|
||||
.revents = 0,
|
||||
};
|
||||
|
||||
while (true) {
|
||||
int rc = poll(&fodUiPoll, 1, -1);
|
||||
if (rc < 0) {
|
||||
LOG(ERROR) << "failed to poll fd, err: " << rc;
|
||||
continue;
|
||||
}
|
||||
|
||||
mDevice->extCmd(mDevice, COMMAND_NIT, readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE);
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/, float /*major*/) {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_ON);
|
||||
}
|
||||
|
||||
void onFingerUp() {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
|
||||
}
|
||||
|
||||
void onAcquired(int32_t result, int32_t vendorCode) {
|
||||
if (result == FINGERPRINT_ACQUIRED_GOOD) {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
|
||||
} else if (vendorCode == 21 || vendorCode == 23) {
|
||||
/*
|
||||
* vendorCode = 21 waiting for fingerprint authentication
|
||||
* vendorCode = 23 waiting for fingerprint enroll
|
||||
*/
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void cancel() {
|
||||
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
|
||||
}
|
||||
|
||||
void preEnroll() {
|
||||
LOG(DEBUG) << __func__;
|
||||
}
|
||||
void enroll() {
|
||||
LOG(DEBUG) << __func__;
|
||||
}
|
||||
void postEnroll() {
|
||||
LOG(DEBUG) << __func__;
|
||||
}
|
||||
|
||||
private:
|
||||
fingerprint_device_t* mDevice;
|
||||
};
|
||||
|
||||
static UdfpsHandler* create() {
|
||||
return new RaphaelUdfpsHandler();
|
||||
}
|
||||
|
||||
static void destroy(UdfpsHandler* handler) {
|
||||
delete handler;
|
||||
}
|
||||
|
||||
extern "C" UdfpsHandlerFactory UDFPS_HANDLER_FACTORY = {
|
||||
.create = create,
|
||||
.destroy = destroy,
|
||||
};
|
||||
Reference in New Issue
Block a user