mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 10:44:41 +00:00
Merge "Declare example HAL as virtual instance."
This commit is contained in:
@@ -11,8 +11,8 @@ cc_binary {
|
||||
name: "android.hardware.biometrics.fingerprint-service.example",
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
init_rc: ["fingerprint-default.rc"],
|
||||
vintf_fragments: ["fingerprint-default.xml"],
|
||||
init_rc: ["fingerprint-example.rc"],
|
||||
vintf_fragments: ["fingerprint-example.xml"],
|
||||
local_include_dirs: ["include"],
|
||||
srcs: [
|
||||
"CancellationSignal.cpp",
|
||||
|
||||
@@ -1,17 +1,30 @@
|
||||
# Virtual Fingerprint HAL
|
||||
|
||||
This is a virtual HAL implementation that is backed by system properties
|
||||
instead of actual hardware. It's intended for testing and UI development
|
||||
on debuggable builds to allow devices to masquerade as alternative device
|
||||
types and for emulators.
|
||||
This is a virtual HAL implementation that is backed by system properties instead
|
||||
of actual hardware. It's intended for testing and UI development on debuggable
|
||||
builds to allow devices to masquerade as alternative device types and for
|
||||
emulators.
|
||||
|
||||
## Supported Devices
|
||||
|
||||
This HAL can be used on emulators, like cuttlefish, or on real devices. Add the
|
||||
following to your device's `.mk` file to include it:
|
||||
|
||||
```
|
||||
PRODUCT_PACKAGES_DEBUG += android.hardware.biometrics.fingerprint-service.example
|
||||
```
|
||||
|
||||
The virtual HAL will be ignored if a real HAL is also installed on the target
|
||||
device. Set the `biometric_virtual_enabled` settings and reboot the device to
|
||||
switch to the virtual HAL. Unset it and reboot again to switch back.
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, set the type of sensor the device should use, enable the virtual
|
||||
extensions in the framework, and reboot.
|
||||
|
||||
This doesn't work with HIDL and you typically need to have a PIN or password
|
||||
set for things to work correctly, so this is a good time to set those too.
|
||||
This doesn't work with HIDL and you typically need to have a PIN or password set
|
||||
for things to work correctly, so this is a good time to set those too.
|
||||
|
||||
```shell
|
||||
$ adb root
|
||||
@@ -24,22 +37,23 @@ $ adb reboot
|
||||
|
||||
### Enrollments
|
||||
|
||||
Next, setup enrollments on the device. This can either be done through
|
||||
the UI, or via adb.
|
||||
Next, setup enrollments on the device. This can either be done through the UI,
|
||||
or via adb.
|
||||
|
||||
#### UI Enrollment
|
||||
|
||||
1. Tee up the results of the enrollment before starting the process:
|
||||
1. Tee up the results of the enrollment before starting the process:
|
||||
|
||||
```shell
|
||||
$ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true
|
||||
```
|
||||
2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the prompts.
|
||||
3. Verify the enrollments in the UI:
|
||||
```shell
|
||||
$ adb shell setprop vendor.fingerprint.virtual.next_enrollment 1:100,100,100:true
|
||||
```
|
||||
2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the
|
||||
prompts.
|
||||
3. Verify the enrollments in the UI:
|
||||
|
||||
```shell
|
||||
$ adb shell getprop persist.vendor.fingerprint.virtual.enrollments
|
||||
```
|
||||
```shell
|
||||
$ adb shell getprop persist.vendor.fingerprint.virtual.enrollments
|
||||
```
|
||||
|
||||
#### Direct Enrollment
|
||||
|
||||
@@ -51,10 +65,10 @@ $ adb shell setprop persist.vendor.fingerprint.virtual.enrollments 1
|
||||
$ adb shell cmd fingerprint sync
|
||||
```
|
||||
|
||||
Note: You may need to do this twice. The templates are checked
|
||||
as part of some lazy operations, like user switching and startup, which can
|
||||
cause the framework to delete the enrollments before the sync operation runs.
|
||||
Until this is fixed, just run the commands twice as a workaround.
|
||||
**Note: You may need to do this twice.** The templates are checked as part of
|
||||
some lazy operations, like user switching and startup, which can cause the
|
||||
framework to delete the enrollments before the sync operation runs. Until this
|
||||
is fixed, just run the commands twice as a workaround.
|
||||
|
||||
### Authenticate
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example
|
||||
service vendor.fingerprint-example /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.example
|
||||
class hal
|
||||
user nobody
|
||||
group nobody
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<hal format="aidl">
|
||||
<name>android.hardware.biometrics.fingerprint</name>
|
||||
<version>2</version>
|
||||
<fqname>IFingerprint/default</fqname>
|
||||
<fqname>IFingerprint/virtual</fqname>
|
||||
</hal>
|
||||
</manifest>
|
||||
@@ -27,7 +27,7 @@ int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
||||
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
|
||||
|
||||
const std::string instance = std::string(Fingerprint::descriptor) + "/default";
|
||||
const std::string instance = std::string(Fingerprint::descriptor) + "/virtual";
|
||||
binder_status_t status = AServiceManager_addService(hal->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@
|
||||
<interface>
|
||||
<name>IFingerprint</name>
|
||||
<instance>default</instance>
|
||||
<instance>virtual</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="hidl" optional="true">
|
||||
|
||||
Reference in New Issue
Block a user