Add virtual fingerprint HAL APEX

This moves the virtual fingerprint HAL into a vendor apex:
  com.android.hardware.biometrics.fingerprint.virtual.

Bug: 279674662
Test: follow README.md to test the virtual FP HAL
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7af7ad0c8770e13c3b77abe81c2ba48a2927b531)
Merged-In: I4664a3805b9444c87b0ac31a84ec10fb47d9580e
Change-Id: I4664a3805b9444c87b0ac31a84ec10fb47d9580e
This commit is contained in:
Jooyung Han 2023-05-10 17:05:00 +09:00 committed by Cherrypicker Worker
parent c01432b259
commit 580e81b0be
9 changed files with 185 additions and 2 deletions

View file

@ -11,8 +11,8 @@ cc_binary {
name: "android.hardware.biometrics.fingerprint-service.example",
vendor: true,
relative_install_path: "hw",
init_rc: ["fingerprint-example.rc"],
vintf_fragments: ["fingerprint-example.xml"],
init_rc: [":fingerprint-example.rc"],
vintf_fragments: [":fingerprint-example.xml"],
local_include_dirs: ["include"],
srcs: [
"FakeLockoutTracker.cpp",
@ -142,3 +142,13 @@ sysprop_library {
property_owner: "Vendor",
vendor: true,
}
filegroup {
name: "fingerprint-example.rc",
srcs: ["fingerprint-example.rc"],
}
filegroup {
name: "fingerprint-example.xml",
srcs: ["fingerprint-example.xml"],
}

View file

@ -14,6 +14,12 @@ following to your device's `.mk` file to include it:
PRODUCT_PACKAGES_DEBUG += android.hardware.biometrics.fingerprint-service.example
```
or add the following to include it as an apex:
```
PRODUCT_PACKAGES_DEBUG += com.android.hardware.biometrics.fingerprint.virtual
```
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.

View file

@ -0,0 +1,73 @@
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
apex_key {
name: "com.android.hardware.biometrics.fingerprint.virtual.key",
public_key: "com.android.hardware.biometrics.fingerprint.virtual.avbpubkey",
private_key: "com.android.hardware.biometrics.fingerprint.virtual.pem",
}
android_app_certificate {
name: "com.android.hardware.biometrics.fingerprint.virtual.certificate",
certificate: "com.android.hardware.biometrics.fingerprint.virtual",
}
apex {
name: "com.android.hardware.biometrics.fingerprint.virtual",
manifest: "manifest.json",
file_contexts: "file_contexts",
key: "com.android.hardware.biometrics.fingerprint.virtual.key",
certificate: ":com.android.hardware.biometrics.fingerprint.virtual.certificate",
updatable: false,
use_vndk_as_stable: true,
vendor: true,
binaries: [
"android.hardware.biometrics.fingerprint-service.example",
],
prebuilts: [
// init_rc
"fingerprint-example-apex.rc",
// vintf_fragment
"fingerprint-example-apex.xml",
],
overrides: [
"android.hardware.biometrics.fingerprint-service.example",
],
}
genrule {
name: "gen-fingerprint-example-apex.rc",
srcs: [":fingerprint-example.rc"],
out: ["fingerprint-example-apex.rc"],
cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.biometrics.fingerprint.virtual/bin/@' $(in) > $(out)",
}
prebuilt_etc {
name: "fingerprint-example-apex.rc",
src: ":gen-fingerprint-example-apex.rc",
installable: false,
}
prebuilt_etc {
name: "fingerprint-example-apex.xml",
src: ":fingerprint-example.xml",
sub_dir: "vintf",
installable: false,
}

View file

@ -0,0 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDwo6CxzAwmX46C
N1j8zr0qf6uy1rDkG5r1s4faDNX/ThYpd69DWbVGf22yFO3KY3B+TmqKU+B0SiqY
MHQjXc+UcTa0BKtPtQNSYFLK13/1rW69QrlLtcGyAp/CwksXYuuJ8Uzs28nQ5A+z
fh6Vfsla9tUWDe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DCUnDjOVji7nXDloSmK+MDD/DaDQ47PoYE3hBqc0fsRr2aIlvMOvb
m+4VhO85gCuJAK02XuixLPo6ZqBAEFNwQ4NDcuOHuODaaJ/amTxQBXRpNXUSnhXy
ejpwspHrAgMBAAEwDQYJKoZIhvcNAQELBQADggIBAGl3KGKMAWpefnRSQWs0n8kD
eKYbzbe6mG0O5lqx5FKpJZpIki4RH1Yh5ZDR/NIeF2RNhlb/dqo99TKbCEGAoMB9
R7EXDhyMcEXr5ATCA6iurhMKgkcLfOz6HkTI6k3wlPNuvx4iZGHD2KEvZiZGmae1
dnK9iVtNs6ccyC0+V3y3Yt1fvjzp9SWcPpBXiO5QNf0sHxtzc32xXsBH0aLwLjDZ
BCytwfEvq2S25v0r9m0fKquDBoFnk68cqClpNQZ9Ky0k8fGgOiQ5/jnVmgPmTheG
mBcdPeUrhxGNs1vax/i/ysT4AVmDzIVW0uXVouhVeMQzykuy1+Ywa/Rn0jLxeNF2
X3ooOE+EF8u9Pxf8ILRnfqok3VRuYLH6neNknTSKTx1aQAh9XbBpTUa/eCq3LDCP
L6hSXYWjk9e5txbn0cNw9WuKMUg+Z9Qms3aVRFcvBxZQySEvf8FhgSrQbqbCbzhf
dI0/ouW5w9iHUOh/FDvfETeZCeeTS+EOvGOqknzO8Y7PiChlgFsoMvC1GpHZ1ADy
3xKSh15G92JCiv89CK2VvM8QDFh8ErQmSLjhMl700CLYis+AAZhCKOhAo573zj2u
dZf29S+o3SEBhsl5snVGJW13Bu7BjxQtscCwKOv0g1cCkrqgcm2bMuNhpTK7rhMP
i4hGSvbdGC27BtXbsiVX
-----END CERTIFICATE-----

View file

@ -0,0 +1,3 @@
(/.*)? u:object_r:vendor_file:s0
/etc(/.*)? u:object_r:vendor_configs_file:s0
/bin/hw/android\.hardware\.biometrics\.fingerprint-service\.example u:object_r:hal_fingerprint_default_exec:s0

View file

@ -0,0 +1,4 @@
{
"name": "com.android.hardware.biometrics.fingerprint.virtual",
"version": 1
}