Update fingerprint AIDL for Android U

1. Adds sensor shape and touch detection configuration.
2. Adds onPointerCancelWithContext and setIgnoreDisplayTouches.
3. Adds LIFT_TOO_SOON constant to AcquiredInfo.
4. Deprecates SensorLocation displayId, onPointerDown, and onPointerUp.

Bug: 266476972
Test: m android.hardware.biometrics.fingerprint-update-api
Test: built locally
Change-Id: I3aae3c7f8a65d5805f3dd583330407c255ca1369
This commit is contained in:
Austin Delgado
2023-02-16 11:34:50 -08:00
parent 87bc929ecf
commit 88ded642f2
18 changed files with 297 additions and 38 deletions

View File

@@ -35,17 +35,18 @@ package android.hardware.biometrics.fingerprint;
/* @hide */
@Backing(type="byte") @VintfStability
enum AcquiredInfo {
UNKNOWN = 0,
GOOD = 1,
PARTIAL = 2,
INSUFFICIENT = 3,
SENSOR_DIRTY = 4,
TOO_SLOW = 5,
TOO_FAST = 6,
VENDOR = 7,
START = 8,
TOO_DARK = 9,
TOO_BRIGHT = 10,
IMMOBILE = 11,
RETRYING_CAPTURE = 12,
UNKNOWN,
GOOD,
PARTIAL,
INSUFFICIENT,
SENSOR_DIRTY,
TOO_SLOW,
TOO_FAST,
VENDOR,
START,
TOO_DARK,
TOO_BRIGHT,
IMMOBILE,
RETRYING_CAPTURE,
LIFT_TOO_SOON,
}

View File

@@ -35,13 +35,13 @@ package android.hardware.biometrics.fingerprint;
/* @hide */
@Backing(type="byte") @VintfStability
enum Error {
UNKNOWN = 0,
HW_UNAVAILABLE = 1,
UNABLE_TO_PROCESS = 2,
TIMEOUT = 3,
NO_SPACE = 4,
CANCELED = 5,
UNABLE_TO_REMOVE = 6,
VENDOR = 7,
BAD_CALIBRATION = 8,
UNKNOWN,
HW_UNAVAILABLE,
UNABLE_TO_PROCESS,
TIMEOUT,
NO_SPACE,
CANCELED,
UNABLE_TO_REMOVE,
VENDOR,
BAD_CALIBRATION,
}

View File

@@ -35,10 +35,10 @@ package android.hardware.biometrics.fingerprint;
/* @hide */
@Backing(type="byte") @VintfStability
enum FingerprintSensorType {
UNKNOWN = 0,
REAR = 1,
UNDER_DISPLAY_ULTRASONIC = 2,
UNDER_DISPLAY_OPTICAL = 3,
POWER_BUTTON = 4,
HOME_BUTTON = 5,
UNKNOWN,
REAR,
UNDER_DISPLAY_ULTRASONIC,
UNDER_DISPLAY_OPTICAL,
POWER_BUTTON,
HOME_BUTTON,
}

View File

@@ -46,7 +46,13 @@ interface ISession {
void invalidateAuthenticatorId();
void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat);
void close();
/**
* @deprecated use onPointerDownWithContext instead.
*/
void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major);
/**
* @deprecated use onPointerUpWithContext instead.
*/
void onPointerUp(in int pointerId);
void onUiReady();
android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context);
@@ -55,4 +61,6 @@ interface ISession {
void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context);
void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context);
void onContextChanged(in android.hardware.biometrics.common.OperationContext context);
void onPointerCancelWithContext(in android.hardware.biometrics.fingerprint.PointerContext context);
void setIgnoreDisplayTouches(in boolean shouldIgnore);
}

View File

