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
This commit is contained in:
Jeff Pu
2024-07-17 12:33:29 -04:00
parent 5b43d64574
commit e0263c404a
28 changed files with 434 additions and 302 deletions

View File

@@ -22,6 +22,12 @@ aidl_interface {
cpp: {
enabled: false,
},
ndk: {
apex_available: [
"//apex_available:anyapex",
"//apex_available:platform",
],
},
},
versions_with_info: [
{

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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",
],
}

View File

@@ -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,
}

View File

@@ -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 <name>-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;
}

View File

@@ -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 <name>-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;
}

View File

@@ -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 <name>-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;
}

View File

@@ -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 <name>-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;
}

View File

@@ -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

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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

View File

@@ -0,0 +1,2 @@
The aidl files in this directory are used only by fingerprint virtual hal
which is controlled/configured via IVirtualHal interface

View File

@@ -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",
],
}

View File

@@ -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<int32_t>& 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

View File

@@ -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"
}
}

View File

@@ -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

View File

@@ -1,7 +1,10 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>5</version>
<fqname>IFingerprint/virtual</fqname>
<version>4</version>
<interface>
<name>IFingerprint</name>
<instance>default</instance>
</interface>
</hal>
</manifest>

View File

@@ -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

View File

@@ -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

View File

@@ -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"
}

View File

@@ -16,21 +16,21 @@
#pragma once
#include <aidl/android/hardware/biometrics/fingerprint/BnVirtualHal.h>
#include <aidl/android/hardware/biometrics/fingerprint/virtualhal/BnVirtualHal.h>
#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<Fingerprint> fp) : mFp(fp) {}
::ndk::ScopedAStatus setEnrollments(const std::vector<int32_t>& 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<int32_t>& intVec);
OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec);
::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency);
Fingerprint* mFp;
std::shared_ptr<Fingerprint> mFp;
};
} // namespace aidl::android::hardware::biometrics::fingerprint

View File

@@ -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<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
auto binder = hal->asBinder();
std::shared_ptr<VirtualHal> hal_ext = ndk::SharedRefBase::make<VirtualHal>(hal.get());
auto binder_ext = hal_ext->asBinder();
std::shared_ptr<VirtualHal> hal_vhal = ndk::SharedRefBase::make<VirtualHal>(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";

View File

@@ -35,7 +35,7 @@ class VirtualHalTest : public ::testing::Test {
protected:
void SetUp() override {
mHal = ndk::SharedRefBase::make<Fingerprint>();
mVhal = ndk::SharedRefBase::make<VirtualHal>(mHal.get());
mVhal = ndk::SharedRefBase::make<VirtualHal>(mHal);
ASSERT_TRUE(mVhal != nullptr);
mHal->resetConfigToDefault();
}

View File

@@ -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: [