• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Virtual Face HAL
2
3This is a virtual HAL implementation that is backed by system properties
4instead of actual hardware. It's intended for testing and UI development
5on debuggable builds to allow devices to masquerade as alternative device
6types and for emulators.
7
8## Device Selection
9
10You can either run the FakeFaceEngine on a [real device](#actual-device) or a [virtual device/cuttlefish](#getting-started-on-a-virtual-device-cuttlefish). This document should
11help you to get started on either one.
12
13After setting up a device, go ahead and try out [enrolling](#enrolling) & [authenticating](#authenticating)
14
15### Getting started on a Virtual Device (cuttlefish)
16
17
18Note, I'm running this via a cloudtop virtual device.
19
201. Setup cuttlefish on cloudtop, See [this](https://g3doc.corp.google.com/company/teams/android/teampages/acloud/getting_started.md?cl=head) for more details.
212. acloud create --local-image
223. Enter in the shell command to disable hidl
23
24```shell
25$ adb root
26$ adb shell settings put secure com.android.server.biometrics.AuthService.hidlDisabled 1
27$ adb reboot
28```
294. You should now be able to do fake enrollments and authentications (as seen down below)
30
31### Actual Device
32
331. Modify your real devices make file (I.E. vendor/google/products/{YOUR_DEVICE}.mk)
342. Ensure that there is no other face HAL that is being included by the device
353. Add the following
36```
37PRODUCT_COPY_FILES += \
38    frameworks/native/data/etc/android.hardware.biometrics.face.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/android.hardware.biometrics.face.xml
39
40PRODUCT_PACKAGES += \
41    android.hardware.biometrics.face-service.example \
42
43```
444. Now build and flash m -j120 && flash
455. Run the following commands
46
47```shell
48# This is a temporary workaround
49$ adb root
50$ adb shell setprop persist.vendor.face.virtual.type RGB
51$ adb shell setprop persist.vendor.face.virtual.strength strong
52$ adb shell locksettings set-pin 0000
53$ adb reboot
54```
55
56## Enrolling
57
58```shell
59# authenticar_id,bucket_id:duration:(true|false)....
60$ adb shell setprop vendor.face.virtual.next_enrollment 1,0:500:true,5:250:true,10:150:true,15:500:true
61$ adb shell am start -n com.android.settings/.biometrics.face.FaceEnrollIntroduction
62# If you would like to get rid of the enrollment, run the follwoing command
63$ adb shell setprop persist.vendor.face.virtual.enrollments \"\"
64```
65
66## Authenticating
67
68```shell
69# If enrollment hasn't been setup
70$ adb shell setprop persist.vendor.face.virtual.enrollments 1
71$ adb shell cmd face sync
72# After enrollment has been setup
73$ adb shell setprop vendor.face.virtual.operation_authenticate_duration 800
74$ adb shell setprop vendor.face.virtual.enrollment_hit 1
75# Power button press to simulate auth
76$ adb shell input keyevent 26
77```
78