├── .clang-format
├── Android.bp
├── IFAAService
├── Android.bp
├── AndroidManifest.xml
├── res
│ └── values
│ │ └── strings.xml
└── src
│ └── org
│ └── ifaa
│ └── aidl
│ └── manager
│ ├── IfaaManagerService.aidl
│ └── IfaaService.kt
├── aidl
├── fingerprint
│ ├── Android.bp
│ ├── CancellationSignal.cpp
│ ├── CancellationSignal.h
│ ├── Fingerprint.cpp
│ ├── Fingerprint.h
│ ├── FingerprintConfig.cpp
│ ├── FingerprintConfig.h
│ ├── LockoutTracker.cpp
│ ├── LockoutTracker.h
│ ├── Session.cpp
│ ├── Session.h
│ ├── android.hardware.biometrics.fingerprint-service.xiaomi.rc
│ ├── android.hardware.biometrics.fingerprint-service.xiaomi.xml
│ ├── fingerprint.sysprop
│ ├── include
│ │ └── Legacy2Aidl.h
│ └── service.cpp
└── sensors
│ ├── Android.bp
│ ├── HalProxy.cpp
│ ├── HalProxyCallback.cpp
│ ├── android.hardware.sensors-service.xiaomi-multihal.rc
│ ├── android.hardware.sensors.xiaomi-multihal.xml
│ └── service.cpp
├── fingerprint
├── Android.bp
├── UdfpsExtension.cpp
├── UdfpsHandler.cpp
└── include
│ ├── UdfpsHandler.h
│ └── fingerprint.h
├── hidl
├── biometrics
│ └── fingerprint
│ │ ├── Android.bp
│ │ ├── BiometricsFingerprint.cpp
│ │ ├── BiometricsFingerprint.h
│ │ ├── android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc
│ │ ├── android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml
│ │ └── service.cpp
├── sensors
│ └── 1.0
│ │ ├── Android.bp
│ │ ├── Sensors.cpp
│ │ ├── Sensors.h
│ │ ├── convert.cpp
│ │ └── include
│ │ └── sensors
│ │ └── convert.h
└── touch
│ ├── Android.bp
│ ├── HighTouchPollingRate.cpp
│ ├── HighTouchPollingRate.h
│ ├── service.cpp
│ ├── vendor.lineage.touch@1.0-service.xiaomi.rc
│ └── vendor.lineage.touch@1.0-service.xiaomi.xml
├── interfaces
├── Android.bp
├── fingerprints
│ └── extension
│ │ ├── 1.0
│ │ ├── Android.bp
│ │ ├── IAuthenticatorCallback.hal
│ │ ├── ICalibrationCallback.hal
│ │ ├── ICryptCallback.hal
│ │ ├── IFingerprintAuthenticator.hal
│ │ ├── IFingerprintCalibration.hal
│ │ ├── IFingerprintEngineering.hal
│ │ ├── IFingerprintNavigation.hal
│ │ ├── IFingerprintOptical.hal
│ │ ├── IFingerprintOpticalCallback.hal
│ │ ├── IFingerprintRecalibration.hal
│ │ ├── IFingerprintSenseTouch.hal
│ │ ├── IFingerprintSensorTest.hal
│ │ ├── IFpcFingerprintAuthenticator.hal
│ │ ├── IIlluminationTuningCallback.hal
│ │ ├── IImageCaptureCallback.hal
│ │ ├── IImageInjectionCallback.hal
│ │ ├── IRecalibrationCallback.hal
│ │ ├── ISensorTestCallback.hal
│ │ ├── ISensorTestCaptureCallback.hal
│ │ ├── IVerifyUserCallback.hal
│ │ └── types.hal
│ │ └── 2.0
│ │ ├── Android.bp
│ │ ├── ICalibrationCallback.hal
│ │ ├── IFingerprintAuthenticator.hal
│ │ ├── IFingerprintCalibration.hal
│ │ ├── IFingerprintEngineering.hal
│ │ ├── IFingerprintNavigation.hal
│ │ ├── IFingerprintRecalibration.hal
│ │ ├── IFingerprintSenseTouch.hal
│ │ ├── IFingerprintSensorTest.hal
│ │ └── ISensorTestCallback.hal
├── goodix
│ └── hardware
│ │ ├── biometrics
│ │ └── fingerprint
│ │ │ └── 2.1
│ │ │ ├── Android.bp
│ │ │ ├── IGoodixFingerprintDaemon.hal
│ │ │ ├── IGoodixFingerprintDaemonCallback.hal
│ │ │ ├── IGoodixFingerprintDaemonExt.hal
│ │ │ ├── IGoodixFingerprintDaemonExtCallback.hal
│ │ │ ├── IGoodixFingerprintDaemonFido.hal
│ │ │ ├── IGoodixFingerprintDaemonFidoCallback.hal
│ │ │ ├── IGoodixFingerprintDaemonHbd.hal
│ │ │ └── IGoodixFingerprintDaemonHbdCallback.hal
│ │ ├── fingerprint
│ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ ├── IGoodixBiometricsFingerprint.hal
│ │ │ └── IGoodixBiometricsFingerprintClientCallback.hal
│ │ └── fingerprintextension
│ │ └── 1.0
│ │ ├── Android.bp
│ │ ├── IGoodixBiometricsFingerprint.hal
│ │ └── IGoodixBiometricsFingerprintClientCallback.hal
├── updates-makefiles.sh
└── xiaomi
│ ├── hardware
│ ├── displayfeature
│ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ ├── IDisplayFeature.hal
│ │ │ ├── IDisplayFeatureCallback.hal
│ │ │ └── types.hal
│ ├── fingerprintextension
│ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ └── IXiaomiFingerprint.hal
│ ├── fx
│ │ └── tunnel
│ │ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ ├── IMiFxTunnel.hal
│ │ │ └── IMiFxTunnelCallback.hal
│ ├── mfidoca
│ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ └── IFidoService.hal
│ ├── mlipay
│ │ ├── 1.0
│ │ │ ├── Android.bp
│ │ │ └── IMlipayService.hal
│ │ └── 1.1
│ │ │ ├── Android.bp
│ │ │ └── IMlipayService.hal
│ ├── motor
│ │ └── 1.0
│ │ │ ├── Android.bp
│ │ │ ├── IMotor.hal
│ │ │ ├── IMotorCallback.hal
│ │ │ └── types.hal
│ ├── mtdservice
│ │ ├── 1.0
│ │ │ ├── Android.bp
│ │ │ └── IMTService.hal
│ │ ├── 1.1
│ │ │ ├── Android.bp
│ │ │ └── IMTService.hal
│ │ ├── 1.2
│ │ │ ├── Android.bp
│ │ │ └── IMTService.hal
│ │ └── 1.3
│ │ │ ├── Android.bp
│ │ │ └── IMTService.hal
│ └── touchfeature
│ │ └── 1.0
│ │ ├── Android.bp
│ │ └── ITouchFeature.hal
│ └── hw
│ └── touchfeature
│ └── 1.0
│ ├── Android.bp
│ └── ITouchFeature.hal
├── megvii
├── Android.bp
└── megvii.c
├── sensors
├── v1
│ ├── Android.bp
│ └── udfps_hal.cpp
└── v2
│ ├── Android.bp
│ ├── Sensor.cpp
│ ├── Sensor.h
│ ├── SensorsSubHal.cpp
│ └── SensorsSubHal.h
├── telephony
├── Android.bp
└── src
│ └── android
│ └── telephony
│ └── TelephonyBaseUtilsStub.java
├── vibrator
└── effect
│ ├── Android.bp
│ ├── effect.cpp
│ └── effect.h
└── vintf
└── xiaomi_framework_compatibility_matrix.xml
/.clang-format:
--------------------------------------------------------------------------------
1 | ../../build/soong/scripts/system-clang-format
--------------------------------------------------------------------------------
/Android.bp:
--------------------------------------------------------------------------------
1 | soong_namespace {
2 | }
3 |
--------------------------------------------------------------------------------
/IFAAService/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2022-2024 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | android_app {
8 | name: "IFAAService",
9 | srcs: [
10 | "src/**/*.kt",
11 | "src/**/*.aidl",
12 | ],
13 | aidl: {
14 | local_include_dirs: ["src"],
15 | },
16 |
17 | static_libs: [
18 | "android.hidl.base-V1.0-java",
19 | "vendor.xiaomi.hardware.mlipay-V1.1-java",
20 | ],
21 |
22 | certificate: "platform",
23 | platform_apis: true,
24 | system_ext_specific: true,
25 | }
26 |
--------------------------------------------------------------------------------
/IFAAService/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/IFAAService/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | IFAAService
8 |
9 |
--------------------------------------------------------------------------------
/IFAAService/src/org/ifaa/aidl/manager/IfaaManagerService.aidl:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2022 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | package org.ifaa.aidl.manager;
8 |
9 | interface IfaaManagerService {
10 | int getSupportBIOTypes();
11 | int startBIOManager(int authType);
12 | String getDeviceModel();
13 | byte[] processCmd(inout byte[] param);
14 | int getVersion();
15 | String getExtInfo(int authType, String keyExtInfo);
16 | void setExtInfo(int authType, String keyExtInfo, String valExtInfo);
17 | int getEnabled(int bioType);
18 | int[] getIDList(int bioType);
19 | }
20 |
--------------------------------------------------------------------------------
/IFAAService/src/org/ifaa/aidl/manager/IfaaService.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * SPDX-FileCopyrightText: 2022-2024 The LineageOS Project
3 | * SPDX-License-Identifier: Apache-2.0
4 | */
5 |
6 | package org.ifaa.aidl.manager
7 |
8 | import android.app.Service
9 | import android.content.Intent
10 | import android.os.Build
11 | import android.os.IHwBinder
12 | import android.os.SystemProperties
13 | import android.provider.Settings
14 | import android.util.Log
15 | import org.ifaa.aidl.manager.IfaaManagerService
16 | import org.json.JSONObject
17 | import vendor.xiaomi.hardware.mlipay.V1_1.IMlipayService
18 |
19 | class IfaaService : Service() {
20 | private var _mlipayService: IMlipayService? = null
21 |
22 | private val mlipayServiceDeathRecipient = IHwBinder.DeathRecipient {
23 | Log.i(LOG_TAG, "mlipay service died")
24 | _mlipayService = null
25 | }
26 |
27 | private val mBinder = object : IfaaManagerService.Stub() {
28 | override fun getSupportBIOTypes(): Int {
29 | val fpVendor = SystemProperties.get(FP_VENDOR_PROP, "")
30 | val isUdfps = SystemProperties.getBoolean(IS_UDFPS_PROP, false)
31 |
32 | val supportedBioMask = when (!invalidFpVendors.contains(fpVendor.lowercase())) {
33 | true -> AUTH_TYPE_FINGERPRINT or AUTH_TYPE_IRIS
34 | else -> AUTH_TYPE_IRIS
35 | }
36 |
37 | val ifaaProp = SystemProperties.getInt(
38 | SUPPORTED_BIO_MASK_PROP, 0
39 | ) and supportedBioMask or when (isUdfps) {
40 | true -> AUTH_TYPE_OPTICAL_FINGERPRINT
41 | else -> 0
42 | }
43 |
44 | return ifaaProp
45 | }
46 |
47 | override fun startBIOManager(authType: Int) = when (authType) {
48 | AUTH_TYPE_FINGERPRINT -> {
49 | val intent = Intent(Settings.ACTION_SECURITY_SETTINGS).apply {
50 | addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
51 | }
52 |
53 | applicationContext.startActivity(intent)
54 |
55 | COMMAND_OK
56 | }
57 |
58 | else -> COMMAND_FAIL
59 | }
60 |
61 | override fun getDeviceModel() = "${Build.MANUFACTURER}-${Build.DEVICE}"
62 |
63 | override fun processCmd(param: ByteArray) = getMlipayService()?.let { mlipayService ->
64 | var receiveBuffer: ByteArray? = null
65 |
66 | val paramByteArray = ArrayList().apply {
67 | for (byte in param) {
68 | add(byte)
69 | }
70 | }
71 |
72 | try {
73 | val receiveBufferByteArray = mlipayService.invoke_command(
74 | paramByteArray, paramByteArray.size
75 | )
76 |
77 | receiveBuffer = receiveBufferByteArray.toByteArray()
78 | } catch (e: Exception) {
79 | Log.e(LOG_TAG, "processCmdImpl: mlipay invoke_command failed", e)
80 | }
81 |
82 | receiveBuffer
83 | }
84 |
85 | override fun getVersion() = 4
86 |
87 | override fun getExtInfo(authType: Int, keyExtInfo: String) = initExtString()
88 |
89 | override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
90 | // Do nothing
91 | }
92 |
93 | override fun getEnabled(bioType: Int) = when (bioType) {
94 | AUTH_TYPE_FINGERPRINT -> BIOMETRICS_AVAILABLE
95 | else -> SCREEN_LOCK_NONE
96 | }
97 |
98 | override fun getIDList(bioType: Int): IntArray {
99 | var idList = IntArray(0)
100 |
101 | getMlipayService()?.let { mlipayService ->
102 | try {
103 | val idListAL = mlipayService.ifaa_get_idlist(bioType)
104 |
105 | idList = idListAL.toIntArray()
106 | } catch (e: Exception) {
107 | Log.e(LOG_TAG, "getIDListImpl: mlipay ifaa_get_idlist failed", e)
108 | }
109 | }
110 |
111 | return idList
112 | }
113 | }
114 |
115 | override fun onBind(intent: Intent) = mBinder
116 |
117 | private fun getMlipayService() = _mlipayService ?: runCatching {
118 | IMlipayService.getService(true)
119 | }.onSuccess {
120 | _mlipayService = it
121 | it.linkToDeath(mlipayServiceDeathRecipient, 0)
122 | }.getOrNull()
123 |
124 | private fun initExtString(): String {
125 | val obj = JSONObject()
126 | val keyInfo = JSONObject()
127 |
128 | val xy = SystemProperties.get(UDFPS_LOCATION_X_Y_PROP, "")
129 | val wh = SystemProperties.get(UDFPS_SIZE_W_H_PROP, "")
130 |
131 | try {
132 | if (!validateVal(xy) || !validateVal(wh)) {
133 | Log.e(LOG_TAG, "initExtString: invalidate, xy: $xy, wh: $wh")
134 | return ""
135 | }
136 |
137 | val split = xy.split(",")
138 | val split2 = wh.split(",")
139 |
140 | keyInfo.put("startX", split[0].toInt())
141 | keyInfo.put("startY", split[1].toInt())
142 | keyInfo.put("width", split2[0].toInt())
143 | keyInfo.put("height", split2[1].toInt())
144 | keyInfo.put("navConflict", true)
145 |
146 | obj.put("type", 0)
147 | obj.put("fullView", keyInfo)
148 |
149 | return obj.toString()
150 | } catch (e: Exception) {
151 | Log.e(LOG_TAG, "initExtString: Exception, xy: $xy, wh: $wh", e)
152 | return ""
153 | }
154 | }
155 |
156 | private fun validateVal(str: String) = !"".equals(str, ignoreCase = true) && str.contains(",")
157 |
158 | companion object {
159 | private val LOG_TAG = IfaaService::class.simpleName!!
160 |
161 | private const val AUTH_TYPE_NOT_SUPPORT = 0
162 | private const val AUTH_TYPE_FINGERPRINT = 1
163 | private const val AUTH_TYPE_IRIS = 1.shl(1)
164 | private const val AUTH_TYPE_OPTICAL_FINGERPRINT = 1.shl(2)
165 |
166 | private const val BIOMETRICS_AVAILABLE = 1000
167 | private const val SCREEN_LOCK_NONE = 1003
168 |
169 | private const val COMMAND_OK = 0
170 | private const val COMMAND_FAIL = -1
171 |
172 | private const val SUPPORTED_BIO_MASK_PROP = "persist.vendor.sys.pay.ifaa"
173 | private const val FP_VENDOR_PROP = "persist.vendor.sys.fp.vendor"
174 | private const val IS_UDFPS_PROP = "ro.hardware.fp.udfps"
175 | private const val UDFPS_LOCATION_X_Y_PROP = "persist.vendor.sys.fp.udfps.location.X_Y"
176 | private const val UDFPS_SIZE_W_H_PROP = "persist.vendor.sys.fp.udfps.size.width_height"
177 |
178 | private val invalidFpVendors = arrayOf(
179 | "",
180 | "none",
181 | )
182 | }
183 | }
184 |
--------------------------------------------------------------------------------
/aidl/fingerprint/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2024 The LineageOS Project
3 | // 2024 Paranoid Android
4 | //
5 | // SPDX-License-Identifier: Apache-2.0
6 | //
7 |
8 | soong_config_module_type {
9 | name: "xiaomi_hardware_biometrics_config_default",
10 | module_type: "cc_defaults",
11 | config_namespace: "xiaomi_hardware_biometrics",
12 | bool_variables: [
13 | "run_32bit",
14 | ],
15 | properties: ["compile_multilib"],
16 | }
17 |
18 | xiaomi_hardware_biometrics_config_default {
19 | name: "xiaomi_hardware_biometrics_config_default",
20 |
21 | soong_config_variables: {
22 | run_32bit: {
23 | conditions_default: {
24 | compile_multilib: "64",
25 | },
26 | compile_multilib: "prefer32",
27 | },
28 | },
29 | }
30 |
31 | cc_binary {
32 | name: "android.hardware.biometrics.fingerprint-service.xiaomi",
33 | defaults: ["xiaomi_hardware_biometrics_config_default"],
34 | relative_install_path: "hw",
35 | init_rc: ["android.hardware.biometrics.fingerprint-service.xiaomi.rc"],
36 | vintf_fragments: ["android.hardware.biometrics.fingerprint-service.xiaomi.xml"],
37 | srcs: [
38 | "CancellationSignal.cpp",
39 | "Fingerprint.cpp",
40 | "FingerprintConfig.cpp",
41 | "LockoutTracker.cpp",
42 | "Session.cpp",
43 | "service.cpp",
44 | ],
45 | local_include_dirs: [
46 | "include",
47 | ],
48 | shared_libs: [
49 | "libbase",
50 | "libbinder_ndk",
51 | "libcutils",
52 | "libhardware",
53 | "libdl",
54 | "liblog",
55 | "android.hardware.biometrics.fingerprint-V4-ndk",
56 | "android.hardware.biometrics.common-V4-ndk",
57 | "android.hardware.biometrics.common.config",
58 | "android.hardware.biometrics.common.thread",
59 | "android.hardware.biometrics.common.util",
60 | ],
61 | static_libs: [
62 | "libandroid.hardware.biometrics.fingerprint.Props",
63 | "libudfpshandlerfactory",
64 | ],
65 | vendor: true,
66 | header_libs: ["xiaomifingerprint_headers"],
67 | }
68 |
69 | sysprop_library {
70 | name: "android.hardware.biometrics.fingerprint.Props",
71 | srcs: ["fingerprint.sysprop"],
72 | property_owner: "Vendor",
73 | vendor: true,
74 | }
75 |
--------------------------------------------------------------------------------
/aidl/fingerprint/CancellationSignal.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #include "CancellationSignal.h"
8 |
9 | namespace aidl::android::hardware::biometrics::fingerprint {
10 |
11 | CancellationSignal::CancellationSignal(Session* session) : mSession(session) {}
12 |
13 | ndk::ScopedAStatus CancellationSignal::cancel() {
14 | return mSession->cancel();
15 | }
16 |
17 | } // namespace aidl::android::hardware::biometrics::fingerprint
18 |
--------------------------------------------------------------------------------
/aidl/fingerprint/CancellationSignal.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | #include "Session.h"
12 |
13 | namespace aidl::android::hardware::biometrics::fingerprint {
14 |
15 | class CancellationSignal
16 | : public ::aidl::android::hardware::biometrics::common::BnCancellationSignal {
17 | public:
18 | CancellationSignal(Session* session);
19 | ndk::ScopedAStatus cancel() override;
20 |
21 | private:
22 | Session* mSession;
23 | };
24 |
25 | } // namespace aidl::android::hardware::biometrics::fingerprint
26 |
--------------------------------------------------------------------------------
/aidl/fingerprint/Fingerprint.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | * 2024 Paranoid Android
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #include "Fingerprint.h"
9 |
10 | #include
11 | #include
12 | #include "util/Util.h"
13 |
14 | #include
15 | #include
16 |
17 | namespace aidl::android::hardware::biometrics::fingerprint {
18 |
19 | namespace {
20 | constexpr int MAX_ENROLLMENTS_PER_USER = 5;
21 | constexpr char HW_COMPONENT_ID[] = "fingerprintSensor";
22 | constexpr char HW_VERSION[] = "vendor/model/revision";
23 | constexpr char FW_VERSION[] = "1.01";
24 | constexpr char SERIAL_NUMBER[] = "00000001";
25 | constexpr char SW_COMPONENT_ID[] = "matchingAlgorithm";
26 | constexpr char SW_VERSION[] = "vendor/version/revision";
27 |
28 | typedef struct fingerprint_hal {
29 | const char* class_name;
30 | } fingerprint_hal_t;
31 |
32 | static const fingerprint_hal_t kModules[] = {
33 | {"fortsense"}, {"fpc"}, {"fpc_fod"}, {"goodix"}, {"goodix:gf_fingerprint"},
34 | {"goodix_fod"}, {"goodix_fod6"}, {"silead"}, {"syna"},
35 | };
36 |
37 | } // namespace
38 |
39 | static const uint16_t kVersion = HARDWARE_MODULE_API_VERSION(2, 1);
40 | static Fingerprint* sInstance;
41 |
42 | Fingerprint::Fingerprint(std::shared_ptr config) : mConfig(std::move(config)) {
43 | sInstance = this; // keep track of the most recent instance
44 |
45 | if (mDevice) {
46 | ALOGI("fingerprint HAL already opened");
47 | } else {
48 | for (auto& [module] : kModules) {
49 | std::string class_name;
50 | std::string class_module_id;
51 |
52 | auto parts = ::android::base::Split(module, ":");
53 |
54 | if (parts.size() == 2) {
55 | class_name = parts[0];
56 | class_module_id = parts[1];
57 | } else {
58 | class_name = module;
59 | class_module_id = FINGERPRINT_HARDWARE_MODULE_ID;
60 | }
61 |
62 | mDevice = openFingerprintHal(class_name.c_str(), class_module_id.c_str());
63 | if (!mDevice) {
64 | ALOGE("Can't open HAL module, class: %s, module_id: %s", class_name.c_str(),
65 | class_module_id.c_str());
66 | continue;
67 | }
68 | ALOGI("Opened fingerprint HAL, class: %s, module_id: %s", class_name.c_str(),
69 | class_module_id.c_str());
70 | break;
71 | }
72 | if (!mDevice) {
73 | ALOGE("Can't open any fingerprint HAL module");
74 | }
75 | }
76 |
77 | std::string sensorTypeProp = mConfig->get("type");
78 | if (sensorTypeProp == "udfps" || sensorTypeProp == "udfps_optical") {
79 | if (sensorTypeProp == "udfps") {
80 | mSensorType = FingerprintSensorType::UNDER_DISPLAY_ULTRASONIC;
81 | } else {
82 | mSensorType = FingerprintSensorType::UNDER_DISPLAY_OPTICAL;
83 | }
84 | mUdfpsHandlerFactory = getUdfpsHandlerFactory();
85 | if (!mUdfpsHandlerFactory) {
86 | ALOGE("Can't get UdfpsHandlerFactory");
87 | } else {
88 | mUdfpsHandler = mUdfpsHandlerFactory->create();
89 | if (!mUdfpsHandler) {
90 | ALOGE("Can't create UdfpsHandler");
91 | } else {
92 | mUdfpsHandler->init(mDevice);
93 | }
94 | }
95 | } else if (sensorTypeProp == "side") {
96 | mSensorType = FingerprintSensorType::POWER_BUTTON;
97 | } else if (sensorTypeProp == "home") {
98 | mSensorType = FingerprintSensorType::HOME_BUTTON;
99 | } else if (sensorTypeProp == "rear") {
100 | mSensorType = FingerprintSensorType::REAR;
101 | } else {
102 | mSensorType = FingerprintSensorType::UNKNOWN;
103 | UNIMPLEMENTED(FATAL) << "unrecognized or unimplemented fingerprint behavior: "
104 | << sensorTypeProp;
105 | }
106 | ALOGI("sensorTypeProp: %s", sensorTypeProp.c_str());
107 | }
108 |
109 | Fingerprint::~Fingerprint() {
110 | ALOGV("~Fingerprint()");
111 | if (mUdfpsHandler) {
112 | mUdfpsHandlerFactory->destroy(mUdfpsHandler);
113 | }
114 | if (mDevice == nullptr) {
115 | ALOGE("No valid device");
116 | return;
117 | }
118 | int err;
119 | if (0 != (err = mDevice->common.close(reinterpret_cast(mDevice)))) {
120 | ALOGE("Can't close fingerprint module, error: %d", err);
121 | return;
122 | }
123 | mDevice = nullptr;
124 | }
125 |
126 | fingerprint_device_t* Fingerprint::openFingerprintHal(const char* class_name,
127 | const char* module_id) {
128 | const hw_module_t* hw_mdl = nullptr;
129 |
130 | ALOGD("Opening fingerprint hal library...");
131 | if (hw_get_module_by_class(module_id, class_name, &hw_mdl) != 0) {
132 | ALOGE("Can't open fingerprint HW Module");
133 | return nullptr;
134 | }
135 |
136 | if (!hw_mdl) {
137 | ALOGE("No valid fingerprint module");
138 | return nullptr;
139 | }
140 |
141 | auto module = reinterpret_cast(hw_mdl);
142 | if (!module->common.methods->open) {
143 | ALOGE("No valid open method");
144 | return nullptr;
145 | }
146 |
147 | hw_device_t* device = nullptr;
148 | if (module->common.methods->open(hw_mdl, nullptr, &device) != 0) {
149 | ALOGE("Can't open fingerprint methods");
150 | return nullptr;
151 | }
152 |
153 | auto fp_device = reinterpret_cast(device);
154 | if (fp_device->set_notify(fp_device, Fingerprint::notify) != 0) {
155 | ALOGE("Can't register fingerprint module callback");
156 | return nullptr;
157 | }
158 |
159 | return fp_device;
160 | }
161 |
162 | std::vector Fingerprint::getSensorLocations() {
163 | std::vector locations;
164 |
165 | auto loc = mConfig->get("sensor_location");
166 | auto entries = ::android::base::Split(loc, ",");
167 |
168 | for (const auto& entry : entries) {
169 | auto isValidStr = false;
170 | auto dim = ::android::base::Split(entry, "|");
171 |
172 | if (dim.size() != 3 and dim.size() != 4) {
173 | if (!loc.empty()) {
174 | ALOGE("Invalid sensor location input (x|y|radius) or (x|y|radius|display): %s",
175 | loc.c_str());
176 | }
177 | } else {
178 | int32_t x, y, r;
179 | std::string d;
180 | isValidStr = ParseInt(dim[0], &x) && ParseInt(dim[1], &y) && ParseInt(dim[2], &r);
181 | if (dim.size() == 4) {
182 | d = dim[3];
183 | isValidStr = isValidStr && !d.empty();
184 | }
185 | if (isValidStr)
186 | locations.push_back({.sensorLocationX = x,
187 | .sensorLocationY = y,
188 | .sensorRadius = r,
189 | .display = d});
190 | }
191 | }
192 |
193 | return locations;
194 | }
195 |
196 | void Fingerprint::notify(const fingerprint_msg_t* msg) {
197 | Fingerprint* thisPtr = sInstance;
198 | if (thisPtr == nullptr || thisPtr->mSession == nullptr || thisPtr->mSession->isClosed()) {
199 | ALOGE("Receiving callbacks before a session is opened.");
200 | return;
201 | }
202 | thisPtr->mSession->notify(msg);
203 | }
204 |
205 | ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector* out) {
206 | std::vector componentInfo = {
207 | {HW_COMPONENT_ID, HW_VERSION, FW_VERSION, SERIAL_NUMBER, "" /* softwareVersion */},
208 | {SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */,
209 | "" /* serialNumber */, SW_VERSION}};
210 | auto sensorId = mConfig->get("sensor_id");
211 | auto sensorStrength = mConfig->get("sensor_strength");
212 | auto navigationGuesture = mConfig->get("navigation_gesture");
213 | auto detectInteraction = mConfig->get("detect_interaction");
214 | auto displayTouch = mConfig->get("display_touch");
215 | auto controlIllumination = mConfig->get("control_illumination");
216 |
217 | common::CommonProps commonProps = {sensorId, (common::SensorStrength)sensorStrength,
218 | MAX_ENROLLMENTS_PER_USER, componentInfo};
219 |
220 | std::vector sensorLocations = getSensorLocations();
221 |
222 | std::vector sensorLocationStrings;
223 | std::transform(sensorLocations.begin(), sensorLocations.end(),
224 | std::back_inserter(sensorLocationStrings),
225 | [](const SensorLocation& obj) { return obj.toString(); });
226 |
227 | ALOGI("sensor type: %s, location: %s", ::android::internal::ToString(mSensorType).c_str(),
228 | ::android::base::Join(sensorLocationStrings, ", ").c_str());
229 |
230 | *out = {{commonProps, mSensorType, sensorLocations, navigationGuesture, detectInteraction,
231 | displayTouch, controlIllumination, std::nullopt}};
232 | return ndk::ScopedAStatus::ok();
233 | }
234 |
235 | ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t userId,
236 | const std::shared_ptr& cb,
237 | std::shared_ptr* out) {
238 | CHECK(mSession == nullptr || mSession->isClosed()) << "Open session already exists!";
239 |
240 | mSession = SharedRefBase::make(mDevice, mUdfpsHandler, userId, cb, mLockoutTracker);
241 | *out = mSession;
242 |
243 | mSession->linkToDeath(cb->asBinder().get());
244 |
245 | return ndk::ScopedAStatus::ok();
246 | }
247 |
248 | } // namespace aidl::android::hardware::biometrics::fingerprint
249 |
--------------------------------------------------------------------------------
/aidl/fingerprint/Fingerprint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | * 2024 Paranoid Android
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #pragma once
9 |
10 | #include
11 |
12 | #include "FingerprintConfig.h"
13 | #include "LockoutTracker.h"
14 | #include "Session.h"
15 | #include "UdfpsHandler.h"
16 |
17 | using ::aidl::android::hardware::biometrics::fingerprint::FingerprintSensorType;
18 | using ::aidl::android::hardware::biometrics::fingerprint::ISession;
19 | using ::aidl::android::hardware::biometrics::fingerprint::ISessionCallback;
20 | using ::aidl::android::hardware::biometrics::fingerprint::SensorProps;
21 |
22 | namespace aidl::android::hardware::biometrics::fingerprint {
23 |
24 | class Fingerprint : public BnFingerprint {
25 | public:
26 | Fingerprint(std::shared_ptr config);
27 | ~Fingerprint();
28 |
29 | ndk::ScopedAStatus getSensorProps(std::vector* _aidl_return) override;
30 | ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
31 | const std::shared_ptr& cb,
32 | std::shared_ptr* out) override;
33 |
34 | private:
35 | fingerprint_device_t* openFingerprintHal(const char* class_name, const char* module_id);
36 | std::vector getSensorLocations();
37 | static void notify(const fingerprint_msg_t* msg);
38 |
39 | std::shared_ptr mConfig;
40 | std::shared_ptr mSession;
41 | LockoutTracker mLockoutTracker;
42 | FingerprintSensorType mSensorType;
43 |
44 | fingerprint_device_t* mDevice;
45 | UdfpsHandlerFactory* mUdfpsHandlerFactory;
46 | UdfpsHandler* mUdfpsHandler;
47 | };
48 |
49 | } // namespace aidl::android::hardware::biometrics::fingerprint
50 |
--------------------------------------------------------------------------------
/aidl/fingerprint/FingerprintConfig.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The Android Open Source Project
3 | * 2024 Paranoid Android
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #define LOG_TAG "FingerprintConfig"
9 |
10 | #include "FingerprintConfig.h"
11 |
12 | #include
13 |
14 | #include
15 |
16 | using namespace ::android::fingerprint::xiaomi;
17 |
18 | namespace aidl::android::hardware::biometrics::fingerprint {
19 |
20 | // Wrapper to system property access functions
21 | #define CREATE_GETTER_SETTER_WRAPPER(_NAME_, _T_) \
22 | ConfigValue _NAME_##Getter() { \
23 | return FingerprintHalProperties::_NAME_(); \
24 | } \
25 | bool _NAME_##Setter(const ConfigValue& v) { \
26 | return FingerprintHalProperties::_NAME_(std::get<_T_>(v)); \
27 | }
28 |
29 | CREATE_GETTER_SETTER_WRAPPER(type, OptString)
30 | CREATE_GETTER_SETTER_WRAPPER(sensor_id, OptInt32)
31 | CREATE_GETTER_SETTER_WRAPPER(sensor_location, OptString)
32 | CREATE_GETTER_SETTER_WRAPPER(sensor_strength, OptInt32)
33 | CREATE_GETTER_SETTER_WRAPPER(navigation_gesture, OptBool)
34 | CREATE_GETTER_SETTER_WRAPPER(detect_interaction, OptBool)
35 | CREATE_GETTER_SETTER_WRAPPER(display_touch, OptBool)
36 | CREATE_GETTER_SETTER_WRAPPER(control_illumination, OptBool)
37 |
38 | // Name, Getter, Setter, Parser and default value
39 | #define NGS(_NAME_) #_NAME_, _NAME_##Getter, _NAME_##Setter
40 | static Config::Data configData[] = {
41 | {NGS(type), &Config::parseString, ""},
42 | {NGS(sensor_id), &Config::parseInt32, "0"},
43 | {NGS(sensor_location), &Config::parseString, ""},
44 | {NGS(sensor_strength), &Config::parseInt32, "2"}, // STRONG
45 | {NGS(navigation_gesture), &Config::parseBool, "false"},
46 | {NGS(detect_interaction), &Config::parseBool, "false"},
47 | {NGS(display_touch), &Config::parseBool, "false"},
48 | {NGS(control_illumination), &Config::parseBool, "false"},
49 | };
50 |
51 | Config::Data* FingerprintConfig::getConfigData(int* size) {
52 | *size = sizeof(configData) / sizeof(configData[0]);
53 | return configData;
54 | }
55 |
56 | } // namespace aidl::android::hardware::biometrics::fingerprint
57 |
--------------------------------------------------------------------------------
/aidl/fingerprint/FingerprintConfig.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The Android Open Source Project
3 | * 2024 Paranoid Android
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #pragma once
9 |
10 | #include "config/Config.h"
11 |
12 | namespace aidl::android::hardware::biometrics::fingerprint {
13 |
14 | class FingerprintConfig : public Config {
15 | Config::Data* getConfigData(int* size) override;
16 | };
17 |
18 | } // namespace aidl::android::hardware::biometrics::fingerprint
19 |
--------------------------------------------------------------------------------
/aidl/fingerprint/LockoutTracker.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The Android Open Source Project
3 | * 2024 The LineageOS Project
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #include "LockoutTracker.h"
9 | #include
10 | #include "Fingerprint.h"
11 | #include "util/Util.h"
12 |
13 | using namespace ::android::fingerprint::xiaomi;
14 |
15 | namespace aidl::android::hardware::biometrics::fingerprint {
16 |
17 | void LockoutTracker::reset(bool clearAttemptCounter) {
18 | if (clearAttemptCounter) {
19 | mFailedCount = 0;
20 | }
21 | mLockoutTimedStart = 0;
22 | mCurrentMode = LockoutMode::kNone;
23 | }
24 |
25 | void LockoutTracker::addFailedAttempt() {
26 | mFailedCount++;
27 | if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD) {
28 | mCurrentMode = LockoutMode::kPermanent;
29 | } else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) {
30 | if (mCurrentMode == LockoutMode::kNone) {
31 | mCurrentMode = LockoutMode::kTimed;
32 | mLockoutTimedStart = Util::getSystemNanoTime();
33 | }
34 | }
35 | }
36 |
37 | LockoutTracker::LockoutMode LockoutTracker::getMode() {
38 | if (mCurrentMode == LockoutMode::kTimed) {
39 | if (Util::hasElapsed(mLockoutTimedStart, LOCKOUT_TIMED_DURATION)) {
40 | mCurrentMode = LockoutMode::kNone;
41 | mLockoutTimedStart = 0;
42 | }
43 | }
44 |
45 | return mCurrentMode;
46 | }
47 |
48 | int64_t LockoutTracker::getLockoutTimeLeft() {
49 | int64_t res = 0;
50 |
51 | if (mLockoutTimedStart > 0) {
52 | auto now = Util::getSystemNanoTime();
53 | auto elapsed = (now - mLockoutTimedStart) / 1000000LL;
54 | res = LOCKOUT_TIMED_DURATION - elapsed;
55 | LOG(INFO) << "elapsed=" << elapsed << " now = " << now
56 | << " mLockoutTimedStart=" << mLockoutTimedStart << " res=" << res;
57 | }
58 |
59 | return res;
60 | }
61 |
62 | } // namespace aidl::android::hardware::biometrics::fingerprint
63 |
--------------------------------------------------------------------------------
/aidl/fingerprint/LockoutTracker.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The Android Open Source Project
3 | * 2024 The LineageOS Project
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #pragma once
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | #define LOCKOUT_TIMED_THRESHOLD 5
15 | #define LOCKOUT_TIMED_DURATION 10000
16 | #define LOCKOUT_PERMANENT_THRESHOLD 20
17 |
18 | namespace aidl::android::hardware::biometrics::fingerprint {
19 |
20 | class LockoutTracker {
21 | public:
22 | LockoutTracker() : mFailedCount(0) {}
23 | ~LockoutTracker() {}
24 |
25 | enum class LockoutMode : int8_t { kNone = 0, kTimed, kPermanent };
26 |
27 | void reset(bool clearAttemptCounter);
28 | LockoutMode getMode();
29 | void addFailedAttempt();
30 | int64_t getLockoutTimeLeft();
31 | inline std::string toString() const {
32 | std::ostringstream os;
33 | os << "----- LockoutTracker:: -----" << std::endl;
34 | os << "LockoutTracker::mFailedCount:" << mFailedCount;
35 | os << ", LockoutTracker::mCurrentMode:" << (int)mCurrentMode;
36 | os << std::endl;
37 | return os.str();
38 | }
39 |
40 | private:
41 | int32_t mFailedCount;
42 | int64_t mLockoutTimedStart;
43 | LockoutMode mCurrentMode;
44 | };
45 |
46 | } // namespace aidl::android::hardware::biometrics::fingerprint
47 |
--------------------------------------------------------------------------------
/aidl/fingerprint/Session.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 | #define LOG_TAG "android.hardware.biometrics.fingerprint-service.xiaomi"
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include "fingerprint.h"
16 |
17 | #include "LockoutTracker.h"
18 | #include "UdfpsHandler.h"
19 |
20 | using ::aidl::android::hardware::biometrics::common::ICancellationSignal;
21 | using ::aidl::android::hardware::biometrics::common::OperationContext;
22 | using ::aidl::android::hardware::biometrics::fingerprint::PointerContext;
23 | using ::aidl::android::hardware::keymaster::HardwareAuthToken;
24 |
25 | namespace aidl::android::hardware::biometrics::fingerprint {
26 |
27 | void onClientDeath(void* cookie);
28 |
29 | class Session : public BnSession {
30 | public:
31 | Session(fingerprint_device_t* device, UdfpsHandler* udfpsHandler, int userId,
32 | std::shared_ptr cb, LockoutTracker lockoutTracker);
33 | ndk::ScopedAStatus generateChallenge() override;
34 | ndk::ScopedAStatus revokeChallenge(int64_t challenge) override;
35 | ndk::ScopedAStatus enroll(const HardwareAuthToken& hat,
36 | std::shared_ptr* out) override;
37 | ndk::ScopedAStatus authenticate(int64_t operationId,
38 | std::shared_ptr* out) override;
39 | ndk::ScopedAStatus detectInteraction(std::shared_ptr* out) override;
40 | ndk::ScopedAStatus enumerateEnrollments() override;
41 | ndk::ScopedAStatus removeEnrollments(const std::vector& enrollmentIds) override;
42 | ndk::ScopedAStatus getAuthenticatorId() override;
43 | ndk::ScopedAStatus invalidateAuthenticatorId() override;
44 | ndk::ScopedAStatus resetLockout(const HardwareAuthToken& hat) override;
45 | ndk::ScopedAStatus close() override;
46 | ndk::ScopedAStatus onPointerDown(int32_t pointerId, int32_t x, int32_t y, float minor,
47 | float major) override;
48 | ndk::ScopedAStatus onPointerUp(int32_t pointerId) override;
49 | ndk::ScopedAStatus onUiReady() override;
50 | ndk::ScopedAStatus authenticateWithContext(int64_t operationId, const OperationContext& context,
51 | std::shared_ptr* out) override;
52 | ndk::ScopedAStatus enrollWithContext(const HardwareAuthToken& hat,
53 | const OperationContext& context,
54 | std::shared_ptr* out) override;
55 | ndk::ScopedAStatus detectInteractionWithContext(
56 | const OperationContext& context, std::shared_ptr* out) override;
57 | ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override;
58 | ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override;
59 | ndk::ScopedAStatus onContextChanged(const OperationContext& context) override;
60 | ndk::ScopedAStatus onPointerCancelWithContext(const PointerContext& context) override;
61 | ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override;
62 |
63 | ndk::ScopedAStatus cancel();
64 | binder_status_t linkToDeath(AIBinder* binder);
65 | bool isClosed();
66 | void notify(const fingerprint_msg_t* msg);
67 |
68 | private:
69 | fingerprint_device_t* mDevice;
70 | LockoutTracker mLockoutTracker;
71 | bool mClosed = false;
72 |
73 | // static ndk::ScopedAStatus ErrorFilter(int32_t error);
74 | static Error VendorErrorFilter(int32_t error, int32_t* vendorCode);
75 | static AcquiredInfo VendorAcquiredFilter(int32_t info, int32_t* vendorCode);
76 |
77 | bool checkSensorLockout();
78 | void clearLockout(bool clearAttemptCounter);
79 | void startLockoutTimer(int64_t timeout);
80 | void lockoutTimerExpired();
81 |
82 | // lockout timer
83 | bool mIsLockoutTimerStarted = false;
84 | bool mIsLockoutTimerAborted = false;
85 |
86 | // The user ID for which this session was created.
87 | int32_t mUserId;
88 |
89 | // Callback for talking to the framework. This callback must only be called from non-binder
90 | // threads to prevent nested binder calls and consequently a binder thread exhaustion.
91 | // Practically, it means that this callback should always be called from the worker thread.
92 | std::shared_ptr mCb;
93 |
94 | // Binder death handler.
95 | AIBinder_DeathRecipient* mDeathRecipient;
96 |
97 | UdfpsHandler* mUdfpsHandler;
98 | };
99 |
100 | } // namespace aidl::android::hardware::biometrics::fingerprint
101 |
--------------------------------------------------------------------------------
/aidl/fingerprint/android.hardware.biometrics.fingerprint-service.xiaomi.rc:
--------------------------------------------------------------------------------
1 | service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.xiaomi
2 | # "class hal" causes a race condition on some devices due to files created
3 | # in /data. As a workaround, postpone startup until later in boot once
4 | # /data is mounted.
5 | class late_start
6 | user system
7 | group system input uhid
8 | shutdown critical
9 |
--------------------------------------------------------------------------------
/aidl/fingerprint/android.hardware.biometrics.fingerprint-service.xiaomi.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | android.hardware.biometrics.fingerprint
4 | 4
5 | IFingerprint/default
6 |
7 |
8 |
--------------------------------------------------------------------------------
/aidl/fingerprint/fingerprint.sysprop:
--------------------------------------------------------------------------------
1 | # fingerprint.sysprop
2 | # module becomes static class (Java) / namespace (C++) for serving API
3 | module: "android.fingerprint.xiaomi.FingerprintHalProperties"
4 | owner: Vendor
5 |
6 | # type of fingerprint sensor (default: none)
7 | prop {
8 | prop_name: "persist.vendor.fingerprint.type"
9 | type: String
10 | scope: Internal
11 | access: ReadWrite
12 | enum_values: "udfps|udfps_optical|side|home|rear"
13 | api_name: "type"
14 | }
15 |
16 | # sensor location
17 | # ||| in pixel, can have multiple values separated by comma
18 | prop {
19 | prop_name: "persist.vendor.fingerprint.sensor_location"
20 | type: String
21 | scope: Internal
22 | access: ReadWrite
23 | api_name: "sensor_location"
24 | }
25 |
26 | # sensor id (default: 0)
27 | prop {
28 | prop_name: "persist.vendor.fingerprint.sensor_id"
29 | type: Integer
30 | scope: Internal
31 | access: ReadWrite
32 | api_name: "sensor_id"
33 | }
34 |
35 | # sensor strength (default: 2)
36 | # [0=CONVENIENCE, 1=WEAK, 2=STRONG]
37 | prop {
38 | prop_name: "persist.vendor.fingerprint.sensor_strength"
39 | type: Integer
40 | scope: Internal
41 | access: ReadWrite
42 | api_name: "sensor_strength"
43 | }
44 |
45 | # whether support navigation guestures (default: false)
46 | prop {
47 | prop_name: "persist.vendor.fingerprint.navigation_gesture"
48 | type: Boolean
49 | scope: Internal
50 | access: ReadWrite
51 | api_name: "navigation_gesture"
52 | }
53 |
54 | # whether support detect interaction (default: false)
55 | prop {
56 | prop_name: "persist.vendor.fingerprint.detect_interaction"
57 | type: Boolean
58 | scope: Internal
59 | access: ReadWrite
60 | api_name: "detect_interaction"
61 | }
62 |
63 | # whether support display touch by hal (default: false)
64 | prop {
65 | prop_name: "persist.vendor.fingerprint.udfps.display_touch"
66 | type: Boolean
67 | scope: Internal
68 | access: ReadWrite
69 | api_name: "display_touch"
70 | }
71 |
72 | # whether support illumination control by hal (default: false)
73 | prop {
74 | prop_name: "persist.vendor.fingerprint.udfps.control_illumination"
75 | type: Boolean
76 | scope: Internal
77 | access: ReadWrite
78 | api_name: "control_illumination"
79 | }
80 |
--------------------------------------------------------------------------------
/aidl/fingerprint/include/Legacy2Aidl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | #include
12 |
13 | #include
14 |
15 | namespace aidl::android::hardware::biometrics::fingerprint {
16 |
17 | inline void translate(const ::aidl::android::hardware::keymaster::HardwareAuthToken& authToken,
18 | hw_auth_token_t& hat) {
19 | hat.challenge = authToken.challenge;
20 | hat.user_id = authToken.userId;
21 | hat.authenticator_id = authToken.authenticatorId;
22 | // these are in host order: translate to network order
23 | hat.authenticator_type = htobe32(static_cast(authToken.authenticatorType));
24 | hat.timestamp = htobe64(authToken.timestamp.milliSeconds);
25 | std::copy(authToken.mac.begin(), authToken.mac.end(), hat.hmac);
26 | }
27 |
28 | inline void translate(const hw_auth_token_t& hat,
29 | ::aidl::android::hardware::keymaster::HardwareAuthToken& authToken) {
30 | authToken.challenge = hat.challenge;
31 | authToken.userId = hat.user_id;
32 | authToken.authenticatorId = hat.authenticator_id;
33 | // these are in network order: translate to host
34 | authToken.authenticatorType =
35 | static_cast<::aidl::android::hardware::keymaster::HardwareAuthenticatorType>(
36 | be32toh(hat.authenticator_type));
37 | authToken.timestamp.milliSeconds = be64toh(hat.timestamp);
38 | authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac), std::end(hat.hmac));
39 | }
40 |
41 | } // namespace aidl::android::hardware::biometrics::fingerprint
42 |
--------------------------------------------------------------------------------
/aidl/fingerprint/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #include "Fingerprint.h"
8 | #include "FingerprintConfig.h"
9 |
10 | #include
11 | #include
12 | #include
13 |
14 | using ::aidl::android::hardware::biometrics::fingerprint::Fingerprint;
15 | using ::aidl::android::hardware::biometrics::fingerprint::FingerprintConfig;
16 |
17 | int main() {
18 | ABinderProcess_setThreadPoolMaxThreadCount(0);
19 |
20 | std::shared_ptr config = std::make_shared();
21 | config->init();
22 |
23 | std::shared_ptr fingerprint = ndk::SharedRefBase::make(config);
24 |
25 | const std::string instance = std::string() + Fingerprint::descriptor + "/default";
26 | binder_status_t status =
27 | AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
28 | CHECK(status == STATUS_OK);
29 |
30 | ABinderProcess_joinThreadPool();
31 | return EXIT_FAILURE; // should not reach
32 | }
33 |
--------------------------------------------------------------------------------
/aidl/sensors/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2021 The Android Open Source Project
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package {
18 | // See: http://go/android-license-faq
19 | default_applicable_licenses: ["Android-Apache-2.0"],
20 | }
21 |
22 | cc_binary {
23 | name: "android.hardware.sensors-service.xiaomi-multihal",
24 | vendor: true,
25 | relative_install_path: "hw",
26 | srcs: [
27 | "service.cpp",
28 | "HalProxy.cpp",
29 | "HalProxyCallback.cpp",
30 | ],
31 | header_libs: [
32 | "android.hardware.sensors@2.X-multihal.header",
33 | "android.hardware.sensors@2.X-shared-utils",
34 | ],
35 | init_rc: ["android.hardware.sensors-service.xiaomi-multihal.rc"],
36 | vintf_fragments: ["android.hardware.sensors.xiaomi-multihal.xml"],
37 | shared_libs: [
38 | "android.hardware.sensors@2.0-ScopedWakelock",
39 | "android.hardware.sensors@2.0",
40 | "android.hardware.sensors@2.1",
41 | "android.hardware.sensors-V3-ndk",
42 | "libbase",
43 | "libcutils",
44 | "libfmq",
45 | "liblog",
46 | "libpower",
47 | "libutils",
48 | "libbinder_ndk",
49 | "libhidlbase",
50 | ],
51 | static_libs: [
52 | "libaidlcommonsupport",
53 | "android.hardware.sensors@1.0-convert",
54 | "android.hardware.sensors@2.X-multihal",
55 | "android.hardware.sensors@aidl-multihal",
56 | ],
57 | }
58 |
--------------------------------------------------------------------------------
/aidl/sensors/HalProxyCallback.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include "HalProxyCallback.h"
18 |
19 | #include
20 |
21 | namespace android {
22 | namespace hardware {
23 | namespace sensors {
24 | namespace V2_0 {
25 | namespace implementation {
26 |
27 | static constexpr int32_t kBitsAfterSubHalIndex = 24;
28 |
29 | /**
30 | * Set the subhal index as first byte of sensor handle and return this modified version.
31 | *
32 | * @param sensorHandle The sensor handle to modify.
33 | * @param subHalIndex The index in the hal proxy of the sub hal this sensor belongs to.
34 | *
35 | * @return The modified sensor handle.
36 | */
37 | int32_t setSubHalIndex(int32_t sensorHandle, size_t subHalIndex) {
38 | return sensorHandle | (static_cast(subHalIndex) << kBitsAfterSubHalIndex);
39 | }
40 |
41 | void HalProxyCallbackBase::postEvents(const std::vector& events,
42 | ScopedWakelock wakelock) {
43 | if (events.empty() || !mCallback->areThreadsRunning()) return;
44 | size_t numWakeupEvents;
45 | std::vector processedEvents = processEvents(events, &numWakeupEvents);
46 | if (numWakeupEvents > 0) {
47 | ALOG_ASSERT(wakelock.isLocked(),
48 | "Wakeup events posted while wakelock unlocked for subhal"
49 | " w/ index %" PRId32 ".",
50 | mSubHalIndex);
51 | } else {
52 | ALOG_ASSERT(!wakelock.isLocked(),
53 | "No Wakeup events posted but wakelock locked for subhal"
54 | " w/ index %" PRId32 ".",
55 | mSubHalIndex);
56 | }
57 | mCallback->postEventsToMessageQueue(processedEvents, numWakeupEvents, std::move(wakelock));
58 | }
59 |
60 | ScopedWakelock HalProxyCallbackBase::createScopedWakelock(bool lock) {
61 | ScopedWakelock wakelock(mRefCounter, lock);
62 | return wakelock;
63 | }
64 |
65 | std::vector HalProxyCallbackBase::processEvents(const std::vector& events,
66 | size_t* numWakeupEvents) const {
67 | *numWakeupEvents = 0;
68 | std::vector eventsOut;
69 | for (V2_1::Event event : events) {
70 | event.sensorHandle = setSubHalIndex(event.sensorHandle, mSubHalIndex);
71 | if (event.sensorType == V2_1::SensorType::DYNAMIC_SENSOR_META) {
72 | event.u.dynamic.sensorHandle =
73 | setSubHalIndex(event.u.dynamic.sensorHandle, mSubHalIndex);
74 | }
75 | const V2_1::SensorInfo& sensor = mCallback->getSensorInfo(event.sensorHandle);
76 |
77 | if (sensor.type == V2_1::SensorType::PICK_UP_GESTURE
78 | && event.u.scalar != 1) {
79 | continue;
80 | }
81 |
82 | if ((sensor.flags & V1_0::SensorFlagBits::WAKE_UP) != 0) {
83 | (*numWakeupEvents)++;
84 | }
85 | eventsOut.push_back(event);
86 | }
87 | return eventsOut;
88 | }
89 |
90 | } // namespace implementation
91 | } // namespace V2_0
92 | } // namespace sensors
93 | } // namespace hardware
94 | } // namespace android
95 |
--------------------------------------------------------------------------------
/aidl/sensors/android.hardware.sensors-service.xiaomi-multihal.rc:
--------------------------------------------------------------------------------
1 | service vendor.sensors-hal-multihal /vendor/bin/hw/android.hardware.sensors-service.xiaomi-multihal
2 | class hal
3 | user system
4 | group system wakelock context_hub input uhid
5 | task_profiles ServiceCapacityLow
6 | capabilities BLOCK_SUSPEND
7 | rlimit rtprio 10 10
8 |
--------------------------------------------------------------------------------
/aidl/sensors/android.hardware.sensors.xiaomi-multihal.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | android.hardware.sensors
20 | 3
21 | ISensors/default
22 |
23 |
24 |
--------------------------------------------------------------------------------
/aidl/sensors/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include
18 | #include
19 | #include
20 | #include "HalProxyAidl.h"
21 |
22 | using ::aidl::android::hardware::sensors::implementation::HalProxyAidl;
23 |
24 | int main() {
25 | ABinderProcess_setThreadPoolMaxThreadCount(0);
26 |
27 | // Make a default multihal sensors service
28 | auto halProxy = ndk::SharedRefBase::make();
29 | const std::string halProxyName = std::string() + HalProxyAidl::descriptor + "/default";
30 | binder_status_t status =
31 | AServiceManager_addService(halProxy->asBinder().get(), halProxyName.c_str());
32 | CHECK_EQ(status, STATUS_OK);
33 |
34 | ABinderProcess_joinThreadPool();
35 | return EXIT_FAILURE; // should not reach
36 | }
37 |
--------------------------------------------------------------------------------
/fingerprint/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2022-2024 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | cc_library_static {
8 | name: "libudfpshandlerfactory",
9 | srcs: ["UdfpsHandler.cpp"],
10 | vendor: true,
11 | header_libs: ["xiaomifingerprint_headers"],
12 | }
13 |
14 | cc_library_headers {
15 | name: "xiaomifingerprint_headers",
16 | export_include_dirs: ["include"],
17 | vendor: true,
18 | header_libs: ["libhardware_headers"],
19 | export_header_lib_headers: ["libhardware_headers"],
20 | }
21 |
22 | cc_library_static {
23 | name: "libudfps_extension.xiaomi",
24 | srcs: ["UdfpsExtension.cpp"],
25 | include_dirs: [
26 | "frameworks/native/services/surfaceflinger/CompositionEngine/include",
27 | ],
28 | header_libs: [
29 | "generated_kernel_headers",
30 | ],
31 | }
32 |
--------------------------------------------------------------------------------
/fingerprint/UdfpsExtension.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022-2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #include
8 |
9 | #if __has_include()
10 | #include
11 | #elif __has_include()
12 | #include
13 | #endif
14 |
15 | uint32_t getUdfpsDimZOrder(uint32_t z) {
16 | return z;
17 | }
18 |
19 | uint32_t getUdfpsZOrder(uint32_t z, bool touched) {
20 | if (touched) {
21 | z |= FOD_PRESSED_LAYER_ZORDER;
22 | }
23 | return z;
24 | }
25 |
26 | uint64_t getUdfpsUsageBits(uint64_t usageBits, bool /* touched */) {
27 | return usageBits;
28 | }
29 |
--------------------------------------------------------------------------------
/fingerprint/UdfpsHandler.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #include "UdfpsHandler.h"
8 | #include
9 |
10 | #define UDFPS_HANDLER_LIB_NAME "libudfpshandler.so"
11 | #define UDFPS_HANDLER_FACTORY "UDFPS_HANDLER_FACTORY"
12 |
13 | UdfpsHandlerFactory* getUdfpsHandlerFactory() {
14 | void* libudfpshander;
15 | UdfpsHandlerFactory* factory_handler;
16 |
17 | libudfpshander = dlopen(UDFPS_HANDLER_LIB_NAME, RTLD_LAZY);
18 | if (!libudfpshander) {
19 | goto error;
20 | }
21 |
22 | factory_handler = (UdfpsHandlerFactory*)dlsym(libudfpshander, UDFPS_HANDLER_FACTORY);
23 | if (!factory_handler) {
24 | goto error;
25 | }
26 |
27 | return factory_handler;
28 |
29 | error:
30 | if (libudfpshander) {
31 | dlclose(libudfpshander);
32 | }
33 |
34 | return nullptr;
35 | }
36 |
--------------------------------------------------------------------------------
/fingerprint/include/UdfpsHandler.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022,2025 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 | #include "fingerprint.h"
11 |
12 | class UdfpsHandler {
13 | public:
14 | virtual ~UdfpsHandler() = default;
15 |
16 | virtual void init(fingerprint_device_t* device) {};
17 | virtual void onFingerDown(uint32_t x, uint32_t y, float minor, float major) {};
18 | virtual void onFingerUp() {};
19 |
20 | virtual void onAcquired(int32_t result, int32_t vendorCode) {};
21 | virtual void onAuthenticationSucceeded() {};
22 | virtual void onAuthenticationFailed() {};
23 | virtual void cancel() {};
24 | };
25 |
26 | struct UdfpsHandlerFactory {
27 | UdfpsHandler* (*create)();
28 | void (*destroy)(UdfpsHandler* handler);
29 | };
30 |
31 | UdfpsHandlerFactory* getUdfpsHandlerFactory();
32 |
--------------------------------------------------------------------------------
/fingerprint/include/fingerprint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2014 The Android Open Source Project
3 | * 2022 The LineageOS Project
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #pragma once
9 |
10 | #include
11 | #include
12 |
13 | #define FINGERPRINT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
14 | #define FINGERPRINT_MODULE_API_VERSION_2_0 HARDWARE_MODULE_API_VERSION(2, 0)
15 | #define FINGERPRINT_MODULE_API_VERSION_2_1 HARDWARE_MODULE_API_VERSION(2, 1)
16 | #define FINGERPRINT_MODULE_API_VERSION_3_0 HARDWARE_MODULE_API_VERSION(3, 0)
17 | #define FINGERPRINT_HARDWARE_MODULE_ID "fingerprint"
18 |
19 | typedef enum fingerprint_msg_type {
20 | FINGERPRINT_ERROR = -1,
21 | FINGERPRINT_ACQUIRED = 1,
22 | FINGERPRINT_TEMPLATE_ENROLLING = 3,
23 | FINGERPRINT_TEMPLATE_REMOVED = 4,
24 | FINGERPRINT_AUTHENTICATED = 5,
25 | FINGERPRINT_TEMPLATE_ENUMERATING = 6,
26 | } fingerprint_msg_type_t;
27 |
28 | /*
29 | * Fingerprint errors are meant to tell the framework to terminate the current operation and ask
30 | * for the user to correct the situation. These will almost always result in messaging and user
31 | * interaction to correct the problem.
32 | *
33 | * For example, FINGERPRINT_ERROR_CANCELED should follow any acquisition message that results in
34 | * a situation where the current operation can't continue without user interaction. For example,
35 | * if the sensor is dirty during enrollment and no further enrollment progress can be made,
36 | * send FINGERPRINT_ACQUIRED_IMAGER_DIRTY followed by FINGERPRINT_ERROR_CANCELED.
37 | */
38 | typedef enum fingerprint_error {
39 | FINGERPRINT_ERROR_HW_UNAVAILABLE = 1, /* The hardware has an error that can't be resolved. */
40 | FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2, /* Bad data; operation can't continue */
41 | FINGERPRINT_ERROR_TIMEOUT = 3, /* The operation has timed out waiting for user input. */
42 | FINGERPRINT_ERROR_NO_SPACE = 4, /* No space available to store a template */
43 | FINGERPRINT_ERROR_CANCELED = 5, /* The current operation can't proceed. See above. */
44 | FINGERPRINT_ERROR_UNABLE_TO_REMOVE = 6, /* fingerprint with given id can't be removed */
45 | FINGERPRINT_ERROR_LOCKOUT =
46 | 7, /* the fingerprint hardware is in lockout due to too many attempts */
47 | FINGERPRINT_ERROR_VENDOR_BASE = 1000 /* vendor-specific error messages start here */
48 | } fingerprint_error_t;
49 |
50 | /*
51 | * Fingerprint acquisition info is meant as feedback for the current operation. Anything but
52 | * FINGERPRINT_ACQUIRED_GOOD will be shown to the user as feedback on how to take action on the
53 | * current operation. For example, FINGERPRINT_ACQUIRED_IMAGER_DIRTY can be used to tell the user
54 | * to clean the sensor. If this will cause the current operation to fail, an additional
55 | * FINGERPRINT_ERROR_CANCELED can be sent to stop the operation in progress (e.g. enrollment).
56 | * In general, these messages will result in a "Try again" message.
57 | */
58 | typedef enum fingerprint_acquired_info {
59 | FINGERPRINT_ACQUIRED_GOOD = 0,
60 | FINGERPRINT_ACQUIRED_PARTIAL = 1, /* sensor needs more data, i.e. longer swipe. */
61 | FINGERPRINT_ACQUIRED_INSUFFICIENT = 2, /* image doesn't contain enough detail for recognition*/
62 | FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3, /* sensor needs to be cleaned */
63 | FINGERPRINT_ACQUIRED_TOO_SLOW = 4, /* mostly swipe-type sensors; not enough data collected */
64 | FINGERPRINT_ACQUIRED_TOO_FAST = 5, /* for swipe and area sensors; tell user to slow down*/
65 | FINGERPRINT_ACQUIRED_DETECTED = 6, /* when the finger is first detected. Used to optimize
66 | wakeup. Should be followed by one of the above messages */
67 | FINGERPRINT_ACQUIRED_VENDOR_BASE = 1000 /* vendor-specific acquisition messages start here */
68 | } fingerprint_acquired_info_t;
69 |
70 | typedef struct fingerprint_finger_id {
71 | uint32_t gid;
72 | uint32_t fid;
73 | } fingerprint_finger_id_t;
74 |
75 | typedef struct fingerprint_enroll {
76 | fingerprint_finger_id_t finger;
77 | /* samples_remaining goes from N (no data collected, but N scans needed)
78 | * to 0 (no more data is needed to build a template). */
79 | uint32_t samples_remaining;
80 | uint64_t msg; /* Vendor specific message. Used for user guidance */
81 | } fingerprint_enroll_t;
82 |
83 | typedef struct fingerprint_iterator {
84 | fingerprint_finger_id_t finger;
85 | uint32_t remaining_templates;
86 | } fingerprint_iterator_t;
87 |
88 | typedef fingerprint_iterator_t fingerprint_enumerated_t;
89 | typedef fingerprint_iterator_t fingerprint_removed_t;
90 |
91 | typedef struct fingerprint_acquired {
92 | fingerprint_acquired_info_t acquired_info; /* information about the image */
93 | } fingerprint_acquired_t;
94 |
95 | typedef struct fingerprint_authenticated {
96 | fingerprint_finger_id_t finger;
97 | hw_auth_token_t hat;
98 | } fingerprint_authenticated_t;
99 |
100 | typedef struct fingerprint_msg {
101 | fingerprint_msg_type_t type;
102 | union {
103 | fingerprint_error_t error;
104 | fingerprint_enroll_t enroll;
105 | fingerprint_enumerated_t enumerated;
106 | fingerprint_removed_t removed;
107 | fingerprint_acquired_t acquired;
108 | fingerprint_authenticated_t authenticated;
109 | } data;
110 | } fingerprint_msg_t;
111 |
112 | /* Callback function type */
113 | typedef void (*fingerprint_notify_t)(const fingerprint_msg_t* msg);
114 |
115 | /* Synchronous operation */
116 | typedef struct fingerprint_device {
117 | /**
118 | * Common methods of the fingerprint device. This *must* be the first member
119 | * of fingerprint_device as users of this structure will cast a hw_device_t
120 | * to fingerprint_device pointer in contexts where it's known
121 | * the hw_device_t references a fingerprint_device.
122 | */
123 | struct hw_device_t common;
124 |
125 | /*
126 | * Client provided callback function to receive notifications.
127 | * Do not set by hand, use the function above instead.
128 | */
129 | fingerprint_notify_t notify;
130 |
131 | /*
132 | * Set notification callback:
133 | * Registers a user function that would receive notifications from the HAL
134 | * The call will block if the HAL state machine is in busy state until HAL
135 | * leaves the busy state.
136 | *
137 | * Function return: 0 if callback function is successfuly registered
138 | * or a negative number in case of error, generally from the errno.h set.
139 | */
140 | int (*set_notify)(struct fingerprint_device* dev, fingerprint_notify_t notify);
141 |
142 | /*
143 | * Fingerprint pre-enroll enroll request:
144 | * Generates a unique token to upper layers to indicate the start of an enrollment transaction.
145 | * This token will be wrapped by security for verification and passed to enroll() for
146 | * verification before enrollment will be allowed. This is to ensure adding a new fingerprint
147 | * template was preceded by some kind of credential confirmation (e.g. device password).
148 | *
149 | * Function return: 0 if function failed
150 | * otherwise, a uint64_t of token
151 | */
152 | uint64_t (*pre_enroll)(struct fingerprint_device* dev);
153 |
154 | /*
155 | * Fingerprint enroll request:
156 | * Switches the HAL state machine to collect and store a new fingerprint
157 | * template. Switches back as soon as enroll is complete
158 | * (fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENROLLING &&
159 | * fingerprint_msg.data.enroll.samples_remaining == 0)
160 | * or after timeout_sec seconds.
161 | * The fingerprint template will be assigned to the group gid. User has a choice
162 | * to supply the gid or set it to 0 in which case a unique group id will be generated.
163 | *
164 | * Function return: 0 if enrollment process can be successfully started
165 | * or a negative number in case of error, generally from the errno.h set.
166 | * A notify() function may be called indicating the error condition.
167 | */
168 | int (*enroll)(struct fingerprint_device* dev, const hw_auth_token_t* hat, uint32_t gid,
169 | uint32_t timeout_sec);
170 |
171 | /*
172 | * Finishes the enroll operation and invalidates the pre_enroll() generated challenge.
173 | * This will be called at the end of a multi-finger enrollment session to indicate
174 | * that no more fingers will be added.
175 | *
176 | * Function return: 0 if the request is accepted
177 | * or a negative number in case of error, generally from the errno.h set.
178 | */
179 | int (*post_enroll)(struct fingerprint_device* dev);
180 |
181 | /*
182 | * get_authenticator_id:
183 | * Returns a token associated with the current fingerprint set. This value will
184 | * change whenever a new fingerprint is enrolled, thus creating a new fingerprint
185 | * set.
186 | *
187 | * Function return: current authenticator id or 0 if function failed.
188 | */
189 | uint64_t (*get_authenticator_id)(struct fingerprint_device* dev);
190 |
191 | /*
192 | * Cancel pending enroll or authenticate, sending FINGERPRINT_ERROR_CANCELED
193 | * to all running clients. Switches the HAL state machine back to the idle state.
194 | * Unlike enroll_done() doesn't invalidate the pre_enroll() challenge.
195 | *
196 | * Function return: 0 if cancel request is accepted
197 | * or a negative number in case of error, generally from the errno.h set.
198 | */
199 | int (*cancel)(struct fingerprint_device* dev);
200 |
201 | /*
202 | * Enumerate all the fingerprint templates found in the directory set by
203 | * set_active_group()
204 | * For each template found a notify() will be called with:
205 | * fingerprint_msg.type == FINGERPRINT_TEMPLATE_ENUMERATED
206 | * fingerprint_msg.data.enumerated.finger indicating a template id
207 | * fingerprint_msg.data.enumerated.remaining_templates indicating how many more
208 | * enumeration messages to expect.
209 | * Note: If there are no fingerprints, then this should return 0 and the first fingerprint
210 | * enumerated should have fingerid=0 and remaining=0
211 | * Function return: 0 if enumerate request is accepted
212 | * or a negative number in case of error, generally from the errno.h set.
213 | */
214 | int (*enumerate)(struct fingerprint_device* dev);
215 |
216 | /*
217 | * Fingerprint remove request:
218 | * Deletes a fingerprint template.
219 | * Works only within the path set by set_active_group().
220 | * The fid parameter can be used as a widcard:
221 | * * fid == 0 -- delete all the templates in the group.
222 | * * fid != 0 -- delete this specific template from the group.
223 | * For each template found a notify() will be called with:
224 | * fingerprint_msg.type == FINGERPRINT_TEMPLATE_REMOVED
225 | * fingerprint_msg.data.removed.finger indicating a template id deleted
226 | * fingerprint_msg.data.removed.remaining_templates indicating how many more
227 | * templates will be deleted by this operation.
228 | *
229 | * Function return: 0 if fingerprint template(s) can be successfully deleted
230 | * or a negative number in case of error, generally from the errno.h set.
231 | */
232 | int (*remove)(struct fingerprint_device* dev, uint32_t gid, uint32_t fid);
233 |
234 | /*
235 | * Restricts the HAL operation to a set of fingerprints belonging to a
236 | * group provided.
237 | * The caller must provide a path to a storage location within the user's
238 | * data directory.
239 | *
240 | * Function return: 0 on success
241 | * or a negative number in case of error, generally from the errno.h set.
242 | */
243 | int (*set_active_group)(struct fingerprint_device* dev, uint32_t gid, const char* store_path);
244 |
245 | /*
246 | * Authenticates an operation identifed by operation_id
247 | *
248 | * Function return: 0 on success
249 | * or a negative number in case of error, generally from the errno.h set.
250 | */
251 | int (*authenticate)(struct fingerprint_device* dev, uint64_t operation_id, uint32_t gid);
252 |
253 | /*
254 | * Xiaomi fingerprint extension command.
255 | */
256 | int (*extCmd)(struct fingerprint_device* dev, int32_t cmd, int32_t param);
257 |
258 | /* Reserved for backward binary compatibility */
259 | void* reserved[4];
260 | } fingerprint_device_t;
261 |
262 | typedef struct fingerprint_module {
263 | /**
264 | * Common methods of the fingerprint module. This *must* be the first member
265 | * of fingerprint_module as users of this structure will cast a hw_module_t
266 | * to fingerprint_module pointer in contexts where it's known
267 | * the hw_module_t references a fingerprint_module.
268 | */
269 | struct hw_module_t common;
270 | } fingerprint_module_t;
271 |
--------------------------------------------------------------------------------
/hidl/biometrics/fingerprint/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2017 The Android Open Source Project
3 | // 2022 The LineageOS Project
4 | //
5 | // SPDX-License-Identifier: Apache-2.0
6 | //
7 |
8 | cc_binary {
9 | name: "android.hardware.biometrics.fingerprint@2.3-service.xiaomi",
10 | defaults: ["hidl_defaults"],
11 | init_rc: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc"],
12 | vintf_fragments: ["android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml"],
13 | vendor: true,
14 | relative_install_path: "hw",
15 | srcs: [
16 | "BiometricsFingerprint.cpp",
17 | "service.cpp",
18 | ],
19 |
20 | shared_libs: [
21 | "libbase",
22 | "libcutils",
23 | "libdl",
24 | "liblog",
25 | "libhidlbase",
26 | "libhardware",
27 | "libutils",
28 | "android.hardware.biometrics.fingerprint@2.1",
29 | "android.hardware.biometrics.fingerprint@2.2",
30 | "android.hardware.biometrics.fingerprint@2.3",
31 | ],
32 |
33 | static_libs: [
34 | "libudfpshandlerfactory",
35 | ],
36 |
37 | header_libs: ["xiaomifingerprint_headers"],
38 | }
39 |
--------------------------------------------------------------------------------
/hidl/biometrics/fingerprint/BiometricsFingerprint.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | * 2022 The LineageOS Project
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #pragma once
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | #include "UdfpsHandler.h"
17 | #include "fingerprint.h"
18 |
19 | namespace android {
20 | namespace hardware {
21 | namespace biometrics {
22 | namespace fingerprint {
23 | namespace V2_3 {
24 | namespace implementation {
25 |
26 | using ::android::sp;
27 | using ::android::hardware::hidl_string;
28 | using ::android::hardware::hidl_vec;
29 | using ::android::hardware::Return;
30 | using ::android::hardware::Void;
31 | using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintAcquiredInfo;
32 | using ::android::hardware::biometrics::fingerprint::V2_1::FingerprintError;
33 | using ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprintClientCallback;
34 | using ::android::hardware::biometrics::fingerprint::V2_1::RequestStatus;
35 | using ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
36 |
37 | struct BiometricsFingerprint : public IBiometricsFingerprint {
38 | public:
39 | BiometricsFingerprint();
40 | ~BiometricsFingerprint();
41 |
42 | // Method to wrap legacy HAL with BiometricsFingerprint class
43 | static IBiometricsFingerprint* getInstance();
44 |
45 | // Methods from ::android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint
46 | // follow.
47 | Return setNotify(
48 | const sp& clientCallback) override;
49 | Return preEnroll() override;
50 | Return enroll(const hidl_array& hat, uint32_t gid,
51 | uint32_t timeoutSec) override;
52 | Return postEnroll() override;
53 | Return getAuthenticatorId() override;
54 | Return cancel() override;
55 | Return enumerate() override;
56 | Return remove(uint32_t gid, uint32_t fid) override;
57 | Return setActiveGroup(uint32_t gid, const hidl_string& storePath) override;
58 | Return authenticate(uint64_t operationId, uint32_t gid) override;
59 |
60 | // Methods from ::android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint
61 | // follow.
62 | Return isUdfps(uint32_t sensorId) override;
63 | Return onFingerDown(uint32_t x, uint32_t y, float minor, float major) override;
64 | Return onFingerUp() override;
65 |
66 | private:
67 | static fingerprint_device_t* openHal(const char* class_name);
68 | static void notify(
69 | const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
70 | static Return ErrorFilter(int32_t error);
71 | static FingerprintError VendorErrorFilter(int32_t error, int32_t* vendorCode);
72 | static FingerprintAcquiredInfo VendorAcquiredFilter(int32_t error, int32_t* vendorCode);
73 | static BiometricsFingerprint* sInstance;
74 |
75 | std::mutex mClientCallbackMutex;
76 | sp mClientCallback;
77 | fingerprint_device_t* mDevice;
78 | bool mIsUdfps;
79 | UdfpsHandlerFactory* mUdfpsHandlerFactory;
80 | UdfpsHandler* mUdfpsHandler;
81 | };
82 |
83 | } // namespace implementation
84 | } // namespace V2_3
85 | } // namespace fingerprint
86 | } // namespace biometrics
87 | } // namespace hardware
88 | } // namespace android
89 |
--------------------------------------------------------------------------------
/hidl/biometrics/fingerprint/android.hardware.biometrics.fingerprint@2.3-service.xiaomi.rc:
--------------------------------------------------------------------------------
1 | service vendor.fps_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.3-service.xiaomi
2 | # "class hal" causes a race condition on some devices due to files created
3 | # in /data. As a workaround, postpone startup until later in boot once
4 | # /data is mounted.
5 | class late_start
6 | user system
7 | group system input uhid
8 |
--------------------------------------------------------------------------------
/hidl/biometrics/fingerprint/android.hardware.biometrics.fingerprint@2.3-service.xiaomi.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | android.hardware.biometrics.fingerprint
4 | hwbinder
5 | 2.3
6 |
7 | IBiometricsFingerprint
8 | default
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/hidl/biometrics/fingerprint/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | * 2022 The LineageOS Project
4 | *
5 | * SPDX-License-Identifier: Apache-2.0
6 | */
7 |
8 | #define LOG_TAG "android.hardware.biometrics.fingerprint@2.3-service.xiaomi"
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include "BiometricsFingerprint.h"
16 |
17 | using android::sp;
18 | using android::hardware::configureRpcThreadpool;
19 | using android::hardware::joinRpcThreadpool;
20 | using android::hardware::biometrics::fingerprint::V2_3::IBiometricsFingerprint;
21 | using android::hardware::biometrics::fingerprint::V2_3::implementation::BiometricsFingerprint;
22 |
23 | int main() {
24 | android::sp bio = BiometricsFingerprint::getInstance();
25 |
26 | configureRpcThreadpool(1, true /*callerWillJoin*/);
27 |
28 | if (bio != nullptr) {
29 | if (::android::OK != bio->registerAsService()) {
30 | return 1;
31 | }
32 | } else {
33 | ALOGE("Can't create instance of BiometricsFingerprint, nullptr");
34 | }
35 |
36 | joinRpcThreadpool();
37 |
38 | return 0; // should never get here
39 | }
40 |
--------------------------------------------------------------------------------
/hidl/sensors/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | package {
2 | // See: http://go/android-license-faq
3 | default_applicable_licenses: ["Android-Apache-2.0"],
4 | }
5 |
6 | cc_library_shared {
7 | name: "android.hardware.sensors@1.0-impl-xiaomi",
8 | defaults: ["hidl_defaults"],
9 | proprietary: true,
10 | relative_install_path: "hw",
11 | srcs: [
12 | "Sensors.cpp",
13 | "convert.cpp",
14 | ],
15 | shared_libs: [
16 | "liblog",
17 | "libcutils",
18 | "libhardware",
19 | "libbase",
20 | "libutils",
21 | "libhidlbase",
22 | "android.hardware.sensors@1.0",
23 | ],
24 | static_libs: [
25 | "multihal",
26 | ],
27 | local_include_dirs: ["include/sensors"],
28 | }
29 |
--------------------------------------------------------------------------------
/hidl/sensors/1.0/Sensors.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #include "Sensors.h"
18 | #include "convert.h"
19 | #include "multihal.h"
20 |
21 | #include
22 |
23 | #include
24 |
25 | namespace android {
26 | namespace hardware {
27 | namespace sensors {
28 | namespace V1_0 {
29 | namespace implementation {
30 |
31 | /*
32 | * If a multi-hal configuration file exists in the proper location,
33 | * return true indicating we need to use multi-hal functionality.
34 | */
35 | static bool UseMultiHal() {
36 | const std::string& name = MULTI_HAL_CONFIG_FILE_PATH;
37 | struct stat buffer;
38 | return (stat(name.c_str(), &buffer) == 0);
39 | }
40 |
41 | static Result ResultFromStatus(status_t err) {
42 | switch (err) {
43 | case OK:
44 | return Result::OK;
45 | case PERMISSION_DENIED:
46 | return Result::PERMISSION_DENIED;
47 | case NO_MEMORY:
48 | return Result::NO_MEMORY;
49 | case BAD_VALUE:
50 | return Result::BAD_VALUE;
51 | default:
52 | return Result::INVALID_OPERATION;
53 | }
54 | }
55 |
56 | Sensors::Sensors() : mInitCheck(NO_INIT), mSensorModule(nullptr), mSensorDevice(nullptr) {
57 | status_t err = OK;
58 | if (UseMultiHal()) {
59 | mSensorModule = ::get_multi_hal_module_info();
60 | } else {
61 | err = hw_get_module(SENSORS_HARDWARE_MODULE_ID, (hw_module_t const**)&mSensorModule);
62 | }
63 | if (mSensorModule == NULL) {
64 | err = UNKNOWN_ERROR;
65 | }
66 |
67 | if (err != OK) {
68 | LOG(ERROR) << "Couldn't load " << SENSORS_HARDWARE_MODULE_ID << " module ("
69 | << strerror(-err) << ")";
70 |
71 | mInitCheck = err;
72 | return;
73 | }
74 |
75 | err = sensors_open_1(&mSensorModule->common, &mSensorDevice);
76 |
77 | if (err != OK) {
78 | LOG(ERROR) << "Couldn't open device for module " << SENSORS_HARDWARE_MODULE_ID << " ("
79 | << strerror(-err) << ")";
80 |
81 | mInitCheck = err;
82 | return;
83 | }
84 |
85 | // Require all the old HAL APIs to be present except for injection, which
86 | // is considered optional.
87 | CHECK_GE(getHalDeviceVersion(), SENSORS_DEVICE_API_VERSION_1_3);
88 |
89 | if (getHalDeviceVersion() == SENSORS_DEVICE_API_VERSION_1_4) {
90 | if (mSensorDevice->inject_sensor_data == nullptr) {
91 | LOG(ERROR) << "HAL specifies version 1.4, but does not implement inject_sensor_data()";
92 | }
93 | if (mSensorModule->set_operation_mode == nullptr) {
94 | LOG(ERROR) << "HAL specifies version 1.4, but does not implement set_operation_mode()";
95 | }
96 | }
97 |
98 | mInitCheck = OK;
99 | }
100 |
101 | status_t Sensors::initCheck() const {
102 | return mInitCheck;
103 | }
104 |
105 | Return Sensors::getSensorsList(getSensorsList_cb _hidl_cb) {
106 | hidl_vec out = getFixedUpSensorList();
107 |
108 | _hidl_cb(out);
109 |
110 | return Void();
111 | }
112 |
113 | int Sensors::getHalDeviceVersion() const {
114 | if (!mSensorDevice) {
115 | return -1;
116 | }
117 |
118 | return mSensorDevice->common.version;
119 | }
120 |
121 | Return Sensors::setOperationMode(OperationMode mode) {
122 | if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_4 ||
123 | mSensorModule->set_operation_mode == nullptr) {
124 | return Result::INVALID_OPERATION;
125 | }
126 | return ResultFromStatus(mSensorModule->set_operation_mode((uint32_t)mode));
127 | }
128 |
129 | Return Sensors::activate(int32_t sensor_handle, bool enabled) {
130 | return ResultFromStatus(mSensorDevice->activate(
131 | reinterpret_cast(mSensorDevice), sensor_handle, enabled));
132 | }
133 |
134 | Return Sensors::poll(int32_t maxCount, poll_cb _hidl_cb) {
135 | hidl_vec out;
136 | hidl_vec dynamicSensorsAdded;
137 |
138 | std::unique_ptr data;
139 | int err = android::NO_ERROR;
140 |
141 | { // scope of reentry lock
142 |
143 | // This enforces a single client, meaning that a maximum of one client can call poll().
144 | // If this function is re-entred, it means that we are stuck in a state that may prevent
145 | // the system from proceeding normally.
146 | //
147 | // Exit and let the system restart the sensor-hal-implementation hidl service.
148 | //
149 | // This function must not call _hidl_cb(...) or return until there is no risk of blocking.
150 | std::unique_lock lock(mPollLock, std::try_to_lock);
151 | if (!lock.owns_lock()) {
152 | // cannot get the lock, hidl service will go into deadlock if it is not restarted.
153 | // This is guaranteed to not trigger in passthrough mode.
154 | LOG(ERROR)
155 | << "ISensors::poll() re-entry. I do not know what to do except killing myself.";
156 | ::exit(-1);
157 | }
158 |
159 | if (maxCount <= 0) {
160 | err = android::BAD_VALUE;
161 | } else {
162 | int bufferSize = maxCount <= kPollMaxBufferSize ? maxCount : kPollMaxBufferSize;
163 | data.reset(new sensors_event_t[bufferSize]);
164 | err = mSensorDevice->poll(reinterpret_cast(mSensorDevice),
165 | data.get(), bufferSize);
166 | }
167 | }
168 |
169 | if (err < 0) {
170 | _hidl_cb(ResultFromStatus(err), out, dynamicSensorsAdded);
171 | return Void();
172 | }
173 |
174 | const size_t count = (size_t)err;
175 |
176 | for (size_t i = 0; i < count; ++i) {
177 | if (data[i].type != SENSOR_TYPE_DYNAMIC_SENSOR_META) {
178 | continue;
179 | }
180 |
181 | const dynamic_sensor_meta_event_t* dyn = &data[i].dynamic_sensor_meta;
182 |
183 | if (!dyn->connected) {
184 | continue;
185 | }
186 |
187 | CHECK(dyn->sensor != nullptr);
188 | CHECK_EQ(dyn->sensor->handle, dyn->handle);
189 |
190 | SensorInfo info;
191 | convertFromSensor(*dyn->sensor, &info);
192 |
193 | size_t numDynamicSensors = dynamicSensorsAdded.size();
194 | dynamicSensorsAdded.resize(numDynamicSensors + 1);
195 | dynamicSensorsAdded[numDynamicSensors] = info;
196 | }
197 |
198 | std::vector events;
199 | convertFromSensorEvents(err, data.get(), events, getFixedUpSensorList());
200 | out = events;
201 |
202 | _hidl_cb(Result::OK, out, dynamicSensorsAdded);
203 |
204 | return Void();
205 | }
206 |
207 | Return Sensors::batch(int32_t sensor_handle, int64_t sampling_period_ns,
208 | int64_t max_report_latency_ns) {
209 | return ResultFromStatus(mSensorDevice->batch(mSensorDevice, sensor_handle, 0, /*flags*/
210 | sampling_period_ns, max_report_latency_ns));
211 | }
212 |
213 | Return Sensors::flush(int32_t sensor_handle) {
214 | return ResultFromStatus(mSensorDevice->flush(mSensorDevice, sensor_handle));
215 | }
216 |
217 | Return Sensors::injectSensorData(const Event& event) {
218 | if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_4 ||
219 | mSensorDevice->inject_sensor_data == nullptr) {
220 | return Result::INVALID_OPERATION;
221 | }
222 |
223 | sensors_event_t out;
224 | convertToSensorEvent(event, &out);
225 |
226 | return ResultFromStatus(mSensorDevice->inject_sensor_data(mSensorDevice, &out));
227 | }
228 |
229 | Return Sensors::registerDirectChannel(const SharedMemInfo& mem,
230 | registerDirectChannel_cb _hidl_cb) {
231 | if (mSensorDevice->register_direct_channel == nullptr ||
232 | mSensorDevice->config_direct_report == nullptr) {
233 | // HAL does not support
234 | _hidl_cb(Result::INVALID_OPERATION, -1);
235 | return Void();
236 | }
237 |
238 | sensors_direct_mem_t m;
239 | if (!convertFromSharedMemInfo(mem, &m)) {
240 | _hidl_cb(Result::BAD_VALUE, -1);
241 | return Void();
242 | }
243 |
244 | int err = mSensorDevice->register_direct_channel(mSensorDevice, &m, -1);
245 |
246 | if (err < 0) {
247 | _hidl_cb(ResultFromStatus(err), -1);
248 | } else {
249 | int32_t channelHandle = static_cast(err);
250 | _hidl_cb(Result::OK, channelHandle);
251 | }
252 | return Void();
253 | }
254 |
255 | Return Sensors::unregisterDirectChannel(int32_t channelHandle) {
256 | if (mSensorDevice->register_direct_channel == nullptr ||
257 | mSensorDevice->config_direct_report == nullptr) {
258 | // HAL does not support
259 | return Result::INVALID_OPERATION;
260 | }
261 |
262 | mSensorDevice->register_direct_channel(mSensorDevice, nullptr, channelHandle);
263 |
264 | return Result::OK;
265 | }
266 |
267 | Return Sensors::configDirectReport(int32_t sensorHandle, int32_t channelHandle,
268 | RateLevel rate, configDirectReport_cb _hidl_cb) {
269 | if (mSensorDevice->register_direct_channel == nullptr ||
270 | mSensorDevice->config_direct_report == nullptr) {
271 | // HAL does not support
272 | _hidl_cb(Result::INVALID_OPERATION, -1);
273 | return Void();
274 | }
275 |
276 | sensors_direct_cfg_t cfg = {.rate_level = convertFromRateLevel(rate)};
277 | if (cfg.rate_level < 0) {
278 | _hidl_cb(Result::BAD_VALUE, -1);
279 | return Void();
280 | }
281 |
282 | int err = mSensorDevice->config_direct_report(mSensorDevice, sensorHandle, channelHandle, &cfg);
283 |
284 | if (rate == RateLevel::STOP) {
285 | _hidl_cb(ResultFromStatus(err), -1);
286 | } else {
287 | _hidl_cb(err > 0 ? Result::OK : ResultFromStatus(err), err);
288 | }
289 | return Void();
290 | }
291 |
292 | std::vector Sensors::getFixedUpSensorList() {
293 | std::vector sensors;
294 |
295 | sensor_t const* list;
296 | size_t count = mSensorModule->get_sensors_list(mSensorModule, &list);
297 |
298 | for (size_t i = 0; i < count; ++i) {
299 | const sensor_t* src = &list[i];
300 | SensorInfo sensor;
301 |
302 | convertFromSensor(*src, &sensor);
303 |
304 | bool keep = patchXiaomiPickupSensor(sensor);
305 | if (keep) {
306 | sensors.push_back(sensor);
307 | }
308 | }
309 |
310 | return sensors;
311 | };
312 |
313 | // static
314 | void Sensors::convertFromSensorEvents(size_t count, const sensors_event_t* srcArray,
315 | std::vector& dstVec,
316 | std::vector sensorsList) {
317 | for (size_t i = 0; i < count; ++i) {
318 | const sensors_event_t& src = srcArray[i];
319 | Event event;
320 |
321 | convertFromSensorEvent(src, &event);
322 |
323 | SensorInfo* sensor = nullptr;
324 | for (auto& s : sensorsList) {
325 | if (s.sensorHandle == event.sensorHandle) {
326 | sensor = &s;
327 | break;
328 | }
329 | }
330 |
331 | if (sensor && sensor->type == SensorType::PICK_UP_GESTURE) {
332 | if (event.u.scalar != 1) {
333 | continue;
334 | }
335 | event.sensorType = SensorType::PICK_UP_GESTURE;
336 | }
337 |
338 | dstVec.push_back(event);
339 | }
340 | }
341 |
342 | ISensors* HIDL_FETCH_ISensors(const char* /* hal */) {
343 | Sensors* sensors = new Sensors;
344 | if (sensors->initCheck() != OK) {
345 | delete sensors;
346 | sensors = nullptr;
347 |
348 | return nullptr;
349 | }
350 |
351 | return sensors;
352 | }
353 |
354 | } // namespace implementation
355 | } // namespace V1_0
356 | } // namespace sensors
357 | } // namespace hardware
358 | } // namespace android
359 |
--------------------------------------------------------------------------------
/hidl/sensors/1.0/Sensors.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #pragma once
18 |
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 |
25 | namespace android {
26 | namespace hardware {
27 | namespace sensors {
28 | namespace V1_0 {
29 | namespace implementation {
30 |
31 | struct Sensors : public ::android::hardware::sensors::V1_0::ISensors {
32 | Sensors();
33 |
34 | status_t initCheck() const;
35 |
36 | Return getSensorsList(getSensorsList_cb _hidl_cb) override;
37 |
38 | Return setOperationMode(OperationMode mode) override;
39 |
40 | Return activate(int32_t sensor_handle, bool enabled) override;
41 |
42 | Return poll(int32_t maxCount, poll_cb _hidl_cb) override;
43 |
44 | Return batch(int32_t sensor_handle, int64_t sampling_period_ns,
45 | int64_t max_report_latency_ns) override;
46 |
47 | Return flush(int32_t sensor_handle) override;
48 |
49 | Return injectSensorData(const Event& event) override;
50 |
51 | Return registerDirectChannel(const SharedMemInfo& mem,
52 | registerDirectChannel_cb _hidl_cb) override;
53 |
54 | Return unregisterDirectChannel(int32_t channelHandle) override;
55 |
56 | Return configDirectReport(int32_t sensorHandle, int32_t channelHandle, RateLevel rate,
57 | configDirectReport_cb _hidl_cb) override;
58 |
59 | private:
60 | static constexpr int32_t kPollMaxBufferSize = 128;
61 | status_t mInitCheck;
62 | sensors_module_t* mSensorModule;
63 | sensors_poll_device_1_t* mSensorDevice;
64 | std::mutex mPollLock;
65 |
66 | int getHalDeviceVersion() const;
67 | std::vector getFixedUpSensorList();
68 |
69 | static void convertFromSensorEvents(size_t count, const sensors_event_t* src,
70 | std::vector& dst,
71 | std::vector sensorsList);
72 |
73 | DISALLOW_COPY_AND_ASSIGN(Sensors);
74 | };
75 |
76 | extern "C" ISensors* HIDL_FETCH_ISensors(const char* name);
77 |
78 | } // namespace implementation
79 | } // namespace V1_0
80 | } // namespace sensors
81 | } // namespace hardware
82 | } // namespace android
83 |
--------------------------------------------------------------------------------
/hidl/sensors/1.0/include/sensors/convert.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2016 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #pragma once
18 |
19 | #include
20 | #include
21 |
22 | namespace android {
23 | namespace hardware {
24 | namespace sensors {
25 | namespace V1_0 {
26 | namespace implementation {
27 |
28 | void convertFromSensor(const sensor_t& src, SensorInfo* dst);
29 | void convertToSensor(const SensorInfo& src, sensor_t* dst);
30 |
31 | void convertFromSensorEvent(const sensors_event_t& src, Event* dst);
32 | void convertToSensorEvent(const Event& src, sensors_event_t* dst);
33 |
34 | bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t* memOut);
35 | int convertFromRateLevel(RateLevel rate);
36 |
37 | bool patchXiaomiPickupSensor(SensorInfo& sensor);
38 |
39 | } // namespace implementation
40 | } // namespace V1_0
41 | } // namespace sensors
42 | } // namespace hardware
43 | } // namespace android
44 |
--------------------------------------------------------------------------------
/hidl/touch/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (C) 2022 The LineageOS Project
3 | //
4 | // SPDX-License-Identifier: Apache-2.0
5 | //
6 |
7 | soong_config_module_type {
8 | name: "xiaomi_touch_hal_cc_defaults",
9 | module_type: "cc_defaults",
10 | config_namespace: "XIAOMI_TOUCH",
11 | value_variables: ["HIGH_TOUCH_POLLING_PATH"],
12 | properties: ["cppflags"],
13 | }
14 |
15 | xiaomi_touch_hal_cc_defaults {
16 | name: "xiaomi_touch_hal_defaults",
17 | soong_config_variables: {
18 | HIGH_TOUCH_POLLING_PATH: {
19 | cppflags: ["-DHIGH_TOUCH_POLLING_PATH=\"%s\""],
20 | },
21 | },
22 | }
23 |
24 | cc_binary {
25 | name: "vendor.lineage.touch@1.0-service.xiaomi",
26 | defaults: [
27 | "hidl_defaults",
28 | "xiaomi_touch_hal_defaults",
29 | ],
30 | vintf_fragments: ["vendor.lineage.touch@1.0-service.xiaomi.xml"],
31 | init_rc: ["vendor.lineage.touch@1.0-service.xiaomi.rc"],
32 | relative_install_path: "hw",
33 | proprietary: true,
34 | srcs: [
35 | "HighTouchPollingRate.cpp",
36 | "service.cpp",
37 | ],
38 | shared_libs: [
39 | "libbase",
40 | "libbinder",
41 | "libhidlbase",
42 | "libutils",
43 | "vendor.lineage.touch@1.0",
44 | ],
45 | }
46 |
--------------------------------------------------------------------------------
/hidl/touch/HighTouchPollingRate.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "HighTouchPollingRateService"
8 |
9 | #include "HighTouchPollingRate.h"
10 |
11 | #include
12 |
13 | namespace vendor {
14 | namespace lineage {
15 | namespace touch {
16 | namespace V1_0 {
17 | namespace implementation {
18 |
19 | Return HighTouchPollingRate::isEnabled() {
20 | std::ifstream file(HIGH_TOUCH_POLLING_PATH);
21 | int enabled;
22 | file >> enabled;
23 |
24 | return enabled == 1;
25 | }
26 |
27 | Return HighTouchPollingRate::setEnabled(bool enabled) {
28 | std::ofstream file(HIGH_TOUCH_POLLING_PATH);
29 | file << (enabled ? "1" : "0");
30 | return !file.fail();
31 | }
32 |
33 | } // namespace implementation
34 | } // namespace V1_0
35 | } // namespace touch
36 | } // namespace lineage
37 | } // namespace vendor
38 |
--------------------------------------------------------------------------------
/hidl/touch/HighTouchPollingRate.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #pragma once
8 |
9 | #include
10 |
11 | namespace vendor {
12 | namespace lineage {
13 | namespace touch {
14 | namespace V1_0 {
15 | namespace implementation {
16 |
17 | using ::android::hardware::Return;
18 |
19 | class HighTouchPollingRate : public IHighTouchPollingRate {
20 | public:
21 | // Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow.
22 | Return isEnabled() override;
23 | Return setEnabled(bool enabled) override;
24 | };
25 |
26 | } // namespace implementation
27 | } // namespace V1_0
28 | } // namespace touch
29 | } // namespace lineage
30 | } // namespace vendor
31 |
--------------------------------------------------------------------------------
/hidl/touch/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | #define LOG_TAG "lineage.touch@1.0-service.xiaomi"
8 |
9 | #include
10 | #include
11 |
12 | #include "HighTouchPollingRate.h"
13 |
14 | using ::vendor::lineage::touch::V1_0::IHighTouchPollingRate;
15 | using ::vendor::lineage::touch::V1_0::implementation::HighTouchPollingRate;
16 |
17 | int main() {
18 | android::sp highTouchPollingRate = new HighTouchPollingRate();
19 |
20 | android::hardware::configureRpcThreadpool(1, true);
21 |
22 | if (highTouchPollingRate->registerAsService() != android::OK) {
23 | LOG(ERROR) << "Cannot register touchscreen high polling rate HAL service.";
24 | return 1;
25 | }
26 |
27 | LOG(INFO) << "Touchscreen HAL service ready.";
28 |
29 | android::hardware::joinRpcThreadpool();
30 |
31 | LOG(ERROR) << "Touchscreen HAL service failed to join thread pool.";
32 | return 1;
33 | }
34 |
--------------------------------------------------------------------------------
/hidl/touch/vendor.lineage.touch@1.0-service.xiaomi.rc:
--------------------------------------------------------------------------------
1 | service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.xiaomi
2 | interface vendor.lineage.touch@1.0::IHighTouchPollingRate default
3 | class hal
4 | user system
5 | group system
6 |
--------------------------------------------------------------------------------
/hidl/touch/vendor.lineage.touch@1.0-service.xiaomi.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | vendor.lineage.touch
4 | hwbinder
5 | 1.0
6 |
7 | IHighTouchPollingRate
8 | default
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/interfaces/Android.bp:
--------------------------------------------------------------------------------
1 | //
2 | // SPDX-FileCopyrightText: 2020-2025 The LineageOS Project
3 | // SPDX-License-Identifier: Apache-2.0
4 | //
5 |
6 | hidl_package_root {
7 | name: "com.fingerprints",
8 | path: "hardware/xiaomi/interfaces/fingerprints",
9 | }
10 |
11 | hidl_package_root {
12 | name: "vendor.goodix",
13 | path: "hardware/xiaomi/interfaces/goodix",
14 | }
15 |
16 | hidl_package_root {
17 | name: "vendor.xiaomi",
18 | path: "hardware/xiaomi/interfaces/xiaomi",
19 | }
20 |
21 | prebuilt_hidl_interfaces {
22 | name: "hidl_com_fingerprints_extension_interface",
23 | interfaces: [
24 | "com.fingerprints.extension@3.0::IFingerprintAuthenticator",
25 | "com.fingerprints.extension@3.0::IFingerprintCalibration",
26 | "com.fingerprints.extension@3.0::IFingerprintEngineering",
27 | "com.fingerprints.extension@3.0::IFingerprintNavigation",
28 | "com.fingerprints.extension@3.0::IFingerprintOptical",
29 | "com.fingerprints.extension@3.0::IFingerprintRecalibration",
30 | "com.fingerprints.extension@3.0::IFingerprintSenseTouch",
31 | "com.fingerprints.extension@3.0::IFingerprintSensorTest",
32 | ],
33 | }
34 |
35 | prebuilt_hidl_interfaces {
36 | name: "hidl_vendor_focaltech_fingerprint_interface",
37 | interfaces: [
38 | "vendor.focaltech.fingerprint@1.0::IFocalFingerprintService",
39 | ],
40 | }
41 |
42 | prebuilt_hidl_interfaces {
43 | name: "hidl_vendor_goodix_hardware_cap_biometrics_fingerprint_interface",
44 | interfaces: [
45 | "vendor.goodix.hardware.cap.biometrics.fingerprint@2.1::IGoodixFingerprintDaemon",
46 | "vendor.goodix.hardware.cap.biometrics.fingerprint@2.1::IGoodixFingerprintDaemonExt",
47 | ],
48 | }
49 |
50 | prebuilt_hidl_interfaces {
51 | name: "hidl_vendor_pixelworks_hardware_display_interface",
52 | interfaces: [
53 | "vendor.pixelworks.hardware.display@1.0::IIris",
54 | ],
55 | }
56 |
57 | prebuilt_hidl_interfaces {
58 | name: "hidl_vendor_silead_hardware_fingerprintext_interface",
59 | interfaces: [
60 | "vendor.silead.hardware.fingerprintext@1.0::ISileadFingerprint",
61 | ],
62 | }
63 |
64 | prebuilt_hidl_interfaces {
65 | name: "hidl_vendor_synaptics_fingerprints_interfaces_extensions_interface",
66 | interfaces: [
67 | "vendor.synaptics.fingerprints.interfaces.extensions@1.0::IFpCollection",
68 | "vendor.synaptics.fingerprints.interfaces.extensions@1.0::INavigation",
69 | "vendor.synaptics.fingerprints.interfaces.extensions@1.0::ISensorTest",
70 | ],
71 | }
72 |
73 | prebuilt_hidl_interfaces {
74 | name: "hidl_vendor_xiaomi_hardware_bgservice_interface",
75 | interfaces: [
76 | "vendor.xiaomi.hardware.bgservice@1.0::IBGService",
77 | ],
78 | }
79 |
80 | prebuilt_hidl_interfaces {
81 | name: "hidl_vendor_xiaomi_hardware_cameraperf_interface",
82 | interfaces: [
83 | "vendor.xiaomi.hardware.cameraperf@1.0::IMiCameraPerfService",
84 | ],
85 | }
86 |
87 | prebuilt_hidl_interfaces {
88 | name: "hidl_vendor_xiaomi_hardware_campostproc_interface",
89 | interfaces: [
90 | "vendor.xiaomi.hardware.campostproc@1.0::IMiPostProcService",
91 | ],
92 | }
93 |
94 | prebuilt_hidl_interfaces {
95 | name: "hidl_vendor_xiaomi_hardware_citsensorservice_interface",
96 | interfaces: [
97 | "vendor.xiaomi.hardware.citsensorservice@1.0::ICitSensorService",
98 | "vendor.xiaomi.hardware.citsensorservice@1.1::ICitSensorService",
99 | ],
100 | }
101 |
102 | prebuilt_hidl_interfaces {
103 | name: "hidl_vendor_xiaomi_hardware_dtool_interface",
104 | interfaces: [
105 | "vendor.xiaomi.hardware.dtool@1.0::IDtool",
106 | ],
107 | }
108 |
109 | prebuilt_hidl_interfaces {
110 | name: "hidl_vendor_xiaomi_hardware_micharge_interface",
111 | interfaces: [
112 | "vendor.xiaomi.hardware.micharge@1.0::IMiCharge",
113 | ],
114 | }
115 |
116 | prebuilt_hidl_interfaces {
117 | name: "hidl_vendor_xiaomi_hardware_quickcamera_interface",
118 | interfaces: [
119 | "vendor.xiaomi.hardware.quickcamera@1.0::IQuickCameraService",
120 | ],
121 | }
122 |
123 | prebuilt_hidl_interfaces {
124 | name: "hidl_vendor_xiaomi_hardware_tidaservice_interface",
125 | interfaces: [
126 | "vendor.xiaomi.hardware.tidaservice@1.0::ITidaService",
127 | "vendor.xiaomi.hardware.tidaservice@1.1::ITidaService",
128 | "vendor.xiaomi.hardware.tidaservice@1.2::ITidaService",
129 | ],
130 | }
131 |
132 | prebuilt_hidl_interfaces {
133 | name: "hidl_vendor_xiaomi_sensor_citsensorservice_interface",
134 | interfaces: [
135 | "vendor.xiaomi.sensor.citsensorservice@1.1::ICitSensorService",
136 | "vendor.xiaomi.sensor.citsensorservice@2.0::ICitSensorService",
137 | ],
138 | }
139 |
140 | prebuilt_hidl_interfaces {
141 | name: "hidl_vendor_xiaomi_sensor_communicate_interface",
142 | interfaces: [
143 | "vendor.xiaomi.sensor.communicate@1.0::ISensorCommunicate",
144 | ],
145 | }
146 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "com.fingerprints.extension@1.0",
5 | root: "com.fingerprints",
6 | system_ext_specific: true,
7 | srcs: [
8 | "types.hal",
9 | "IAuthenticatorCallback.hal",
10 | "ICalibrationCallback.hal",
11 | "ICryptCallback.hal",
12 | "IFingerprintAuthenticator.hal",
13 | "IFingerprintCalibration.hal",
14 | "IFingerprintEngineering.hal",
15 | "IFingerprintNavigation.hal",
16 | "IFingerprintOptical.hal",
17 | "IFingerprintOpticalCallback.hal",
18 | "IFingerprintRecalibration.hal",
19 | "IFingerprintSenseTouch.hal",
20 | "IFingerprintSensorTest.hal",
21 | "IFpcFingerprintAuthenticator.hal",
22 | "IIlluminationTuningCallback.hal",
23 | "IImageCaptureCallback.hal",
24 | "IImageInjectionCallback.hal",
25 | "IRecalibrationCallback.hal",
26 | "ISensorTestCallback.hal",
27 | "ISensorTestCaptureCallback.hal",
28 | "IVerifyUserCallback.hal",
29 | ],
30 | interfaces: [
31 | "android.hidl.base@1.0",
32 | ],
33 | gen_java: true,
34 | }
35 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IAuthenticatorCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IAuthenticatorCallback {
10 | oneway onAcquired(uint32_t status);
11 |
12 | oneway onAuthenticated(uint32_t fingerId);
13 |
14 | oneway onEnrollResult(uint32_t fingerId, uint32_t remaining);
15 |
16 | oneway onEnumerate(uint32_t fingerId, uint32_t remaining);
17 |
18 | oneway onError(uint32_t errorCode);
19 |
20 | oneway onRemoved(uint32_t fingerId, uint32_t remaining);
21 | };
22 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/ICalibrationCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface ICalibrationCallback {
10 | oneway onStatus(uint32_t code);
11 |
12 | oneway onError(uint32_t error);
13 |
14 | oneway onInitTransferData(uint32_t totalSize);
15 |
16 | oneway onTransferData(vec buffer, uint32_t remaning);
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/ICryptCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface ICryptCallback {
10 | oneway onResult(uint32_t result);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintAuthenticator.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import IVerifyUserCallback;
10 |
11 | interface IFingerprintAuthenticator {
12 | verifyUser(IVerifyUserCallback callback, vec fido_auth_input_1, vec fido_auth_input_2, vec dstAppName) generates (int32_t result);
13 |
14 | isUserValid(uint64_t userId) generates (bool userValid);
15 |
16 | oneway cancel();
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintCalibration.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import ICalibrationCallback;
10 |
11 | interface IFingerprintCalibration {
12 | oneway calibrate(ICalibrationCallback callback);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintEngineering.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import IImageCaptureCallback;
10 | import IImageInjectionCallback;
11 | import ICryptCallback;
12 | import ICalibrationCallback;
13 | import IIlluminationTuningCallback;
14 |
15 | interface IFingerprintEngineering {
16 | getSensorSize() generates (SensorSize sensorSize);
17 |
18 | oneway startImageSubscription(IImageCaptureCallback callback);
19 |
20 | oneway stopImageSubscription();
21 |
22 | oneway startImageInjection(IImageInjectionCallback callback);
23 |
24 | oneway stopImageInjection();
25 |
26 | oneway startCapture(IImageCaptureCallback callback, uint32_t mode);
27 |
28 | oneway cancelCapture();
29 |
30 | oneway setEnrollToken(vec token);
31 |
32 | getEnrollChallenge() generates (int64_t enrollChallenge);
33 |
34 | getBuildInfo() generates (string buildInfo);
35 |
36 | oneway cryptBlob(ICryptCallback callback, uint32_t mode);
37 |
38 | oneway startCalibration(ICalibrationCallback callback);
39 |
40 | oneway captureCalibration(ICalibrationCallback callback, uint32_t type, uint32_t level);
41 |
42 | oneway finishCalibration(ICalibrationCallback callback, uint32_t level);
43 |
44 | oneway saveCalibration(ICalibrationCallback callback, uint32_t level);
45 |
46 | oneway saveCalibrationDecrypted(ICalibrationCallback callback, uint32_t level);
47 |
48 | oneway cancelCalibration(ICalibrationCallback callback);
49 |
50 | oneway getCalibrationData(ICalibrationCallback callback);
51 |
52 | oneway startBarTarget(ICalibrationCallback callback);
53 |
54 | oneway captureBarTarget(ICalibrationCallback callback, uint32_t level);
55 |
56 | oneway finishBarTarget(ICalibrationCallback callback, uint32_t level);
57 |
58 | oneway saveBarTarget(ICalibrationCallback callback, uint32_t level);
59 |
60 | oneway cancelBarTarget(ICalibrationCallback callback);
61 |
62 | oneway setIlluminationLevel(IIlluminationTuningCallback callback, uint32_t level);
63 | };
64 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintNavigation.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IFingerprintNavigation {
10 | setNavigation(bool enabled);
11 |
12 | getNavigationConfig() generates (NavigationConfig navigationConfig);
13 |
14 | oneway setNavigationConfig(NavigationConfig navigationConfig);
15 |
16 | isEnabled() generates (bool isEnabled);
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintOptical.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import IFingerprintOpticalCallback;
10 |
11 | interface IFingerprintOptical {
12 | oneway setNotify(IFingerprintOpticalCallback callback);
13 |
14 | oneway setIlluminationStatus(uint32_t value);
15 |
16 | oneway etFingerListenerStatus(uint32_t value);
17 |
18 | setExposure(uint16_t exposureTime) generates (bool result);
19 |
20 | getExposure() generates (int16_t retVal);
21 |
22 | setAnalogGain(uint16_t gain) generates (bool result);
23 |
24 | getAnalogGain() generates (int16_t retVal);
25 |
26 | oneway setHotZoneData(HotZoneData hotZoneData);
27 |
28 | oneway setTouchEventData(TouchEventData touchEventData);
29 |
30 | getToutchEventData() generates (TouchEventData touchEventData);
31 | };
32 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintOpticalCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IFingerprintOpticalCallback {
10 | oneway onStartWaitingForFinger();
11 |
12 | oneway onStopWaitingForFinger();
13 |
14 | oneway onFingerDown();
15 |
16 | oneway onFingerLost();
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintRecalibration.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import IRecalibrationCallback;
10 |
11 | interface IFingerprintRecalibration {
12 | oneway recalibrate(vec token, IRecalibrationCallback callback);
13 |
14 | preRecalibrate() generates (int64_t challenge);
15 |
16 | oneway cancel();
17 | };
18 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintSenseTouch.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IFingerprintSenseTouch {
10 | getForce() generates (int32_t force);
11 |
12 | isSupported() generates (bool isSupported);
13 |
14 | finishCalibration(uint32_t ground, uint32_t threshold) generates (bool result);
15 |
16 | setAuthMode(uint32_t mode, uint32_t buttonTimeoutMs) generates (bool result);
17 |
18 | readConfig() generates (SenseTouchConfig senseTouchConfig);
19 | };
20 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFingerprintSensorTest.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import ISensorTestCaptureCallback;
10 | import ISensorTestCallback;
11 |
12 | interface IFingerprintSensorTest {
13 | getSensorInfo() generates (SensorInfo sensorInfo);
14 |
15 | getSensorTests() generates (vec sensorTests);
16 |
17 | oneway runSensorTest(ISensorTestCallback callback, SensorTest test, SensorTestInput input);
18 |
19 | oneway cancelSensorTest();
20 |
21 | oneway capture(ISensorTestCaptureCallback callback, bool waitForFinger, bool uncalibrated);
22 |
23 | oneway cancelCapture();
24 | };
25 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IFpcFingerprintAuthenticator.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | import IAuthenticatorCallback;
10 |
11 | interface IFpcFingerprintAuthenticator {
12 | oneway authenticate();
13 |
14 | oneway cancel();
15 |
16 | oneway enroll();
17 |
18 | oneway enumerate();
19 |
20 | oneway remove(uint32_t fingerId);
21 |
22 | oneway setNotify(IAuthenticatorCallback callback);
23 | };
24 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IIlluminationTuningCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IIlluminationTuningCallback {
10 | oneway onResult(uint32_t code);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IImageCaptureCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IImageCaptureCallback {
10 | oneway onImage(ImageCaptureData imageCaptureData);
11 |
12 | oneway onImageTransferData(uint8_t type, vec buffer);
13 |
14 | oneway onImageFinish();
15 | };
16 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IImageInjectionCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IImageInjectionCallback {
10 | onInject() generates (vec imageData);
11 |
12 | oneway onCancel();
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IRecalibrationCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IRecalibrationCallback {
10 | oneway onStatus(uint32_t code, bool imageDecision, uint32_t imageQuality, uint32_t pnQuality, uint32_t progress);
11 |
12 | oneway onError(uint32_t error);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/ISensorTestCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface ISensorTestCallback {
10 | oneway onResult(SensorTestResult result);
11 |
12 | onResultInit(uint32_t resultCode, uint32_t errorCode, bool imageFetched) generates (int32_t result);
13 |
14 | onResultTransfer(uint8_t type, string input) generates (int32_t result);
15 |
16 | onResultTransferImg(vec input) generates (int32_t result);
17 |
18 | oneway onResultFinish();
19 | };
20 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/ISensorTestCaptureCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface ISensorTestCaptureCallback {
10 | oneway onAcquired(uint32_t acquiredInfo);
11 |
12 | oneway onError(uint32_t error);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/IVerifyUserCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | interface IVerifyUserCallback {
10 | oneway onResult(uint32_t result, uint64_t userId, uint64_t userEntityId, vec encapsulatedResult);
11 |
12 | oneway onHelp(uint32_t helpCode);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/1.0/types.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@1.0;
8 |
9 | struct HotZoneData {
10 | int32_t left;
11 | int32_t right;
12 | int32_t top;
13 | int32_t bottom;
14 | int32_t update;
15 | };
16 |
17 | struct ImageCaptureData {
18 | int32_t mode;
19 | int32_t captureResult;
20 | int32_t identifyResult;
21 | int32_t templateUpdateResult;
22 | int32_t enrollResult;
23 | int32_t cacResult;
24 | int32_t userId;
25 | int32_t remainingSamples;
26 | int32_t coverage;
27 | int32_t quality;
28 | vec rawImage;
29 | vec enhancedImage;
30 | };
31 |
32 | struct NavigationConfig {
33 | int32_t tapNoImageMaxThreshold;
34 | int32_t holdNoImageMinThreshold;
35 | int32_t doubleClickTimeInterval;
36 | int32_t tapImageTransMaxThreshold;
37 | int32_t swipeImageTransMinThreshold;
38 | int32_t backGroundAlgo;
39 | };
40 |
41 | struct SensorInfo {
42 | int32_t sensorDieValidFlag;
43 | int32_t hardwareId;
44 | string lotId;
45 | int32_t waferId;
46 | int32_t waferPositionX;
47 | int32_t waferPositionY;
48 | string productionTimestamp;
49 | int32_t companionDieValidFlag;
50 | int32_t companionChipHardwareId;
51 | string companionChipLotId;
52 | int32_t vendorHwValidFlag;
53 | vec vendorData;
54 | int32_t totalNumOtpBitErrors;
55 | int32_t maxNumOtpBitErrorsInByte;
56 | int32_t productType;
57 | };
58 |
59 | struct SensorSize {
60 | int32_t width;
61 | int32_t height;
62 | };
63 |
64 | struct SensorTest {
65 | string name;
66 | string description;
67 | bool waitForFingerDown;
68 | string rubberStampType;
69 | };
70 |
71 | struct SensorTestInput {
72 | string testLimitsKeyValuePair;
73 | };
74 |
75 | struct SensorTestResult {
76 | int32_t resultCode;
77 | string resultString;
78 | int32_t errorCode;
79 | string errorString;
80 | vec imageData;
81 | string log;
82 | };
83 |
84 | struct SenseTouchConfig {
85 | bool success;
86 | int32_t version;
87 | int32_t ground;
88 | int32_t triggerThreshold;
89 | int32_t untriggerThreshold;
90 | bool authTriggerOnDown;
91 | bool authTriggerOnUp;
92 | int32_t authButtonTimeoutMs;
93 | };
94 |
95 | struct TouchEventData {
96 | int32_t hotzone_top;
97 | int32_t hotzone_left;
98 | int32_t hotzone_right;
99 | int32_t hotzone_bottom;
100 | int32_t pos_x;
101 | int32_t pos_y;
102 | float pressure;
103 | float size;
104 | int32_t major;
105 | int32_t minor;
106 | };
107 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "com.fingerprints.extension@2.0",
5 | root: "com.fingerprints",
6 | system_ext_specific: true,
7 | srcs: [
8 | "ICalibrationCallback.hal",
9 | "IFingerprintAuthenticator.hal",
10 | "IFingerprintCalibration.hal",
11 | "IFingerprintEngineering.hal",
12 | "IFingerprintNavigation.hal",
13 | "IFingerprintRecalibration.hal",
14 | "IFingerprintSenseTouch.hal",
15 | "IFingerprintSensorTest.hal",
16 | "ISensorTestCallback.hal",
17 | ],
18 | interfaces: [
19 | "android.hidl.base@1.0",
20 | "com.fingerprints.extension@1.0",
21 | ],
22 | gen_java: true,
23 | }
24 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/ICalibrationCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | interface ICalibrationCallback {
10 | oneway onStatus(uint32_t code);
11 |
12 | oneway onError(uint32_t error);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintAuthenticator.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::IFingerprintAuthenticator;
10 |
11 | interface IFingerprintAuthenticator extends @1.0::IFingerprintAuthenticator {
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintCalibration.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import ICalibrationCallback;
10 |
11 | interface IFingerprintCalibration {
12 | oneway calibrate(ICalibrationCallback callback);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintEngineering.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::IImageCaptureCallback;
10 | import @1.0::IImageInjectionCallback;
11 | import @1.0::SensorSize;
12 |
13 | interface IFingerprintEngineering {
14 |
15 | getSensorSize() generates (SensorSize sensorSize);
16 |
17 | oneway startImageSubscription(IImageCaptureCallback callback);
18 |
19 | oneway stopImageSubscription();
20 |
21 | oneway startImageInjection(IImageInjectionCallback callback);
22 |
23 | oneway stopImageInjection();
24 |
25 | oneway startCapture(IImageCaptureCallback callback, uint32_t mode);
26 |
27 | oneway cancelCapture();
28 |
29 | oneway setEnrollToken(vec token);
30 |
31 | getEnrollChallenge() generates (int64_t enrollChallenge);
32 |
33 | getBuildInfo() generates (string buildInfo);
34 | };
35 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintNavigation.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::IFingerprintNavigation;
10 |
11 | interface IFingerprintNavigation extends @1.0::IFingerprintNavigation {
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintRecalibration.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::IFingerprintRecalibration;
10 |
11 | interface IFingerprintRecalibration extends @1.0::IFingerprintRecalibration {
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintSenseTouch.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::IFingerprintSenseTouch;
10 |
11 | interface IFingerprintSenseTouch extends @1.0::IFingerprintSenseTouch {
12 |
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/IFingerprintSensorTest.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::ISensorTestCaptureCallback;
10 | import @1.0::SensorInfo;
11 | import @1.0::SensorTest;
12 | import @1.0::SensorTestInput;
13 | import ISensorTestCallback;
14 |
15 | interface IFingerprintSensorTest {
16 |
17 | getSensorInfo() generates (SensorInfo sensorInfo);
18 |
19 | getSensorTests() generates (vec sensorTests);
20 |
21 | oneway runSensorTest(ISensorTestCallback callback, SensorTest test, SensorTestInput input);
22 |
23 | oneway cancelSensorTest();
24 |
25 | oneway capture(ISensorTestCaptureCallback callback, bool waitForFinger, bool uncalibrated);
26 |
27 | oneway cancelCapture();
28 | };
29 |
--------------------------------------------------------------------------------
/interfaces/fingerprints/extension/2.0/ISensorTestCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package com.fingerprints.extension@2.0;
8 |
9 | import @1.0::SensorTestResult;
10 |
11 | interface ISensorTestCallback {
12 | oneway onResult(SensorTestResult result);
13 | };
14 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.goodix.hardware.biometrics.fingerprint@2.1",
5 | root: "vendor.goodix",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IGoodixFingerprintDaemon.hal",
9 | "IGoodixFingerprintDaemonCallback.hal",
10 | "IGoodixFingerprintDaemonExt.hal",
11 | "IGoodixFingerprintDaemonExtCallback.hal",
12 | "IGoodixFingerprintDaemonFido.hal",
13 | "IGoodixFingerprintDaemonFidoCallback.hal",
14 | "IGoodixFingerprintDaemonHbd.hal",
15 | "IGoodixFingerprintDaemonHbdCallback.hal",
16 | ],
17 | interfaces: [
18 | "android.hidl.base@1.0",
19 | ],
20 | gen_java: true,
21 | }
22 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemon.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020, 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | import IGoodixFingerprintDaemonCallback;
10 |
11 | interface IGoodixFingerprintDaemon {
12 | oneway initCallback(IGoodixFingerprintDaemonCallback callback);
13 |
14 | oneway setNotify(IGoodixFingerprintDaemonCallback Callback);
15 |
16 | testCmd(uint32_t cmdId, vec param) generates (int32_t debugErrno);
17 |
18 | sendCommand(uint32_t cmd, vec data) generates (int32_t resultCode, vec data);
19 | };
20 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020, 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | interface IGoodixFingerprintDaemonCallback {
10 | oneway onEnrollResult(uint64_t devId, uint32_t fingerId, uint32_t groupId, uint32_t rem);
11 |
12 | oneway onAcquired(uint64_t devId, uint32_t acquiredInfo);
13 |
14 | oneway onAuthenticated(uint64_t devId, uint32_t fingerId, uint32_t groupId, vec hat);
15 |
16 | oneway onError(uint64_t devId, uint32_t error);
17 |
18 | oneway onRemoved(uint64_t devId, uint32_t fingerId, uint32_t groupId);
19 |
20 | oneway onTestCmd(uint64_t devId, uint32_t cmdId, vec result);
21 |
22 | oneway onDaemonMessage(uint64_t devId, uint32_t msgId, uint32_t cmdId, vec msgData);
23 | };
24 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonExt.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | import IGoodixFingerprintDaemonExtCallback;
10 |
11 | interface IGoodixFingerprintDaemonExt {
12 | oneway initCallback(IGoodixFingerprintDaemonExtCallback callback);
13 |
14 | setSafeClass(uint32_t safeClass) generates (int32_t debugErrno);
15 |
16 | navigate(uint32_t navMode) generates (int32_t debugErrno);
17 |
18 | stopNavigation() generates (int32_t debugErrno);
19 |
20 | enableFingerprintModule(uint8_t enableFlag) generates (int32_t debugErrno);
21 |
22 | cameraCapture() generates (int32_t debugErrno);
23 |
24 | stopCameraCapture() generates (int32_t debugErrno);
25 |
26 | enableFfFeature(uint8_t enableFlag) generates (int32_t debugErrno);
27 |
28 | screenOn() generates (int32_t debugErrno);
29 |
30 | screenOff() generates (int32_t debugErrno);
31 |
32 | enumerate() generates (int32_t debugErrno);
33 |
34 | reset_lockout() generates (int32_t debugErrno);
35 |
36 | dumpCmd(uint32_t cmdId, vec param) generates (int32_t debugErrno);
37 |
38 | lockout() generates (int32_t debugErrno);
39 |
40 | pauseEnroll() generates (int32_t debugErrno);
41 |
42 | resumeEnroll() generates (int32_t debugErrno);
43 | };
44 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonExtCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | interface IGoodixFingerprintDaemonExtCallback {
10 | oneway onDump(uint64_t devId, uint32_t cmdId, vec data);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonFido.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | import IGoodixFingerprintDaemonFidoCallback;
10 |
11 | interface IGoodixFingerprintDaemonFido {
12 | oneway initCallback(IGoodixFingerprintDaemonFidoCallback callback);
13 |
14 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (int32_t debugErrno);
15 |
16 | stopAuthenticateFido() generates (int32_t debugErrno);
17 |
18 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (int32_t debugErrno);
19 |
20 | getIdList(uint32_t groupId) generates (int32_t debugErrno, vec list);
21 |
22 | invokeFidoCommand(vec in_buf) generates (int32_t out_buf_len, vec out_buf);
23 | };
24 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonFidoCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | interface IGoodixFingerprintDaemonFidoCallback {
10 | oneway onAuthenticatedFido(uint64_t devId, uint32_t fpId, vec uvtData);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonHbd.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | import IGoodixFingerprintDaemonHbdCallback;
10 |
11 | interface IGoodixFingerprintDaemonHbd {
12 | oneway initCallback(IGoodixFingerprintDaemonHbdCallback callback);
13 |
14 | startHbd() generates (int32_t debugErrno);
15 |
16 | stopHbd() generates (int32_t debugErrno);
17 |
18 | enableBioAssayFeature(uint8_t enableFlag) generates (int32_t debugErrno);
19 | };
20 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/biometrics/fingerprint/2.1/IGoodixFingerprintDaemonHbdCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.biometrics.fingerprint@2.1;
8 |
9 | interface IGoodixFingerprintDaemonHbdCallback {
10 | oneway onHbdData(uint64_t devId, uint32_t heartBeatRate, uint32_t status, vec displayData, vec rawData);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprint/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.goodix.hardware.fingerprint@1.0",
5 | root: "vendor.goodix",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IGoodixBiometricsFingerprint.hal",
9 | "IGoodixBiometricsFingerprintClientCallback.hal",
10 | ],
11 | interfaces: [
12 | "android.hidl.base@1.0",
13 | ],
14 | gen_java: true,
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprint/1.0/IGoodixBiometricsFingerprint.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.fingerprint@1.0;
8 |
9 | import IGoodixBiometricsFingerprintClientCallback;
10 |
11 | interface IGoodixBiometricsFingerprint {
12 | setSafeClass(uint32_t safeClass) generates (uint32_t retval);
13 |
14 | navigate(uint32_t navMode) generates (uint32_t retval);
15 |
16 | stopNavigation() generates (uint32_t retval);
17 |
18 | enableFingerprintModule(uint8_t enableFlag) generates (uint32_t retval);
19 |
20 | cameraCapture() generates (uint32_t retval);
21 |
22 | stopCameraCapture() generates (uint32_t retval);
23 |
24 | enableFfFeature(uint8_t enableFlag) generates (uint32_t retval);
25 |
26 | testInit(IGoodixBiometricsFingerprintClientCallback callback) generates (uint32_t retval);
27 |
28 | testCmd(uint32_t cmdId, vec param) generates (uint32_t retval);
29 |
30 | screenOn() generates (uint32_t retval);
31 |
32 | screenOff() generates (uint32_t retval);
33 |
34 | startHbd() generates (uint32_t retval);
35 |
36 | stopHbd() generates (uint32_t retval);
37 |
38 | enumerate() generates (uint32_t retval);
39 |
40 | reset_lockout(vec token) generates (uint32_t retval);
41 |
42 | enableBioAssayFeature(uint8_t enableFlag) generates (uint32_t retval);
43 |
44 | dumpCmd(uint32_t cmdId, vec param) generates (uint32_t retval);
45 |
46 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (uint32_t retval);
47 |
48 | stopAuthenticateFido() generates (uint32_t retval);
49 |
50 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (uint32_t retval);
51 |
52 | getIdList(uint32_t groupId) generates (uint32_t retval, vec list);
53 |
54 | invoke_fido_command(vec in_buf) generates (uint32_t retval, vec list);
55 | };
56 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprint/1.0/IGoodixBiometricsFingerprintClientCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2023 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.goodix.hardware.fingerprint@1.0;
8 |
9 | interface IGoodixBiometricsFingerprintClientCallback {
10 | oneway onEnrollResult(uint64_t devId, uint32_t fpId, uint32_t gpId, uint32_t rem);
11 |
12 | oneway onAcquired(uint64_t devId, uint32_t acquiredInfo);
13 |
14 | oneway onAuthenticated(uint64_t devId, uint32_t fingerId, uint32_t groupId, vec token);
15 |
16 | oneway onError(uint64_t devId, uint32_t error);
17 |
18 | oneway onRemoved(uint64_t devId, uint32_t fingerId, uint32_t groupId);
19 |
20 | oneway onTestCmd(uint64_t devId, uint32_t cmdId, vec result);
21 |
22 | oneway onHbdData(uint64_t devId, uint32_t heartBeatRate, uint32_t status, vec displayData);
23 |
24 | oneway onDump(uint64_t devId, uint32_t cmdId, vec data);
25 |
26 | oneway onAuthenticatedFido(uint64_t devId, uint32_t fpId, vec uvtData);
27 | };
28 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprintextension/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.goodix.hardware.fingerprintextension@1.0",
5 | root: "vendor.goodix",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IGoodixBiometricsFingerprint.hal",
9 | "IGoodixBiometricsFingerprintClientCallback.hal",
10 | ],
11 | interfaces: [
12 | "android.hidl.base@1.0",
13 | ],
14 | gen_java: true,
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprintextension/1.0/IGoodixBiometricsFingerprint.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 bengris32
3 | * 2024 The LineageOS Project
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package vendor.goodix.hardware.fingerprintextension@1.0;
19 |
20 | import IGoodixBiometricsFingerprintClientCallback;
21 |
22 | interface IGoodixBiometricsFingerprint {
23 | authenticateFido(uint32_t groupId, vec aaid, vec finalChallenge) generates (uint32_t ret);
24 | cameraCapture() generates (uint32_t ret);
25 | dumpCmd(uint32_t cmdId, vec param) generates (uint32_t ret);
26 | enableFfFeature(uint8_t enableFlag) generates (uint32_t ret);
27 | enableFingerprintModule(uint8_t enableFlag) generates (uint32_t ret);
28 | getIdList(uint32_t groupId) generates (uint32_t i, vec arrayList);
29 | invoke_fido_command(vec in_buf) generates (uint32_t i, vec arrayList);
30 | isIdValid(uint32_t groupId, uint32_t fingerId) generates (uint32_t ret);
31 | navigate(uint32_t navMode) generates (uint32_t ret);
32 | screenOff() generates (uint32_t ret);
33 | screenOn() generates (uint32_t ret);
34 | setSafeClass(uint32_t safeClass) generates (uint32_t ret);
35 | startHbd() generates (uint32_t ret);
36 | stopAuthenticateFido() generates (uint32_t ret);
37 | stopCameraCapture() generates (uint32_t ret);
38 | stopHbd() generates (uint32_t ret);
39 | stopNavigation() generates (uint32_t ret);
40 | testCmd(uint32_t cmdId, vec param) generates (uint32_t ret);
41 | testInit(IGoodixBiometricsFingerprintClientCallback callback) generates (uint32_t ret);
42 | };
43 |
--------------------------------------------------------------------------------
/interfaces/goodix/hardware/fingerprintextension/1.0/IGoodixBiometricsFingerprintClientCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.goodix.hardware.fingerprintextension@1.0;
18 |
19 | interface IGoodixBiometricsFingerprintClientCallback {
20 | /**
21 | * Sent when one enrollment step is complete.
22 | * @param deviceId the instance of this fingerprint device
23 | * @param fingerId the fingerprint templetate being enrolled
24 | * @param groupId the groupid for the template being enrolled
25 | * @param remaining the number of remaining steps before enrolllment is complete
26 | */
27 | oneway onEnrollResult(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, uint32_t remaining);
28 |
29 | /**
30 | * Sent when a fingerprint image is acquired by the sensor
31 | * @param deviceId the instance of this fingerprint device
32 | * @param acquiredInfo a message about the quality of the acquired image
33 | */
34 | oneway onAcquired(uint64_t deviceId, uint32_t acquiredInfo);
35 |
36 | /**
37 | * Sent when a fingerprint is authenticated
38 | * @param deviceId the instance of this fingerprint device
39 | * @param fingerId the fingerprint templetate that was authenticated
40 | * @param groupId the groupid for the template that was authenticated
41 | * @param token the hardware authentication token to pass to Keystore.addAuthToken()
42 | */
43 | oneway onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, vec token);
44 |
45 | /**
46 | * Sent when a fingerprint is authenticated for fido
47 | * @param devId the instance of this fingerprint device
48 | * @param fpId the fingerprint templetate that was authenticated
49 | * @param uvtData the uvtData
50 | */
51 | oneway onAuthenticatedFido(uint64_t devId, uint32_t fpId, vec uvtData);
52 |
53 | /**
54 | * Sent on a dump
55 | * @param devId the instance of this fingerprint device
56 | * @param cmdId the id of the command sent
57 | * @param data the dumped data
58 | */
59 | oneway onDump(int64_t devId, int32_t cmdId, vec data);
60 |
61 | /**
62 | * Sent when a fingerprint error occurs
63 | * @param deviceId the instance of this fingerprint device
64 | * @param error a message about the error that occurred
65 | */
66 | oneway onError(uint64_t deviceId, uint32_t error);
67 |
68 | /**
69 | * Sent when one template is removed
70 | * @param deviceId the instance of this fingerprint device
71 | * @param fingerId the fingerprint templetate being removed
72 | * @param groupId the groupid for the template being removed
73 | */
74 | oneway onRemoved(uint64_t deviceId, uint32_t fingerId, uint32_t groupId);
75 |
76 | /**
77 | * Sent when a test command is completed
78 | * @param deviceId the instance of this fingerprint device
79 | * @param cmdId the id of the command sent
80 | * @param result the result of the command
81 | */
82 | oneway onTestCmd(uint64_t deviceId, uint32_t cmdId, vec result);
83 |
84 | /**
85 | * Sent for hbd data
86 | * @param devId the instance of this fingerprint device
87 | * @param heartBeatRate the heart beat rate
88 | * @param data the hbd data
89 | */
90 | oneway onHbdData(uint64_t devId, uint32_t heartBeatRate, uint32_t status, vec data);
91 | };
92 |
--------------------------------------------------------------------------------
/interfaces/updates-makefiles.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source $ANDROID_BUILD_TOP/system/tools/hidl/update-makefiles-helper.sh
4 |
5 | do_makefiles_update \
6 | "vendor.goodix:hardware/xiaomi/interfaces/goodix"
7 |
8 | do_makefiles_update \
9 | "vendor.xiaomi:hardware/xiaomi/interfaces/xiaomi"
10 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/displayfeature/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.displayfeature@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "types.hal",
9 | "IDisplayFeature.hal",
10 | "IDisplayFeatureCallback.hal",
11 | ],
12 | interfaces: [
13 | "android.hidl.base@1.0",
14 | ],
15 | gen_java: true,
16 | }
17 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/displayfeature/1.0/IDisplayFeature.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.displayfeature@1.0;
18 |
19 | import @1.0::IDisplayFeatureCallback;
20 |
21 | interface IDisplayFeature {
22 | notifyBrightness(uint32_t brightness);
23 | registerCallback(uint32_t displayId, IDisplayFeatureCallback callback) generates (Status status);
24 | sendMessage(uint32_t index, uint32_t value, string cmd);
25 | sendPanelCommand(string cmd) generates (Status status);
26 | sendPostProcCommand(uint32_t cmd, uint32_t value) generates (Status status);
27 | sendRefreshCommand() generates (Status status);
28 | setFeature(uint32_t displayId, uint32_t caseId, uint32_t modeId, uint32_t cookie) generates (Status status);
29 | setFunction(uint32_t displayId, uint32_t caseId, uint32_t modeId, uint32_t cookie) generates (Status status);
30 | };
31 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/displayfeature/1.0/IDisplayFeatureCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.displayfeature@1.0;
18 |
19 | interface IDisplayFeatureCallback {
20 | oneway displayfeatureInfoChanged(uint32_t caseId, uint32_t value, float red, float green, float blue);
21 | };
22 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/displayfeature/1.0/types.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.displayfeature@1.0;
18 |
19 | // Based on observations using Ghidra, all methods that return Status
20 | // only set the result of __android_log_print and cast it to Status.
21 | enum Status : int32_t {};
22 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/fingerprintextension/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.fingerprintextension@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IXiaomiFingerprint.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | ],
13 | gen_java: true,
14 | }
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.fingerprintextension@1.0;
18 |
19 | interface IXiaomiFingerprint {
20 | extCmd(int32_t cmd, int32_t param) generates (int32_t result);
21 | };
22 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/fx/tunnel/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.fx.tunnel@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMiFxTunnel.hal",
9 | "IMiFxTunnelCallback.hal",
10 | ],
11 | interfaces: [
12 | "android.hidl.base@1.0",
13 | ],
14 | gen_java: true,
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/fx/tunnel/1.0/IMiFxTunnel.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.fx.tunnel@1.0;
8 |
9 | import @1.0::IMiFxTunnelCallback;
10 |
11 | interface IMiFxTunnel {
12 | setNotify(IMiFxTunnelCallback callback);
13 | invokeCommand(int32_t cmdId, vec params) generates (int32_t resultCode, vec out_buf);
14 | };
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/fx/tunnel/1.0/IMiFxTunnelCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.fx.tunnel@1.0;
8 |
9 | interface IMiFxTunnelCallback {
10 | onMessage(uint64_t param_1, uint32_t param_2, uint32_t param_3, vec param_4);
11 | };
12 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mfidoca/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mfidoca@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IFidoService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | ],
13 | gen_java: true,
14 | }
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mfidoca/1.0/IFidoService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2024 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mfidoca@1.0;
8 |
9 | interface IFidoService {
10 | execute(vec bArr, int32_t i) generates (vec result);
11 | fido_key_load(string str, string str2) generates (int32_t result);
12 | fido_key_get_version() generates (int32_t version);
13 | fido_key_prepare() generates (string result);
14 | };
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mlipay/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mlipay@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMlipayService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | ],
13 | gen_java: true,
14 | }
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mlipay/1.0/IMlipayService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mlipay@1.0;
8 |
9 | interface IMlipayService {
10 | invoke_command(vec sbuf, uint32_t sbuf_len) generates (vec ret);
11 | ifaa_key_get_version() generates (int32_t result);
12 | ifaa_key_prepare() generates (string hex);
13 | ifaa_key_load(string data_text, string sign_text) generates (int32_t result);
14 | ifaa_key_extract(vec buf, uint32_t buf_len) generates (int32_t result);
15 | };
16 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mlipay/1.1/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mlipay@1.1",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMlipayService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | "vendor.xiaomi.hardware.mlipay@1.0",
13 | ],
14 | gen_java: true,
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mlipay/1.1/IMlipayService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mlipay@1.1;
8 |
9 | import @1.0::IMlipayService;
10 |
11 | interface IMlipayService extends @1.0::IMlipayService {
12 | ifaa_key_dump() generates (string hex);
13 | ifaa_get_idlist(uint32_t bioType) generates (vec idList);
14 | };
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/motor/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.motor@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "types.hal",
9 | "IMotor.hal",
10 | "IMotorCallback.hal",
11 | ],
12 | interfaces: [
13 | "android.hidl.base@1.0",
14 | ],
15 | gen_java: true,
16 | }
17 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/motor/1.0/IMotor.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.motor@1.0;
18 |
19 | import vendor.xiaomi.hardware.motor@1.0::IMotorCallback;
20 |
21 | interface IMotor {
22 | popupMotor(int32_t cookie);
23 | takebackMotor(int32_t cookie);
24 | setMotorCallback(IMotorCallback motorcallback);
25 | init();
26 | release();
27 | getMotorStatus() generates (int32_t result);
28 | calibration();
29 | takebackMotorShortly();
30 | };
31 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/motor/1.0/IMotorCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.motor@1.0;
18 |
19 | interface IMotorCallback {
20 | oneway onNotify(MotorEvent event);
21 | };
22 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/motor/1.0/types.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2020 The LineageOS Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.xiaomi.hardware.motor@1.0;
18 |
19 | struct MotorEvent {
20 | int32_t vaalue;
21 | int32_t cookie;
22 | };
23 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.0/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mtdservice@1.0",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMTService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | ],
13 | gen_java: true,
14 | }
15 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.0/IMTService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mtdservice@1.0;
8 |
9 | interface IMTService {
10 | getFid() generates (string fid);
11 | eccSign(uint32_t keyType, string text) generates (string signData);
12 | reload(string text, string sign) generates (int32_t result);
13 | enroll(string appname, int32_t enrollType) generates (string enrolldata);
14 | ifaa_key_get_version() generates (int32_t result);
15 | ifaa_key_prepare() generates (string ret);
16 | ifaa_key_load(string data_text, string sign_text) generates (int32_t result);
17 | fido_key_get_version() generates (int32_t result);
18 | fido_key_prepare() generates (string ret);
19 | fido_key_load(string data_text, string sign_text) generates (int32_t result);
20 | soter_generate() generates (string ret);
21 | soter_get_state() generates (int32_t result);
22 | soter_set_state(int32_t state);
23 | };
24 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.1/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mtdservice@1.1",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMTService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | "vendor.xiaomi.hardware.mtdservice@1.0",
13 | ],
14 | gen_java: true,
15 | }
16 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.1/IMTService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mtdservice@1.1;
8 |
9 | import @1.0::IMTService;
10 |
11 | interface IMTService extends @1.0::IMTService {
12 | persist_read(int32_t dir_id, string file_name) generates (int32_t ret, vec rbuf);
13 | persist_write(int32_t dir_id, string file_name, vec sbuf, uint32_t sbuf_len) generates (int32_t ret);
14 | persist_remove(int32_t dir_id, string file_name) generates (int32_t ret);
15 | ifaa_key_dump() generates (string ret);
16 | };
17 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.2/Android.bp:
--------------------------------------------------------------------------------
1 | // This file is autogenerated by hidl-gen -Landroidbp.
2 |
3 | hidl_interface {
4 | name: "vendor.xiaomi.hardware.mtdservice@1.2",
5 | root: "vendor.xiaomi",
6 | system_ext_specific: true,
7 | srcs: [
8 | "IMTService.hal",
9 | ],
10 | interfaces: [
11 | "android.hidl.base@1.0",
12 | "vendor.xiaomi.hardware.mtdservice@1.0",
13 | "vendor.xiaomi.hardware.mtdservice@1.1",
14 | ],
15 | gen_java: true,
16 | }
17 |
--------------------------------------------------------------------------------
/interfaces/xiaomi/hardware/mtdservice/1.2/IMTService.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2022 The LineageOS Project
3 | *
4 | * SPDX-License-Identifier: Apache-2.0
5 | */
6 |
7 | package vendor.xiaomi.hardware.mtdservice@1.2;
8 |
9 | import @1.1::IMTService;
10 |
11 | interface IMTService extends @1.1::IMTService {
12 | widevine_get_version() generates (int32_t ret);
13 | widevine_prepare() generates (string ret);
14 | widevine_load(string data_text, string sign_text) generates (int32_t ret);
15 | widevine_dump() generates (string ret);
16 | runExternalCmd(int32_t taType, vec ta, uint32_t cmdId, vec data) generates (int32_t ret, vec rsp);
17 | installTa(int32_t taType, vec ta, vec ta_buf) generates (int32_t ret);
18 | unInstallTa(int32_t taType, vec ta) generates (int32_t ret);
19 | loadTa(int32_t taType, vec ta) generates (int32_t ret);
20 | runTaCmd(int32_t taType, vec ta, vec data) generates (int32_t ret, vec rsp);
21 | unloadTa(int32_t taType, vec ta) generates (int32_t ret);
22 | checkPermission(vec packageName, vec