Update fingerprint SensorLocation interface for multi-display

Allows the implementation to specify location relative to multiple
displays (instead of just one), from which the sensor is accessible
from.

Fixes: 174868353
Test: make -j android.hardware.biometrics.fingerprint-update-api
Test: make -j android.hardware.biometrics.fingerprint-service.example

Change-Id: I0d1c1d2bdc0ea817656c14b3b79381db994fdd75
This commit is contained in:
Kevin Chyn
2021-02-05 16:58:44 -08:00
parent 47b33fcb7b
commit 656b4f29e1
5 changed files with 111 additions and 36 deletions

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2021 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;
@VintfStability
parcelable SensorLocation {
int displayId;
int sensorLocationX;
int sensorLocationY;
int sensorRadius;
}

View File

@@ -35,10 +35,7 @@ package android.hardware.biometrics.fingerprint;
parcelable SensorProps {
android.hardware.biometrics.common.CommonProps commonProps;
android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType;
android.hardware.biometrics.fingerprint.SensorLocation[] sensorLocations;
boolean supportsNavigationGestures;
int sensorLocationX;
int sensorLocationY;
int sensorRadius;
int displayId;
boolean supportsDetectInteraction;
}

View File

@@ -0,0 +1,54 @@
/*
* Copyright (C) 2021 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;
@VintfStability
parcelable SensorLocation {
/**
* The display to which the following measurements are relative to. This must correspond to the
* android.hardware.DisplayManager#getDisplay Android API.
*
* A few examples:
* 1) A capacitive rear fingerprint sensor would specify the display to which it is behind.
* 2) An under-display fingerprint sensor would specify the display on which the sensor is
* located.
* 3) A foldable device would specify multiple locations and have a SensorLocation entry
* for each display from which the sensor is accessible from.
*/
int displayId;
/**
* The location of the center of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the distance in pixels,
* measured from the left edge of the screen.
*/
int sensorLocationX;
/**
* The location of the center of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the distance in pixels,
* measured from the top edge of the screen.
*/
int sensorLocationY;
/**
* The radius of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the radius of the sensor,
* in pixels.
*/
int sensorRadius;
}

View File

@@ -18,6 +18,7 @@ package android.hardware.biometrics.fingerprint;
import android.hardware.biometrics.common.CommonProps;
import android.hardware.biometrics.fingerprint.FingerprintSensorType;
import android.hardware.biometrics.fingerprint.SensorLocation;
@VintfStability
parcelable SensorProps {
@@ -31,39 +32,18 @@ parcelable SensorProps {
*/
FingerprintSensorType sensorType;
/**
* A list of display-specific locations from where the sensor is usable from. See SensorLocation
* for more details.
*/
SensorLocation[] sensorLocations;
/**
* Must be set to true for sensors that support "swipe" gestures via
* android.view.KeyEvent#KEYCODE_SYSTEM_NAVIGATION_*.
*/
boolean supportsNavigationGestures;
/**
* The location of the center of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the distance in pixels,
* measured from the left edge of the screen.
*/
int sensorLocationX;
/**
* The location of the center of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the distance in pixels,
* measured from the top edge of the screen.
*/
int sensorLocationY;
/**
* The radius of the sensor if applicable. For example, sensors of
* FingerprintSensorType::UNDER_DISPLAY_* would report this value as the radius of the sensor,
* in pixels.
*/
int sensorRadius;
/**
* For sensors of FingerprintSensorType::UNDER_DISPLAY_*, this must correspond to the
* android.hardware.DisplayManager#getDisplay Android API.
*/
int displayId;
/**
* Specifies whether or not the implementation supports ISession#detectInteraction.
*/

View File

@@ -43,13 +43,17 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* return_
kSensorStrength,
kMaxEnrollmentsPerUser,
hardwareInfos};
SensorProps props = {commonProps,
kSensorType,
kSupportsNavigationGestures,
SensorLocation sensorLocation = {
0 /* displayId */,
0 /* sensorLocationX */,
0 /* sensorLocationY */,
0 /* sensorRadius */,
0 /* displayId */};
0 /* sensorRadius */
};
SensorProps props = {commonProps,
kSensorType,
{sensorLocation},
kSupportsNavigationGestures,
false /* supportsDetectInteraction */};
return_val->push_back(props);
return ndk::ScopedAStatus::ok();
}