Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 938c07ce authored by Joe Bolinger's avatar Joe Bolinger Committed by Android (Google) Code Review
Browse files

Merge "Declare example HAL as virtual instance."

parents 877d8c6e 3041e526
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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",
+35 −21
Original line number Diff line number Diff line
# 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,8 +37,8 @@ $ 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

@@ -34,7 +47,8 @@ the UI, or via adb.
      ```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.
2. Navigate to `Settings -> Security -> Fingerprint Unlock` and follow the
   prompts.
3. Verify the enrollments in the UI:

      ```shell
@@ -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 −2
Original line number Diff line number Diff line
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
+1 −1
Original line number Diff line number Diff line
@@ -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>
+1 −1
Original line number Diff line number Diff line
@@ -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);

Loading