davinci: fod: Add support for Xiaomi's touchfeature

Change-Id: I15a4a3d777d784abe04e88372647fc9abff78626
Signed-off-by: Arian <arian.kulmer@web.de>
This commit is contained in:
PIPIPIG233666
2020-02-10 19:50:36 -05:00
committed by Arian
parent 86826edb8d
commit 86032a20b5
12 changed files with 56 additions and 18 deletions

View File

@@ -804,4 +804,13 @@
</interface>
<fqname>@1.0::IMotor/default</fqname>
</hal>
<hal format="hidl">
<name>vendor.xiaomi.hardware.touchfeature</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>ITouchFeature</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -1,5 +1,5 @@
//
// Copyright (C) 2019 The LineageOS Project
// Copyright (C) 2019-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.
@@ -35,6 +35,7 @@ cc_binary {
"vendor.goodix.hardware.biometrics.fingerprint@2.1",
"vendor.lineage.biometrics.fingerprint.inscreen@1.0",
"vendor.xiaomi.hardware.fingerprintextension@1.0",
"vendor.xiaomi.hardware.touchfeature@1.0",
],
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 The LineageOS Project
* Copyright (C) 2019-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.
@@ -33,9 +33,7 @@
#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 TOUCH_FOD_ENABLE 10
#define FOD_UI_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui"
@@ -45,12 +43,6 @@
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;
@@ -81,6 +73,7 @@ namespace V1_0 {
namespace implementation {
FingerprintInscreen::FingerprintInscreen() {
touchFeatureService = ITouchFeature::getService();
xiaomiFingerprintService = IXiaomiFingerprint::getService();
std::thread([this]() {
@@ -138,12 +131,12 @@ Return<void> FingerprintInscreen::onRelease() {
}
Return<void> FingerprintInscreen::onShowFODView() {
set(FOD_STATUS_PATH, FOD_STATUS_ON);
touchFeatureService->setTouchMode(TOUCH_FOD_ENABLE, 1);
return Void();
}
Return<void> FingerprintInscreen::onHideFODView() {
set(FOD_STATUS_PATH, FOD_STATUS_OFF);
touchFeatureService->resetTouchMode(TOUCH_FOD_ENABLE);
return Void();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 The LineageOS Project
* Copyright (C) 2019-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.
@@ -19,6 +19,7 @@
#include <vendor/lineage/biometrics/fingerprint/inscreen/1.0/IFingerprintInscreen.h>
#include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
#include <vendor/xiaomi/hardware/touchfeature/1.0/ITouchFeature.h>
namespace vendor {
namespace lineage {
@@ -32,6 +33,7 @@ using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::Void;
using ::vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
using ::vendor::xiaomi::hardware::touchfeature::V1_0::ITouchFeature;
class FingerprintInscreen : public IFingerprintInscreen {
public:
@@ -53,6 +55,7 @@ public:
Return<void> setCallback(const sp<IFingerprintInscreenCallback>& callback) override;
private:
sp<ITouchFeature> touchFeatureService;
sp<IXiaomiFingerprint> xiaomiFingerprintService;
std::mutex mCallbackLock;

View File

@@ -1,9 +1,6 @@
on boot
chown system system /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
chown system system /sys/devices/virtual/touch/tp_dev/fod_status
chmod 0444 /sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui
chmod 0644 /sys/devices/virtual/touch/tp_dev/fod_status
service vendor.fingerprint-inscreen-1-0 /vendor/bin/hw/vendor.lineage.biometrics.fingerprint.inscreen@1.0-service.davinci
interface vendor.lineage.biometrics.fingerprint.inscreen@1.0::IFingerprintInscreen default

View File

@@ -910,6 +910,11 @@ vendor/bin/time_daemon
vendor/etc/init/init.time_daemon.rc
vendor/lib64/libtime_genoff.so
# Touchfeature
vendor/bin/hw/vendor.xiaomi.hardware.touchfeature@1.0-service
vendor/etc/init/vendor.xiaomi.hardware.touchfeature@1.0-service.rc
vendor/lib64/hw/vendor.xiaomi.hardware.touchfeature@1.0-impl.so
# Touchscreen firmware
vendor/firmware/goodix_gt9886_limit_f10_first.tporder
vendor/firmware/goodix_gt9886_limit_f10_second.tporder

View File

@@ -1 +1,3 @@
hal_attribute(motor)
hal_attribute(touchfeature)

View File

@@ -10,13 +10,13 @@
# FOD
/sys/devices/platform/soc/soc:qcom,dsi-display/fod_ui u:object_r:sysfs_fod:s0
/sys/devices/virtual/touch/tp_dev/fod_status u:object_r:sysfs_fod:s0
# HALs
/vendor/bin/hw/android\.hardware\.light@2\.0-service\.davinci u:object_r:hal_light_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.biometrics\.fingerprint\.inscreen@1\.0-service\.davinci u:object_r:hal_lineage_fod_default_exec:s0
/vendor/bin/hw/vendor\.lineage\.livedisplay@2\.0-service\.davinci u:object_r:hal_lineage_livedisplay_qti_exec:s0
/vendor/bin/hw/vendor\.xiaomi\.hardware\.motor@1\.0-service u:object_r:hal_motor_default_exec:s0
/vendor/bin/hw/vendor\.xiaomi\.hardware\.touchfeature@1\.0-service u:object_r:hal_touchfeature_default_exec:s0
# HBM
/sys/devices/platform/soc/soc:qcom,dsi-display/hbm u:object_r:sysfs_hbm:s0
@@ -31,6 +31,9 @@
# WiFi
/vendor/bin/nv_mac u:object_r:wcnss_service_exec:s0
# Touchfeature
/dev/xiaomi-touch u:object_r:touchfeature_device:s0
# Xiaomi thermal daemon
/vendor/bin/mi_thermald u:object_r:mi_thermald_exec:s0
/data/vendor/thermal(/.*)? u:object_r:thermal_data_file:s0

View File

@@ -5,5 +5,7 @@ allow hal_lineage_fod_default sysfs_graphics:dir r_dir_perms;
allow hal_lineage_fod_default sysfs_graphics:file rw_file_perms;
allow hal_lineage_fod_default hal_fingerprint_hwservice_xiaomi:hwservice_manager find;
allow hal_lineage_fod_default hal_touchfeature_hwservice_xiaomi:hwservice_manager find;
binder_call(hal_lineage_fod_default, hal_fingerprint_default)
binder_call(hal_lineage_fod_default, hal_touchfeature_default)

View File

@@ -0,0 +1,19 @@
type hal_touchfeature_hwservice_xiaomi, hwservice_manager_type;
type touchfeature_device, dev_type;
type vendor_touchfeature_prop, property_type;
type hal_touchfeature_default, domain;
hal_server_domain(hal_touchfeature_default, hal_touchfeature)
binder_call(hal_touchfeature_client, hal_touchfeature_server)
type hal_touchfeature_default_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(hal_touchfeature_default)
add_hwservice(hal_touchfeature_server, hal_touchfeature_hwservice_xiaomi)
allow hal_touchfeature_client hal_touchfeature_hwservice_xiaomi:hwservice_manager find;
allow hal_touchfeature_default touchfeature_device:chr_file rw_file_perms;
set_prop(hal_touchfeature_default, vendor_touchfeature_prop)
vndbinder_use(hal_touchfeature_default)

View File

@@ -1,3 +1,4 @@
vendor.goodix.hardware.biometrics.fingerprint::IGoodixFingerprintDaemon u:object_r:hal_fingerprint_hwservice_xiaomi:s0
vendor.xiaomi.hardware.fingerprintextension::IXiaomiFingerprint u:object_r:hal_fingerprint_hwservice_xiaomi:s0
vendor.xiaomi.hardware.motor::IMotor u:object_r:hal_motor_hwservice_xiaomi:s0
vendor.xiaomi.hardware.touchfeature::ITouchFeature u:object_r:hal_touchfeature_hwservice_xiaomi:s0

View File

@@ -21,5 +21,8 @@ vendor.fps_hal. u:object_r:vendor_fp_prop:s0
# Sensors
persist.sensor. u:object_r:persist_sensors_prop:s0
# Touchfeature
ro.vendor.touchfeature.type u:object_r:vendor_touchfeature_prop:s0
# Xiaomi thermal daemon
sys.thermal. u:object_r:thermal_normal_prop:s0