sm6150-common: Move to common fingerprint HIDL
Change-Id: I7cb0a45c865d9dbfd800b1d633f8d5ae613bb1b9
This commit is contained in:
parent
d56b211120
commit
16a45dcda2
@ -184,9 +184,7 @@ BOARD_VENDOR_SEPOLICY_DIRS += $(COMMON_PATH)/sepolicy/vendor
|
||||
# Soong
|
||||
SOONG_CONFIG_NAMESPACES += xiaomiSm8350Vars
|
||||
SOONG_CONFIG_xiaomiSm8350Vars += \
|
||||
fingerprint_use_extension \
|
||||
vibrator_use_effect_stream
|
||||
SOONG_CONFIG_xiaomiSm8350Vars_fingerprint_use_extension ?= false
|
||||
SOONG_CONFIG_xiaomiSm8350Vars_vibrator_use_effect_stream ?= false
|
||||
|
||||
# Verified Boot
|
||||
|
@ -184,7 +184,7 @@ PRODUCT_PACKAGES += \
|
||||
|
||||
# Fingerprint
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350
|
||||
android.hardware.biometrics.fingerprint@2.3-service.xiaomi
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
|
||||
|
@ -1,50 +0,0 @@
|
||||
soong_config_module_type {
|
||||
name: "fingerprint_extension",
|
||||
module_type: "cc_defaults",
|
||||
config_namespace: "xiaomiSm8350Vars",
|
||||
bool_variables: ["fingerprint_use_extension"],
|
||||
properties: [
|
||||
"cflags",
|
||||
"shared_libs",
|
||||
"vintf_fragments",
|
||||
],
|
||||
}
|
||||
|
||||
fingerprint_extension {
|
||||
name: "fingerprint_extension_defaults",
|
||||
soong_config_variables: {
|
||||
fingerprint_use_extension: {
|
||||
cflags: ["-DUSE_EXTENSION"],
|
||||
shared_libs: [
|
||||
"vendor.xiaomi.hardware.fingerprintextension@1.0",
|
||||
],
|
||||
vintf_fragments: ["vendor.xiaomi.hardware.fingerprintextension@1.0.xml"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350",
|
||||
defaults: [
|
||||
"hidl_defaults",
|
||||
"fingerprint_extension_defaults",
|
||||
],
|
||||
init_rc: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350.rc"],
|
||||
vintf_fragments: ["android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350.xml"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
srcs: [
|
||||
"BiometricsFingerprint.cpp",
|
||||
"service.cpp",
|
||||
],
|
||||
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"libhidlbase",
|
||||
"libhardware",
|
||||
"libutils",
|
||||
"android.hardware.biometrics.fingerprint@2.1",
|
||||
],
|
||||
|
||||
}
|
@ -1,363 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source 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.1-service.xiaomi_sm8350"
|
||||
#define LOG_VERBOSE "android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350"
|
||||
|
||||
#include <hardware/hw_auth_token.h>
|
||||
|
||||
#include <hardware/hardware.h>
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_1 {
|
||||
namespace implementation {
|
||||
|
||||
// Supported fingerprint HAL version
|
||||
static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1);
|
||||
|
||||
using RequestStatus =
|
||||
android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
|
||||
|
||||
BiometricsFingerprint *BiometricsFingerprint::sInstance = nullptr;
|
||||
|
||||
BiometricsFingerprint::BiometricsFingerprint() : mClientCallback(nullptr), mDevice(nullptr) {
|
||||
sInstance = this; // keep track of the most recent instance
|
||||
mDevice = openHal();
|
||||
if (!mDevice) {
|
||||
ALOGE("Can't open HAL module");
|
||||
}
|
||||
}
|
||||
|
||||
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_VENDOR;
|
||||
}
|
||||
}
|
||||
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->post_enroll(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;
|
||||
}
|
||||
if (access(storePath.c_str(), W_OK)) {
|
||||
return RequestStatus::SYS_EINVAL;
|
||||
}
|
||||
|
||||
return ErrorFilter(mDevice->set_active_group(mDevice, gid,
|
||||
storePath.c_str()));
|
||||
}
|
||||
|
||||
Return<RequestStatus> BiometricsFingerprint::authenticate(uint64_t operationId,
|
||||
uint32_t gid) {
|
||||
return ErrorFilter(mDevice->authenticate(mDevice, operationId, gid));
|
||||
}
|
||||
|
||||
#ifdef USE_EXTENSION
|
||||
Return<int32_t> BiometricsFingerprint::extCmd(int32_t cmd, int32_t param) {
|
||||
return mDevice->extCmd(mDevice, cmd, param);
|
||||
}
|
||||
#endif
|
||||
|
||||
BiometricsFingerprint* BiometricsFingerprint::getInstance() {
|
||||
if (!sInstance) {
|
||||
sInstance = new BiometricsFingerprint();
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
fingerprint_device_t* BiometricsFingerprint::openHal() {
|
||||
int err;
|
||||
const hw_module_t *hw_mdl = nullptr;
|
||||
ALOGD("Opening fingerprint hal library...");
|
||||
if (0 != (err = hw_get_module(FINGERPRINT_HARDWARE_MODULE_ID, &hw_mdl))) {
|
||||
ALOGE("Can't open fingerprint HW Module, error: %d", err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (hw_mdl == nullptr) {
|
||||
ALOGE("No valid fingerprint module");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_module_t const *module =
|
||||
reinterpret_cast<const fingerprint_module_t*>(hw_mdl);
|
||||
if (module->common.methods->open == nullptr) {
|
||||
ALOGE("No valid open method");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
hw_device_t *device = nullptr;
|
||||
|
||||
if (0 != (err = module->common.methods->open(hw_mdl, nullptr, &device))) {
|
||||
ALOGE("Can't open fingerprint methods, error: %d", err);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (kVersion != device->version) {
|
||||
// enforce version on new devices because of HIDL@2.1 translation layer
|
||||
ALOGE("Wrong fp version. Expected %d, got %d", kVersion, device->version);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
fingerprint_device_t* fp_device =
|
||||
reinterpret_cast<fingerprint_device_t*>(device);
|
||||
|
||||
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 {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_1
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source 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_1_BIOMETRICSFINGERPRINT_H
|
||||
#define ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
|
||||
|
||||
#include <log/log.h>
|
||||
#include <android/log.h>
|
||||
#include <hardware/hardware.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
|
||||
#ifdef USE_EXTENSION
|
||||
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
|
||||
#endif
|
||||
|
||||
#include "hardware/fingerprint.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace biometrics {
|
||||
namespace fingerprint {
|
||||
namespace V2_1 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
|
||||
using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::sp;
|
||||
#ifdef USE_EXTENSION
|
||||
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
|
||||
|
||||
struct BiometricsFingerprint : public IBiometricsFingerprint, public IXiaomiFingerprint {
|
||||
#else
|
||||
struct BiometricsFingerprint : public IBiometricsFingerprint {
|
||||
#endif
|
||||
public:
|
||||
BiometricsFingerprint();
|
||||
~BiometricsFingerprint();
|
||||
|
||||
// Method to wrap legacy HAL with BiometricsFingerprint class
|
||||
static BiometricsFingerprint* 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;
|
||||
|
||||
#ifdef USE_EXTENSION
|
||||
// Methods from ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint follow.
|
||||
Return<int32_t> extCmd(int32_t cmd, int32_t param) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
static fingerprint_device_t* openHal();
|
||||
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;
|
||||
};
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V2_1
|
||||
} // namespace fingerprint
|
||||
} // namespace biometrics
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_BIOMETRICS_FINGERPRINT_V2_1_BIOMETRICSFINGERPRINT_H
|
@ -1,29 +0,0 @@
|
||||
on init
|
||||
chown system system /dev/goodix_fp
|
||||
|
||||
on boot
|
||||
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/power_cfg
|
||||
|
||||
on post-fs-data
|
||||
mkdir /data/vendor/fpc 0770 system system
|
||||
mkdir /data/vendor/goodix 0770 system system
|
||||
mkdir /mnt/vendor/persist/goodix 0770 system system
|
||||
|
||||
service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.xiaomi_sm8350
|
||||
# "class hal" causes a race condition on some devices due to files created
|
||||
# in /data. As a workaround, postpone startup until later in boot once
|
||||
# /data is mounted.
|
||||
class late_start
|
||||
user system
|
||||
group system input uhid
|
||||
writepid /dev/cpuset/system-background/tasks
|
@ -1,11 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>2.1</version>
|
||||
<interface>
|
||||
<name>IBiometricsFingerprint</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
@ -1,285 +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);
|
||||
|
||||
#ifdef USE_EXTENSION
|
||||
/*
|
||||
* Xiaomi fingerprint extension command.
|
||||
*/
|
||||
int (*extCmd)(struct fingerprint_device *dev, int32_t cmd, int32_t param);
|
||||
#endif
|
||||
|
||||
/* 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,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source 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.1-service.xiaomi_sm8350"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <hidl/HidlSupport.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
|
||||
#include <android/hardware/biometrics/fingerprint/2.1/types.h>
|
||||
#include "BiometricsFingerprint.h"
|
||||
|
||||
using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
|
||||
using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
|
||||
using android::hardware::configureRpcThreadpool;
|
||||
using android::hardware::joinRpcThreadpool;
|
||||
using android::sp;
|
||||
#ifdef USE_EXTENSION
|
||||
using vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
android::sp<IBiometricsFingerprint> biometricsFingerprint = BiometricsFingerprint::getInstance();
|
||||
#ifdef USE_EXTENSION
|
||||
android::sp<IXiaomiFingerprint> xiaomiFingerprint = BiometricsFingerprint::getInstance();
|
||||
#endif
|
||||
|
||||
configureRpcThreadpool(1, true /*callerWillJoin*/);
|
||||
|
||||
if (biometricsFingerprint != nullptr) {
|
||||
if (::android::OK != biometricsFingerprint->registerAsService()) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of BiometricsFingerprint, nullptr");
|
||||
}
|
||||
|
||||
#ifdef USE_EXTENSION
|
||||
if (xiaomiFingerprint != nullptr) {
|
||||
if (::android::OK != xiaomiFingerprint->registerAsService()) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
ALOGE("Can't create instance of XiaomiFingerprint, nullptr");
|
||||
}
|
||||
#endif
|
||||
|
||||
joinRpcThreadpool();
|
||||
|
||||
return 0; // should never get here
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<manifest version="1.0" type="device">
|
||||
<hal format="hidl">
|
||||
<name>vendor.xiaomi.hardware.fingerprintextension</name>
|
||||
<transport>hwbinder</transport>
|
||||
<version>1.0</version>
|
||||
<interface>
|
||||
<name>IXiaomiFingerprint</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</manifest>
|
@ -106,6 +106,11 @@ on post-fs-data
|
||||
mkdir /data/vendor/wlan_logs 0777 root shell
|
||||
mkdir /data/vendor/nfc 0777 nfc nfc
|
||||
|
||||
# Create fingerprint related directory
|
||||
mkdir /data/vendor/fpc 0770 system system
|
||||
mkdir /data/vendor/goodix 0770 system system
|
||||
mkdir /mnt/vendor/persist/goodix 0770 system system
|
||||
|
||||
on early-boot
|
||||
# Enable WLAN cold boot calibration
|
||||
write /sys/devices/platform/soc/b0000000.qcom,cnss-qca6490/fs_ready 1
|
||||
@ -136,6 +141,19 @@ on boot
|
||||
|
||||
write /sys/block/sda/queue/wbt_lat_usec 75000
|
||||
|
||||
# Set fingerprint related permissions
|
||||
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/power_cfg
|
||||
|
||||
on init && property:ro.boot.mode=charger
|
||||
mount_all /vendor/etc/charger_fstab.qcom --early
|
||||
write /sys/kernel/boot_adsp/boot 1
|
||||
|
@ -134,3 +134,6 @@ firmware_directories /vendor/firmware_mnt/image/
|
||||
/sys/bus/iio/devices/iio:device* buffer/enable 0600 system system
|
||||
/sys/bus/iio/devices/iio:device* scan_elements/in_proximity_en 0600 system system
|
||||
/sys/bus/iio/devices/iio:device* scan_elements/in_timestamp_en 0600 system system
|
||||
|
||||
# Fingerprint
|
||||
/dev/goodix_fp 0660 system system
|
||||
|
2
sepolicy/vendor/file_contexts
vendored
2
sepolicy/vendor/file_contexts
vendored
@ -41,7 +41,7 @@
|
||||
/data/vendor/fpc(/.*)? u:object_r:vendor_fingerprint_data_file:s0
|
||||
/data/vendor/fpdump(/.*)? u:object_r:vendor_fingerprint_data_file:s0
|
||||
/data/vendor/goodix(/.*)? u:object_r:vendor_fingerprint_data_file:s0
|
||||
/vendor/bin/hw/android\.hardware\.biometrics\.fingerprint@2\.1-service\.xiaomi_sm8350 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
|
||||
|
||||
# Thermal
|
||||
/data/vendor/thermal(/.*)? u:object_r:thermal_data_file:s0
|
||||
|
Loading…
Reference in New Issue
Block a user