Loading biometrics/fingerprint/aidl/default/Android.bp +2 −2 Original line number Diff line number Diff line Loading @@ -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", Loading biometrics/fingerprint/aidl/default/README.md +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 Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading biometrics/fingerprint/aidl/default/fingerprint-default.rc→biometrics/fingerprint/aidl/default/fingerprint-example.rc +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 biometrics/fingerprint/aidl/default/fingerprint-default.xml→biometrics/fingerprint/aidl/default/fingerprint-example.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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> biometrics/fingerprint/aidl/default/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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 Loading
biometrics/fingerprint/aidl/default/Android.bp +2 −2 Original line number Diff line number Diff line Loading @@ -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", Loading
biometrics/fingerprint/aidl/default/README.md +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 Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading
biometrics/fingerprint/aidl/default/fingerprint-default.rc→biometrics/fingerprint/aidl/default/fingerprint-example.rc +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
biometrics/fingerprint/aidl/default/fingerprint-default.xml→biometrics/fingerprint/aidl/default/fingerprint-example.xml +1 −1 Original line number Diff line number Diff line Loading @@ -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>
biometrics/fingerprint/aidl/default/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -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