@@ -35,12 +35,12 @@ package android.hardware.biometrics.fingerprint;
/* @hide */
@JavaDerive(equals=true) @VintfStability
parcelable PointerContext {
int pointerId = -1;
float x = 0.000000f;
float y = 0.000000f;
float minor = 0.000000f;
float major = 0.000000f;
float orientation = 0.000000f;
int pointerId = (-1) /* -1 */;
float x = 0f;
float y = 0f;
float minor = 0f;
float major = 0f;
float orientation = 0f;
boolean isAod = false;
long time = 0;
long gestureStart = 0;

View File

@@ -35,9 +35,13 @@ package android.hardware.biometrics.fingerprint;
/* @hide */
@VintfStability
parcelable SensorLocation {
/**
* @deprecated use the display field instead. This field was never used.
*/
int displayId;
int sensorLocationX;
int sensorLocationY;
int sensorRadius;
String display = "";
android.hardware.biometrics.fingerprint.SensorShape sensorShape = android.hardware.biometrics.fingerprint.SensorShape.CIRCLE;
}

View File

@@ -42,4 +42,5 @@ parcelable SensorProps {
boolean supportsDetectInteraction;
boolean halHandlesDisplayTouches;
boolean halControlsIllumination;
@nullable android.hardware.biometrics.fingerprint.TouchDetectionParameters touchDetectionParameters;
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// 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 */
@Backing(type="byte") @VintfStability
enum SensorShape {
SQUARE,
CIRCLE,
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// 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 TouchDetectionParameters {
float targetSize = 1.0f;
float minOverlap = 0.0f;
}

View File

@@ -98,4 +98,9 @@ enum AcquiredInfo {
* However, RETRYING_CAPTURE must not be sent after ACQUIRED_GOOD is sent.
*/
RETRYING_CAPTURE,
/**
* Fingerprint was lifted before the capture completed.
*/
LIFT_TOO_SOON,
}

View File

@@ -420,6 +420,8 @@ interface ISession {
* @param y The distance in pixels from the top edge of the display.
* @param minor See android.view.MotionEvent#getTouchMinor
* @param major See android.view.MotionEvent#getTouchMajor
*
* @deprecated use onPointerDownWithContext instead.
*/
void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major);
@@ -434,6 +436,8 @@ interface ISession {
* ISession#enroll, ISession#detectInteraction.
*
* @param pointerId See android.view.MotionEvent#getPointerId
*
* @deprecated use onPointerUpWithContext instead.
*/
void onPointerUp(in int pointerId);
@@ -469,15 +473,77 @@ interface ISession {
/** See ISession#detectInteraction() */
ICancellationSignal detectInteractionWithContext(in OperationContext context);
/** See ISession#onPointerDown(int, int, int, float, float) */
/**
* onPointerDownWithContext:
*
* This operation only applies to sensors that are configured as
* FingerprintSensorType::UNDER_DISPLAY_*. If invoked erroneously by the framework for sensors
* of other types, the HAL must treat this as a no-op and return immediately.
*
* Notifies the HAL that a finger entered the sensor area. This operation can be invoked
* regardless of the current state of the HAL.
*
* Note that for sensors which require illumination, for example
* FingerprintSensorType::UNDER_DISPLAY_OPTICAL, this is a good time to start illuminating.
*
* @param context See PointerContext
*/
void onPointerDownWithContext(in PointerContext context);
/** See ISession#onPointerUp(int) */
/**
* onPointerUpWithContext:
*
* This operation only applies to sensors that are configured as
* FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must
* treat this as a no-op and return immediately.
*
* Notifies the HAL that a finger left the sensor area. This operation can be invoked regardless
* of the current state of the HAL.
*
* @param context See PointerContext
*/
void onPointerUpWithContext(in PointerContext context);
/**
* onContextChanged:
*
* This may be called while an authenticate, detect interaction, or enrollment operation is
* running when the context changes.
*/
void onContextChanged(in OperationContext context);
/**
* onPointerCancelWithContext:
*
* This operation only applies to sensors that are configured as
* FingerprintSensorType::UNDER_DISPLAY_*. If invoked for sensors of other types, the HAL must
* treat this as a no-op and return immediately.
*
* Notifies the HAL that if there were fingers within the sensor area, they are no longer being
* tracked. The fingers may or may not still be on the sensor. This operation can be invoked
* regardless of the current state of the HAL.
*
* @param context See PointerContext
*/
void onPointerCancelWithContext(in PointerContext context);
/**
* setIgnoreDisplayTouches:
*
* This operation only applies to sensors that have SensorProps#halHandlesDisplayTouches
* set to true. For all other sensors this is a no-op.
*
* Instructs the HAL whether to ignore display touches. This can be useful to avoid unintended
* fingerprint captures during certain UI interactions. For example, when entering a lockscreen
* PIN, some of the touches might overlap with the fingerprint sensor. Those touches should be
* ignored to avoid unintended authentication attempts.
*
* This flag must default to false when the HAL starts.
*
* The framework is responsible for both setting the flag to true and resetting it to false
* whenever it's appropriate.
*
* @param shouldIgnore whether the display touches should be ignored.
*/
void setIgnoreDisplayTouches(in boolean shouldIgnore);
}

View File

@@ -15,13 +15,16 @@
*/
package android.hardware.biometrics.fingerprint;
import android.hardware.biometrics.fingerprint.SensorShape;
/**
* @hide
*/
@VintfStability
parcelable SensorLocation {
/**
* Deprecated use the display field instead. This field was never used.
* @deprecated use the display field instead. This field was never used.
*/
int displayId;
@@ -59,4 +62,10 @@ parcelable SensorLocation {
* for each display from which the sensor is accessible from.
*/
String display = "";
/**
* The shape of the sensor if applicable. Most useful for the sensor of type
* SensorType::UNDER_DISPLAY_*.
*/
SensorShape sensorShape = SensorShape.CIRCLE;
}

View File

@@ -19,6 +19,8 @@ package android.hardware.biometrics.fingerprint;
import android.hardware.biometrics.common.CommonProps;
import android.hardware.biometrics.fingerprint.FingerprintSensorType;
import android.hardware.biometrics.fingerprint.SensorLocation;
import android.hardware.biometrics.fingerprint.TouchDetectionParameters;
/**
* @hide
*/
@@ -72,4 +74,9 @@ parcelable SensorProps {
* This value must be ignored for sensors that aren't optical UDFPS.
*/
boolean halControlsIllumination;
/**
* Parameters used for fingerprint touch detection.
*/
@nullable TouchDetectionParameters touchDetectionParameters;
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.biometrics.fingerprint;
/**
* This is most useful for sensors configured as FingerprintSensorType::UNDER_DISPLAY_OPTICAL,
* as it's used to compute the on-screen sensor boundaries for the touch detection algorithm.
*
* @hide
*/
@VintfStability
@Backing(type="byte")
enum SensorShape {
SQUARE,
CIRCLE,
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.biometrics.fingerprint;
/**
* @hide
*/
@VintfStability
parcelable TouchDetectionParameters {
/**
* The percentage of the sensor that is considered the target. Value is required to be within
* [0.0, 1.0]. The target area expands outwards from center matching the sensorShape. Some
* portion of the touch must be within the target to be considered a valid touch.
*/
float targetSize = 1.0f;
/**
* The minimum percentage overlap needed on the sensor to be considered a valid touch. Value is
* required to be within [0.0, 1.0].
*/
float minOverlap = 0.0f;
}

View File

@@ -90,7 +90,8 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) {
navigationGuesture,
detectInteraction,
displayTouch,
controlIllumination}};
controlIllumination,
std::nullopt}};
return ndk::ScopedAStatus::ok();
}

View File

@@ -289,4 +289,12 @@ ndk::ScopedAStatus Session::onContextChanged(const common::OperationContext& /*c
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::onPointerCancelWithContext(const PointerContext& /*context*/) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::setIgnoreDisplayTouches(bool /*shouldIgnore*/) {
return ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::biometrics::fingerprint

View File

@@ -97,6 +97,10 @@ class Session : public BnSession {
ndk::ScopedAStatus onContextChanged(const common::OperationContext& context) override;
ndk::ScopedAStatus onPointerCancelWithContext(const PointerContext& context) override;
ndk::ScopedAStatus setIgnoreDisplayTouches(bool shouldIgnore) override;
bool isClosed();
private: