From e0263c404aaae9510dfe7d690da82ad2eaa04d65 Mon Sep 17 00:00:00 2001 From: Jeff Pu Date: Wed, 17 Jul 2024 12:33:29 -0400 Subject: [PATCH] Bind Fingerprint Virutal HAL with IVirtual interface Bug: 326227403 Test: atest CtsBiometricsTestCases -c Ignore-AOSP-First: CLs of other related projects needs this CL to run presubmit tests Change-Id: I295925d7c26235dc66c7c9481d08661095c8dc92 --- biometrics/common/aidl/Android.bp | 6 + biometrics/common/config/Android.bp | 6 +- biometrics/common/thread/Android.bp | 6 +- biometrics/common/util/Android.bp | 6 +- biometrics/fingerprint/aidl/Android.bp | 37 +++- .../AcquiredInfoAndVendorCode.aidl | 40 ---- .../fingerprint/EnrollmentProgressStep.aidl | 40 ---- .../biometrics/fingerprint/IVirtualHal.aidl | 70 ------- .../fingerprint/NextEnrollment.aidl | 41 ---- .../AcquiredInfoAndVendorCode.aidl | 3 +- .../EnrollmentProgressStep.aidl | 5 +- .../{ => virtualhal}/IVirtualHal.aidl | 11 +- .../{ => virtualhal}/NextEnrollment.aidl | 7 +- .../fingerprint/virtualhal/README.md | 2 + .../fingerprint/aidl/default/Android.bp | 112 +++++++---- .../fingerprint/aidl/default/VirtualHal.cpp | 11 +- ...trics.fingerprint.VirtualProps-current.txt | 178 ++++++++++++++++++ .../aidl/default/fingerprint-default.rc | 7 + ...nt-example.xml => fingerprint-default.xml} | 7 +- .../aidl/default/fingerprint-example.rc | 7 - .../aidl/default/fingerprint-virtual.rc | 7 + .../aidl/default/fingerprint.sysprop | 60 +++--- .../aidl/default/include/VirtualHal.h | 15 +- biometrics/fingerprint/aidl/default/main.cpp | 39 ++-- .../aidl/default/tests/VirtualHalTest.cpp | 2 +- biometrics/fingerprint/aidl/vts/Android.bp | 4 +- .../exclude/fcm_exclude.cpp | 1 + keymaster/aidl/Android.bp | 6 + 28 files changed, 434 insertions(+), 302 deletions(-) delete mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl delete mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl delete mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl delete mode 100644 biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl rename biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/{ => virtualhal}/AcquiredInfoAndVendorCode.aidl (93%) rename biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/{ => virtualhal}/EnrollmentProgressStep.aidl (87%) rename biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/{ => virtualhal}/IVirtualHal.aidl (97%) rename biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/{ => virtualhal}/NextEnrollment.aidl (85%) create mode 100644 biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md create mode 100644 biometrics/fingerprint/aidl/default/fingerprint-default.rc rename biometrics/fingerprint/aidl/default/{fingerprint-example.xml => fingerprint-default.xml} (50%) delete mode 100644 biometrics/fingerprint/aidl/default/fingerprint-example.rc create mode 100644 biometrics/fingerprint/aidl/default/fingerprint-virtual.rc diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp index 246bcf2a40..854bd4a9a8 100644 --- a/biometrics/common/aidl/Android.bp +++ b/biometrics/common/aidl/Android.bp @@ -22,6 +22,12 @@ aidl_interface { cpp: { enabled: false, }, + ndk: { + apex_available: [ + "//apex_available:anyapex", + "//apex_available:platform", + ], + }, }, versions_with_info: [ { diff --git a/biometrics/common/config/Android.bp b/biometrics/common/config/Android.bp index d38ffe861c..b86aafa513 100644 --- a/biometrics/common/config/Android.bp +++ b/biometrics/common/config/Android.bp @@ -22,7 +22,7 @@ cc_library { // SPDX-license-identifier-Apache-2.0 name: "android.hardware.biometrics.common.config", export_include_dirs: ["include"], - vendor: true, + vendor_available: true, srcs: [ "Config.cpp", ], @@ -30,6 +30,10 @@ cc_library { "libbase", "libbinder_ndk", ], + apex_available: [ + "//apex_available:anyapex", + "//apex_available:platform", + ], } cc_test_host { diff --git a/biometrics/common/thread/Android.bp b/biometrics/common/thread/Android.bp index e7a7e4c98a..c1ebe3b155 100644 --- a/biometrics/common/thread/Android.bp +++ b/biometrics/common/thread/Android.bp @@ -10,10 +10,14 @@ cc_library { // SPDX-license-identifier-Apache-2.0 name: "android.hardware.biometrics.common.thread", export_include_dirs: ["include"], - vendor: true, + vendor_available: true, srcs: [ "WorkerThread.cpp", ], + apex_available: [ + "//apex_available:anyapex", + "//apex_available:platform", + ], } cc_test_host { diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp index 599c491772..a0bd211b87 100644 --- a/biometrics/common/util/Android.bp +++ b/biometrics/common/util/Android.bp @@ -6,7 +6,7 @@ cc_library { // SPDX-license-identifier-Apache-2.0 name: "android.hardware.biometrics.common.util", export_include_dirs: ["include"], - vendor: true, + vendor_available: true, srcs: [ "CancellationSignal.cpp", ], @@ -15,4 +15,8 @@ cc_library { "libbinder_ndk", "android.hardware.biometrics.common-V4-ndk", ], + apex_available: [ + "//apex_available:anyapex", + "//apex_available:platform", + ], } diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp index a395c01c14..c5b99373f9 100644 --- a/biometrics/fingerprint/aidl/Android.bp +++ b/biometrics/fingerprint/aidl/Android.bp @@ -11,7 +11,7 @@ aidl_interface { name: "android.hardware.biometrics.fingerprint", vendor_available: true, srcs: [ - "android/hardware/biometrics/fingerprint/**/*.aidl", + "android/hardware/biometrics/fingerprint/*.aidl", ], imports: [ "android.hardware.biometrics.common-V4", @@ -25,6 +25,12 @@ aidl_interface { cpp: { enabled: false, }, + ndk: { + apex_available: [ + "//apex_available:platform", + "//apex_available:anyapex", + ], + }, }, versions_with_info: [ { @@ -57,5 +63,34 @@ aidl_interface { }, ], + frozen: true, +} + +aidl_interface { + name: "android.hardware.biometrics.fingerprint.virtualhal", + srcs: [ + "android/hardware/biometrics/fingerprint/virtualhal/*.aidl", + ], + imports: [ + "android.hardware.biometrics.common-V4", + "android.hardware.keymaster-V4", + "android.hardware.biometrics.fingerprint-V4", + ], + vendor_available: true, + unstable: true, + backend: { + java: { + platform_apis: true, + }, + cpp: { + enabled: false, + }, + ndk: { + apex_available: [ + "com.android.hardware.biometrics.fingerprint.virtual", + "//apex_available:platform", + ], + }, + }, frozen: false, } diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl deleted file mode 100644 index c1dc51c21d..0000000000 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m -update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.hardware.biometrics.fingerprint; -/* @hide */ -@VintfStability -union AcquiredInfoAndVendorCode { - android.hardware.biometrics.fingerprint.AcquiredInfo acquiredInfo = android.hardware.biometrics.fingerprint.AcquiredInfo.UNKNOWN; - int vendorCode; -} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl deleted file mode 100644 index 173ac1706d..0000000000 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m -update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.hardware.biometrics.fingerprint; -/* @hide */ -@VintfStability -parcelable EnrollmentProgressStep { - int durationMs; - android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquiredInfoAndVendorCodes; -} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl deleted file mode 100644 index 33ae83c340..0000000000 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m -update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.hardware.biometrics.fingerprint; -/* @hide */ -@VintfStability -interface IVirtualHal { - oneway void setEnrollments(in int[] id); - oneway void setEnrollmentHit(in int hit_id); - oneway void setNextEnrollment(in android.hardware.biometrics.fingerprint.NextEnrollment next_enrollment); - oneway void setAuthenticatorId(in long id); - oneway void setChallenge(in long challenge); - oneway void setOperationAuthenticateFails(in boolean fail); - oneway void setOperationAuthenticateLatency(in int[] latencyMs); - oneway void setOperationAuthenticateDuration(in int durationMs); - oneway void setOperationAuthenticateError(in int error); - oneway void setOperationAuthenticateAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired); - oneway void setOperationEnrollError(in int error); - oneway void setOperationEnrollLatency(in int[] latencyMs); - oneway void setOperationDetectInteractionLatency(in int[] latencyMs); - oneway void setOperationDetectInteractionError(in int error); - oneway void setOperationDetectInteractionDuration(in int durationMs); - oneway void setOperationDetectInteractionAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired); - oneway void setLockout(in boolean lockout); - oneway void setLockoutEnable(in boolean enable); - oneway void setLockoutTimedThreshold(in int threshold); - oneway void setLockoutTimedDuration(in int durationMs); - oneway void setLockoutPermanentThreshold(in int threshold); - oneway void resetConfigurations(); - oneway void setType(in android.hardware.biometrics.fingerprint.FingerprintSensorType type); - oneway void setSensorId(in int id); - oneway void setSensorStrength(in android.hardware.biometrics.common.SensorStrength strength); - oneway void setMaxEnrollmentPerUser(in int max); - oneway void setSensorLocation(in android.hardware.biometrics.fingerprint.SensorLocation loc); - oneway void setNavigationGuesture(in boolean v); - oneway void setDetectInteraction(in boolean v); - oneway void setDisplayTouch(in boolean v); - oneway void setControlIllumination(in boolean v); - const int STATUS_INVALID_PARAMETER = 1; -} diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl deleted file mode 100644 index 75ed0700be..0000000000 --- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ -/////////////////////////////////////////////////////////////////////////////// -// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. // -/////////////////////////////////////////////////////////////////////////////// - -// This file is a snapshot of an AIDL file. Do not edit it manually. There are -// two cases: -// 1). this is a frozen version file - do not edit this in any case. -// 2). this is a 'current' file. If you make a backwards compatible change to -// the interface (from the latest frozen version), the build system will -// prompt you to update this file with `m -update-api`. -// -// You must not make a backward incompatible change to any AIDL file built -// with the aidl_interface module type with versions property set. The module -// type is used to build AIDL files in a way that they can be used across -// independently updatable components of the system. If a device is shipped -// with such a backward incompatible change, it has a high risk of breaking -// later when a module using the interface is updated, e.g., Mainline modules. - -package android.hardware.biometrics.fingerprint; -/* @hide */ -@VintfStability -parcelable NextEnrollment { - int id; - android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps; - boolean result = true; -} diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl similarity index 93% rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl index c7be950b8b..1fc72219fe 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl @@ -14,14 +14,13 @@ * limitations under the License. */ -package android.hardware.biometrics.fingerprint; +package android.hardware.biometrics.fingerprint.virtualhal; import android.hardware.biometrics.fingerprint.AcquiredInfo; /** * @hide */ -@VintfStability union AcquiredInfoAndVendorCode { /** * Acquired info as specified in AcqauiredInfo.aidl diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl similarity index 87% rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl index bf038f6fb6..b0b2926f6b 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl @@ -14,14 +14,13 @@ * limitations under the License. */ -package android.hardware.biometrics.fingerprint; +package android.hardware.biometrics.fingerprint.virtualhal; -import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode; +import android.hardware.biometrics.fingerprint.virtualhal.AcquiredInfoAndVendorCode; /** * @hide */ -@VintfStability parcelable EnrollmentProgressStep { /** * The duration of the enrollment step in milli-seconds diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl similarity index 97% rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl index cb9135e6ab..5af84ed9b1 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl @@ -14,19 +14,19 @@ * limitations under the License. */ -package android.hardware.biometrics.fingerprint; +package android.hardware.biometrics.fingerprint.virtualhal; import android.hardware.biometrics.common.SensorStrength; -import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode; import android.hardware.biometrics.fingerprint.FingerprintSensorType; -import android.hardware.biometrics.fingerprint.NextEnrollment; +import android.hardware.biometrics.fingerprint.IFingerprint; import android.hardware.biometrics.fingerprint.SensorLocation; +import android.hardware.biometrics.fingerprint.virtualhal.AcquiredInfoAndVendorCode; +import android.hardware.biometrics.fingerprint.virtualhal.NextEnrollment; /** * @hide */ -@VintfStability -oneway interface IVirtualHal { +interface IVirtualHal { /** * The operation failed due to invalid input parameters, the error messages should * gives more details @@ -315,4 +315,5 @@ oneway interface IVirtualHal { void setDetectInteraction(in boolean v); void setDisplayTouch(in boolean v); void setControlIllumination(in boolean v); + IFingerprint getFingerprintHal(); } diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl similarity index 85% rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl index 4b50850696..2d704f1166 100644 --- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl @@ -14,12 +14,13 @@ * limitations under the License. */ -package android.hardware.biometrics.fingerprint; +package android.hardware.biometrics.fingerprint.virtualhal; + +import android.hardware.biometrics.fingerprint.virtualhal.EnrollmentProgressStep; /** * @hide */ -@VintfStability parcelable NextEnrollment { /** * Identifier of the next enrollment if successful @@ -31,7 +32,7 @@ parcelable NextEnrollment { * and sequence of acquired info codes to be generated by HAL. * See EnrollmentProgressStep.aidl for more details */ - android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps; + EnrollmentProgressStep[] progressSteps; /** * Success or failure of the next enrollment diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md new file mode 100644 index 0000000000..eaf23363bb --- /dev/null +++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md @@ -0,0 +1,2 @@ +The aidl files in this directory are used only by fingerprint virtual hal +which is controlled/configured via IVirtualHal interface diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp index 9b72c872c9..faaa9c63fd 100644 --- a/biometrics/fingerprint/aidl/default/Android.bp +++ b/biometrics/fingerprint/aidl/default/Android.bp @@ -8,10 +8,9 @@ package { default_applicable_licenses: ["hardware_interfaces_license"], } -cc_binary { - name: "android.hardware.biometrics.fingerprint-service.example", - vendor: true, - relative_install_path: "hw", +cc_library_static { + name: "android.hardware.biometrics.fingerprint-service.lib", + vendor_available: true, local_include_dirs: ["include"], srcs: [ "FakeLockoutTracker.cpp", @@ -30,22 +29,80 @@ cc_binary { "libbinder_ndk", "liblog", ], - static_libs: [ + whole_static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", "libbase", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint.virtualhal-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.util", "android.hardware.biometrics.common.config", "android.hardware.keymaster-V4-ndk", ], + product_variables: { + debuggable: { + cflags: ["-DFPS_DEBUGGABLE"], + }, + }, + apex_available: [ + "com.android.hardware.biometrics.fingerprint.virtual", + "//apex_available:platform", + ], +} + +cc_binary { + name: "android.hardware.biometrics.fingerprint-service.example", + system_ext_specific: true, + relative_install_path: "hw", + local_include_dirs: ["include"], + srcs: [ + ], + stl: "c++_static", + shared_libs: [ + "libbinder_ndk", + "liblog", + ], + whole_static_libs: [ + "android.hardware.biometrics.fingerprint-service.lib", + ], installable: false, // install APEX instead product_variables: { debuggable: { cflags: ["-DFPS_DEBUGGABLE"], }, }, + apex_available: [ + "com.android.hardware.biometrics.fingerprint.virtual", + ], +} + +cc_binary { + name: "android.hardware.biometrics.fingerprint-service.default", + //system_ext_specific: true, + vendor: true, + relative_install_path: "hw", + init_rc: ["fingerprint-default.rc"], + vintf_fragments: ["fingerprint-default.xml"], + local_include_dirs: ["include"], + srcs: [ + ], + stl: "c++_static", + shared_libs: [ + "libbinder_ndk", + "liblog", + ], + whole_static_libs: [ + "android.hardware.biometrics.fingerprint-service.lib", + ], + product_variables: { + debuggable: { + cflags: ["-DFPS_DEBUGGABLE"], + }, + }, + apex_available: [ + "//apex_available:platform", + ], } cc_test { @@ -63,14 +120,13 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", "android.hardware.biometrics.common.config", "android.hardware.biometrics.common.thread", ], - vendor: true, test_suites: ["general-tests"], require_root: true, } @@ -91,14 +147,13 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", "android.hardware.biometrics.common.config", "android.hardware.biometrics.common.thread", ], - vendor: true, test_suites: ["general-tests"], require_root: true, } @@ -117,14 +172,13 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.config", ], - vendor: true, test_suites: ["general-tests"], require_root: true, } @@ -145,14 +199,13 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", "android.hardware.biometrics.common.thread", "android.hardware.biometrics.common.config", ], - vendor: true, test_suites: ["general-tests"], require_root: true, } @@ -178,7 +231,8 @@ cc_test { ], static_libs: [ "libandroid.hardware.biometrics.fingerprint.VirtualProps", - "android.hardware.biometrics.fingerprint-V5-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", + "android.hardware.biometrics.fingerprint.virtualhal-ndk", "android.hardware.biometrics.common-V4-ndk", "android.hardware.keymaster-V4-ndk", "android.hardware.biometrics.common.util", @@ -190,7 +244,6 @@ cc_test { cflags: ["-DFPS_DEBUGGABLE"], }, }, - vendor: true, test_suites: ["general-tests"], require_root: true, } @@ -198,39 +251,34 @@ cc_test { sysprop_library { name: "android.hardware.biometrics.fingerprint.VirtualProps", srcs: ["fingerprint.sysprop"], - property_owner: "Vendor", - vendor: true, + property_owner: "Platform", + vendor_available: true, + apex_available: [ + "com.android.hardware.biometrics.fingerprint.virtual", + "//apex_available:platform", + ], } prebuilt_etc { - name: "fingerprint-example.rc", - src: "fingerprint-example.rc", - installable: false, -} - -prebuilt_etc { - name: "fingerprint-example.xml", - src: "fingerprint-example.xml", - sub_dir: "vintf", + name: "fingerprint-virtual.rc", + src: "fingerprint-virtual.rc", installable: false, } apex { name: "com.android.hardware.biometrics.fingerprint.virtual", manifest: "apex_manifest.json", - file_contexts: "apex_file_contexts", + file_contexts: ":com.android.biometrics.virtual.fingerprint-file_contexts", key: "com.android.hardware.key", certificate: ":com.android.hardware.certificate", updatable: false, - vendor: true, + system_ext_specific: true, binaries: [ "android.hardware.biometrics.fingerprint-service.example", ], prebuilts: [ // init_rc - "fingerprint-example.rc", - // vintf_fragment - "fingerprint-example.xml", + "fingerprint-virtual.rc", ], } diff --git a/biometrics/fingerprint/aidl/default/VirtualHal.cpp b/biometrics/fingerprint/aidl/default/VirtualHal.cpp index e107d2f7ed..d1617652a9 100644 --- a/biometrics/fingerprint/aidl/default/VirtualHal.cpp +++ b/biometrics/fingerprint/aidl/default/VirtualHal.cpp @@ -26,7 +26,7 @@ #define LOG_TAG "FingerprintVirtualHalAidl" namespace aidl::android::hardware::biometrics::fingerprint { - +using AcquiredInfoAndVendorCode = virtualhal::AcquiredInfoAndVendorCode; using Tag = AcquiredInfoAndVendorCode::Tag; ::ndk::ScopedAStatus VirtualHal::setEnrollments(const std::vector& enrollments) { @@ -41,8 +41,7 @@ using Tag = AcquiredInfoAndVendorCode::Tag; return ndk::ScopedAStatus::ok(); } -::ndk::ScopedAStatus VirtualHal::setNextEnrollment( - const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& next_enrollment) { +::ndk::ScopedAStatus VirtualHal::setNextEnrollment(const NextEnrollment& next_enrollment) { Fingerprint::cfg().sourcedFromAidl(); std::ostringstream os; os << next_enrollment.id << ":"; @@ -333,4 +332,10 @@ OptIntVec VirtualHal::acquiredInfoVec2OptIntVec( return ndk::ScopedAStatus::ok(); } +::ndk::ScopedAStatus VirtualHal::getFingerprintHal( + std::shared_ptr<::aidl::android::hardware::biometrics::fingerprint::IFingerprint>* pFp) { + LOG(INFO) << " calling getFingerprintHal in VirtualHal.cpp"; + *pFp = mFp; + return ndk::ScopedAStatus::ok(); +} } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt index e69de29bb2..8c02a686d0 100644 --- a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt +++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt @@ -0,0 +1,178 @@ +props { + owner: Vendor + module: "android.fingerprint.virt.FingerprintHalProperties" + prop { + api_name: "authenticator_id" + type: Long + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" + } + prop { + api_name: "challenge" + type: Long + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.challenge" + } + prop { + api_name: "control_illumination" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" + } + prop { + api_name: "detect_interaction" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" + } + prop { + api_name: "display_touch" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" + } + prop { + api_name: "enrollment_hit" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.enrollment_hit" + } + prop { + api_name: "enrollments" + type: IntegerList + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.enrollments" + } + prop { + api_name: "lockout" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.lockout" + } + prop { + api_name: "lockout_enable" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.lockout_enable" + } + prop { + api_name: "lockout_permanent_threshold" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.lockout_permanent_threshold" + } + prop { + api_name: "lockout_timed_duration" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_duration" + } + prop { + api_name: "lockout_timed_threshold" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_threshold" + } + prop { + api_name: "max_enrollments" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" + } + prop { + api_name: "navigation_guesture" + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" + } + prop { + api_name: "next_enrollment" + type: String + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.next_enrollment" + } + prop { + api_name: "operation_authenticate_acquired" + type: String + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" + } + prop { + api_name: "operation_authenticate_duration" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" + } + prop { + api_name: "operation_authenticate_error" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" + } + prop { + api_name: "operation_authenticate_fails" + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" + } + prop { + api_name: "operation_authenticate_latency" + type: IntegerList + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" + } + prop { + api_name: "operation_detect_interaction_acquired" + type: String + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" + } + prop { + api_name: "operation_detect_interaction_duration" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" + } + prop { + api_name: "operation_detect_interaction_error" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" + } + prop { + api_name: "operation_detect_interaction_latency" + type: IntegerList + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" + } + prop { + api_name: "operation_enroll_error" + type: Integer + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_enroll_error" + } + prop { + api_name: "operation_enroll_latency" + type: IntegerList + access: ReadWrite + prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" + } + prop { + api_name: "sensor_id" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_id" + } + prop { + api_name: "sensor_location" + type: String + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_location" + } + prop { + api_name: "sensor_strength" + type: Integer + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" + } + prop { + api_name: "type" + type: String + access: ReadWrite + prop_name: "persist.vendor.fingerprint.virtual.type" + enum_values: "default|rear|udfps|side" + } +} diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.rc b/biometrics/fingerprint/aidl/default/fingerprint-default.rc new file mode 100644 index 0000000000..7e46bc1a21 --- /dev/null +++ b/biometrics/fingerprint/aidl/default/fingerprint-default.rc @@ -0,0 +1,7 @@ +service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.default default + class hal + user nobody + group nobody + interface aidl android.hardware.biometrics.fingerprint.IFingerprint/default + oneshot + disabled diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.xml b/biometrics/fingerprint/aidl/default/fingerprint-default.xml similarity index 50% rename from biometrics/fingerprint/aidl/default/fingerprint-example.xml rename to biometrics/fingerprint/aidl/default/fingerprint-default.xml index ee529e9875..d1404590b6 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.xml +++ b/biometrics/fingerprint/aidl/default/fingerprint-default.xml @@ -1,7 +1,10 @@ android.hardware.biometrics.fingerprint - 5 - IFingerprint/virtual + 4 + + IFingerprint + default + diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc deleted file mode 100644 index da4ea45696..0000000000 --- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc +++ /dev/null @@ -1,7 +0,0 @@ -service vendor.fingerprint-example /apex/com.android.hardware.biometrics.fingerprint.virtual/bin/hw/android.hardware.biometrics.fingerprint-service.example - class hal - user nobody - group nobody - interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual - oneshot - disabled diff --git a/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc b/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc new file mode 100644 index 0000000000..5d1506c92d --- /dev/null +++ b/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc @@ -0,0 +1,7 @@ +service fingerprint-virtual /apex/com.android.hardware.biometrics.fingerprint.virtual/bin/hw/android.hardware.biometrics.fingerprint-service.example virtual + class hal + user nobody + group nobody + interface aidl android.hardware.biometrics.fingerprint.virtualhal.IVirtualHal/virtual + oneshot + disabled diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop index 6a6c29728b..eb334326f7 100644 --- a/biometrics/fingerprint/aidl/default/fingerprint.sysprop +++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop @@ -7,7 +7,7 @@ owner: Vendor prop { prop_name: "persist.vendor.fingerprint.virtual.type" type: String - scope: Internal + scope: Public access: ReadWrite enum_values: "default|rear|udfps|side" api_name: "type" @@ -17,7 +17,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.enrollments" type: IntegerList - scope: Internal + scope: Public access: ReadWrite api_name: "enrollments" } @@ -27,7 +27,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.enrollment_hit" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "enrollment_hit" } @@ -42,7 +42,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.next_enrollment" type: String - scope: Internal + scope: Public access: ReadWrite api_name: "next_enrollment" } @@ -51,7 +51,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.authenticator_id" type: Long - scope: Internal + scope: Public access: ReadWrite api_name: "authenticator_id" } @@ -60,7 +60,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.challenge" type: Long - scope: Internal + scope: Public access: ReadWrite api_name: "challenge" } @@ -69,7 +69,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "operation_authenticate_fails" } @@ -82,7 +82,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "operation_detect_interaction_error" } @@ -91,7 +91,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_enroll_error" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "operation_enroll_error" } @@ -104,7 +104,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency" type: IntegerList - scope: Internal + scope: Public access: ReadWrite api_name: "operation_authenticate_latency" } @@ -114,7 +114,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency" type: IntegerList - scope: Internal + scope: Public access: ReadWrite api_name: "operation_detect_interaction_latency" } @@ -124,7 +124,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_enroll_latency" type: IntegerList - scope: Internal + scope: Public access: ReadWrite api_name: "operation_enroll_latency" } @@ -134,7 +134,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "operation_authenticate_duration" } @@ -143,7 +143,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_error" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "operation_authenticate_error" } @@ -153,7 +153,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_location" type: String - scope: Internal + scope: Public access: ReadWrite api_name: "sensor_location" } @@ -162,7 +162,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired" type: String - scope: Internal + scope: Public access: ReadWrite api_name: "operation_authenticate_acquired" } @@ -172,7 +172,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "operation_detect_interaction_duration" } @@ -184,7 +184,7 @@ prop { prop { prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired" type: String - scope: Internal + scope: Public access: ReadWrite api_name: "operation_detect_interaction_acquired" } @@ -193,7 +193,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_id" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "sensor_id" } @@ -203,7 +203,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.sensor_strength" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "sensor_strength" } @@ -213,7 +213,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.max_enrollments" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "max_enrollments" } @@ -222,7 +222,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "navigation_guesture" } @@ -231,7 +231,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.detect_interaction" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "detect_interaction" } @@ -240,7 +240,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "display_touch" } @@ -249,7 +249,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "control_illumination" } @@ -258,7 +258,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.lockout" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "lockout" } @@ -267,7 +267,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.lockout_enable" type: Boolean - scope: Internal + scope: Public access: ReadWrite api_name: "lockout_enable" } @@ -276,7 +276,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_threshold" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "lockout_timed_threshold" } @@ -285,7 +285,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_duration" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "lockout_timed_duration" } @@ -294,7 +294,7 @@ prop { prop { prop_name: "persist.vendor.fingerprint.virtual.lockout_permanent_threshold" type: Integer - scope: Internal + scope: Public access: ReadWrite api_name: "lockout_permanent_threshold" } diff --git a/biometrics/fingerprint/aidl/default/include/VirtualHal.h b/biometrics/fingerprint/aidl/default/include/VirtualHal.h index e5f62fc1c0..5488383a69 100644 --- a/biometrics/fingerprint/aidl/default/include/VirtualHal.h +++ b/biometrics/fingerprint/aidl/default/include/VirtualHal.h @@ -16,21 +16,21 @@ #pragma once -#include +#include #include "Fingerprint.h" namespace aidl::android::hardware::biometrics::fingerprint { +using namespace virtualhal; + class VirtualHal : public BnVirtualHal { public: - VirtualHal(Fingerprint* fp) : mFp(fp) {} + VirtualHal(std::shared_ptr fp) : mFp(fp) {} ::ndk::ScopedAStatus setEnrollments(const std::vector& in_id) override; ::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override; - ::ndk::ScopedAStatus setNextEnrollment( - const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& - in_next_enrollment) override; + ::ndk::ScopedAStatus setNextEnrollment(const NextEnrollment& in_next_enrollment) override; ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override; ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override; ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override; @@ -67,12 +67,15 @@ class VirtualHal : public BnVirtualHal { ::ndk::ScopedAStatus setDetectInteraction(bool in_v) override; ::ndk::ScopedAStatus setDisplayTouch(bool in_v) override; ::ndk::ScopedAStatus setControlIllumination(bool in_v) override; + ::ndk::ScopedAStatus getFingerprintHal( + std::shared_ptr<::aidl::android::hardware::biometrics::fingerprint::IFingerprint>* + _aidl_return); private: OptIntVec intVec2OptIntVec(const std::vector& intVec); OptIntVec acquiredInfoVec2OptIntVec(const std::vector& intVec); ::ndk::ScopedAStatus sanityCheckLatency(const std::vector& in_latency); - Fingerprint* mFp; + std::shared_ptr mFp; }; } // namespace aidl::android::hardware::biometrics::fingerprint diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp index ba0c8ecadb..8ca44d6bbc 100644 --- a/biometrics/fingerprint/aidl/default/main.cpp +++ b/biometrics/fingerprint/aidl/default/main.cpp @@ -24,21 +24,38 @@ using aidl::android::hardware::biometrics::fingerprint::Fingerprint; using aidl::android::hardware::biometrics::fingerprint::VirtualHal; -int main() { - LOG(INFO) << "Fingerprint HAL started"; +int main(int argc, char** argv) { + if (argc < 2) { + LOG(ERROR) << "Missing argument -> exiting"; + return EXIT_FAILURE; + } + + LOG(INFO) << "Fingerprint HAL started: " << argv[1]; ABinderProcess_setThreadPoolMaxThreadCount(0); std::shared_ptr hal = ndk::SharedRefBase::make(); - auto binder = hal->asBinder(); - - std::shared_ptr hal_ext = ndk::SharedRefBase::make(hal.get()); - auto binder_ext = hal_ext->asBinder(); + std::shared_ptr hal_vhal = ndk::SharedRefBase::make(hal); if (hal->connected()) { - CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get())); - const std::string instance = std::string(Fingerprint::descriptor) + "/virtual"; - binder_status_t status = - AServiceManager_registerLazyService(binder.get(), instance.c_str()); - CHECK_EQ(status, STATUS_OK); + if (strcmp(argv[1], "default") == 0) { + const std::string instance = std::string(Fingerprint::descriptor) + "/default"; + auto binder = hal->asBinder(); + auto binder_ext = hal_vhal->asBinder(); + CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get())); + binder_status_t status = + AServiceManager_registerLazyService(binder.get(), instance.c_str()); + CHECK_EQ(status, STATUS_OK); + LOG(INFO) << "started IFingerprint/default"; + } else if (strcmp(argv[1], "virtual") == 0) { + const std::string instance = std::string(VirtualHal::descriptor) + "/virtual"; + auto binder = hal_vhal->asBinder(); + binder_status_t status = + AServiceManager_registerLazyService(binder.get(), instance.c_str()); + CHECK_EQ(status, STATUS_OK); + LOG(INFO) << "started IVirtualHal/virtual"; + } else { + LOG(ERROR) << "Unexpected argument: " << argv[1]; + return EXIT_FAILURE; + } AServiceManager_forceLazyServicesPersist(true); } else { LOG(ERROR) << "Fingerprint HAL is not connected"; diff --git a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp index 3fe0b2a33e..8ffc96b13f 100644 --- a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp +++ b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp @@ -35,7 +35,7 @@ class VirtualHalTest : public ::testing::Test { protected: void SetUp() override { mHal = ndk::SharedRefBase::make(); - mVhal = ndk::SharedRefBase::make(mHal.get()); + mVhal = ndk::SharedRefBase::make(mHal); ASSERT_TRUE(mVhal != nullptr); mHal->resetConfigToDefault(); } diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp index fc32fe6cad..628f03fe45 100644 --- a/biometrics/fingerprint/aidl/vts/Android.bp +++ b/biometrics/fingerprint/aidl/vts/Android.bp @@ -16,8 +16,8 @@ cc_test { ], srcs: ["VtsHalBiometricsFingerprintTargetTest.cpp"], static_libs: [ - "android.hardware.biometrics.common-V3-ndk", - "android.hardware.biometrics.fingerprint-V3-ndk", + "android.hardware.biometrics.common-V4-ndk", + "android.hardware.biometrics.fingerprint-V4-ndk", "android.hardware.keymaster-V4-ndk", ], shared_libs: [ diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp index b86f399afc..e7a31e626a 100644 --- a/compatibility_matrices/exclude/fcm_exclude.cpp +++ b/compatibility_matrices/exclude/fcm_exclude.cpp @@ -149,6 +149,7 @@ bool ShouldCheckMissingAidlHalsInFcm(const std::string& packageAndVersion) { "android.hardware.radio@", "android.hardware.uwb.fira_android@", "android.hardware.wifi.common@", + "android.hardware.biometrics.fingerprint.virtualhal@", // Test packages are exempted. "android.hardware.tests.", diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp index 0f2debdfaa..9f4e5cb19f 100644 --- a/keymaster/aidl/Android.bp +++ b/keymaster/aidl/Android.bp @@ -18,6 +18,12 @@ aidl_interface { java: { platform_apis: true, }, + ndk: { + apex_available: [ + "com.android.hardware.biometrics.fingerprint.virtual", + "//apex_available:platform", + ], + }, }, versions_with_info: [ {