From 4585601fb36b6ea5e1342bc9a68d229e97d8e0a3 Mon Sep 17 00:00:00 2001 From: Ilya Matyukhin Date: Tue, 23 Jun 2020 01:20:24 -0700 Subject: [PATCH] Define biometrics.fingerprint@2.3 This HIDL introduces onFingerDown and onFingerUp methods. Bug: 158135499 Test: build Change-Id: If2bfd70ee518b3f980ed2dc36a2df2a1ccf3afce --- biometrics/fingerprint/2.3/Android.bp | 18 ++++++ .../2.3/IBiometricsFingerprint.hal | 43 ++++++++++++++ .../fingerprint/2.3/vts/functional/Android.bp | 30 ++++++++++ ...HalBiometricsFingerprintV2_3TargetTest.cpp | 59 +++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 biometrics/fingerprint/2.3/Android.bp create mode 100644 biometrics/fingerprint/2.3/IBiometricsFingerprint.hal create mode 100644 biometrics/fingerprint/2.3/vts/functional/Android.bp create mode 100644 biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp diff --git a/biometrics/fingerprint/2.3/Android.bp b/biometrics/fingerprint/2.3/Android.bp new file mode 100644 index 0000000000..57ab83230d --- /dev/null +++ b/biometrics/fingerprint/2.3/Android.bp @@ -0,0 +1,18 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.biometrics.fingerprint@2.3", + root: "android.hardware", + vndk: { + enabled: true, + }, + srcs: [ + "IBiometricsFingerprint.hal", + ], + interfaces: [ + "android.hardware.biometrics.fingerprint@2.1", + "android.hardware.biometrics.fingerprint@2.2", + "android.hidl.base@1.0", + ], + gen_java: true, +} diff --git a/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal b/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal new file mode 100644 index 0000000000..8777c28e3a --- /dev/null +++ b/biometrics/fingerprint/2.3/IBiometricsFingerprint.hal @@ -0,0 +1,43 @@ +/* + * Copyright 2020 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 android.hardware.biometrics.fingerprint@2.3; + +import @2.2::IBiometricsFingerprint; + +/** + * The interface for biometric fingerprint authentication. + */ +interface IBiometricsFingerprint extends @2.2::IBiometricsFingerprint { + /** + * Notifies about a finger touching the sensor area. + * + * @param x The screen x-coordinate of the center of the touch contact area, in + * display pixels. + * @param y The screen y-coordinate of the center of the touch contact area, in + * display pixels. + * @param minor The length of the minor axis of an ellipse that describes the + * touch area, in display pixels. + * @param major The length of the major axis of an ellipse that describes the + * touch area, in display pixels. + */ + oneway onFingerDown(uint32_t x, uint32_t y, float minor, float major); + + /** + * Notifies about a finger leaving the sensor area. + */ + oneway onFingerUp(); +}; diff --git a/biometrics/fingerprint/2.3/vts/functional/Android.bp b/biometrics/fingerprint/2.3/vts/functional/Android.bp new file mode 100644 index 0000000000..521c0f41fd --- /dev/null +++ b/biometrics/fingerprint/2.3/vts/functional/Android.bp @@ -0,0 +1,30 @@ +/* + * Copyright 2020 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. + */ + +cc_test { + name: "VtsHalBiometricsFingerprintV2_3TargetTest", + defaults: ["VtsHalTargetTestDefaults"], + srcs: ["VtsHalBiometricsFingerprintV2_3TargetTest.cpp"], + static_libs: [ + "android.hardware.biometrics.fingerprint@2.1", + "android.hardware.biometrics.fingerprint@2.2", + "android.hardware.biometrics.fingerprint@2.3", + ], + test_suites: [ + "general-tests", + "vts", + ], +} diff --git a/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp b/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp new file mode 100644 index 0000000000..722621379d --- /dev/null +++ b/biometrics/fingerprint/2.3/vts/functional/VtsHalBiometricsFingerprintV2_3TargetTest.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 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. + */ + +#include +#include +#include +#include +#include + +namespace { + +namespace hidl_interface_2_3 = android::hardware::biometrics::fingerprint::V2_3; + +using hidl_interface_2_3::IBiometricsFingerprint; + +using android::sp; + +// Callback arguments that need to be captured for the tests. +struct FingerprintCallbackArgs {}; + +class FingerprintHidlTest : public ::testing::TestWithParam { + public: + void SetUp() override { + mService = IBiometricsFingerprint::getService(GetParam()); + ASSERT_NE(mService, nullptr); + } + + sp mService; +}; + +// This is a one-way method that doesn't return anything. +TEST_P(FingerprintHidlTest, onFingerDownTest) { + mService->onFingerDown(1, 2, 3.0f, 4.0f); +} + +// This is a one-way method that doesn't return anything. +TEST_P(FingerprintHidlTest, onFingerUp) { + mService->onFingerUp(); +} + +} // anonymous namespace + +INSTANTIATE_TEST_SUITE_P(PerInstance, FingerprintHidlTest, + testing::ValuesIn(android::hardware::getAllHalInstanceNames( + IBiometricsFingerprint::descriptor)), + android::hardware::PrintInstanceNameToString);