Update common and fingerprint AIDL for session logging.

This also partially reverts commit 1988b3825bc95a0e7e3bb86bfa5bf70ea5323a61 which unnecessarily froze the interface during a prior interface addition.

Bug: 204585936
Bug: 204584403
Test: atest VtsHalBiometricsFingerprintTargetTest
Change-Id: Ibc9934390a487f5bfb9d3678ad65e7b1c3740ae7
This commit is contained in:
Joe Bolinger
2021-12-03 12:45:48 -08:00
parent 780f1ba454
commit 13cb0fb235
18 changed files with 224 additions and 273 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* 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.
@@ -31,16 +31,11 @@
// 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;
@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,
package android.hardware.biometrics.common;
@VintfStability
parcelable OperationContext {
int id = 0;
android.hardware.biometrics.common.OperationReason reason = android.hardware.biometrics.common.OperationReason.UNKNOWN;
boolean isAoD = false;
boolean isCrypto = false;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 The Android Open Source Project
* 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.
@@ -31,13 +31,10 @@
// 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;
package android.hardware.biometrics.common;
@Backing(type="byte") @VintfStability
enum FingerprintSensorType {
enum OperationReason {
UNKNOWN = 0,
REAR = 1,
UNDER_DISPLAY_ULTRASONIC = 2,
UNDER_DISPLAY_OPTICAL = 3,
POWER_BUTTON = 4,
HOME_BUTTON = 5,
BIOMETRIC_PROMPT = 1,
KEYGUARD = 2,
}

View File

@@ -0,0 +1,49 @@
/*
* 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.common;
import android.hardware.biometrics.common.OperationReason;
/**
* Additional context associated with an operation.
*/
@VintfStability
parcelable OperationContext {
/**
* An identifier for the logical action that the user is engaged in. These identifiers are
* not guaranteed to be unique. However, the framework will not reuse identifiers within
* short periods of time so they can be made unique, if needed, by appending a timestamp.
*
* Zero if the reason is OperationReason.UNKNOWN.
*/
int id = 0;
/**
* A logical reason for this operation.
*
* This should be interpreted as a hint to enable optimizations or tracing. The
* framework may choose to use OperationReason.UNKNOWN at any time based on the device's
* policy.
*/
OperationReason reason = OperationReason.UNKNOWN;
/* Flag indicating that the display is in AoD mode. */
boolean isAoD = false;
/** Flag indicating that crypto was requested. */
boolean isCrypto = false;
}

View File

@@ -0,0 +1,37 @@
/*
* 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.common;
@VintfStability
@Backing(type="byte")
enum OperationReason {
/**
* A normal operation without an explicit reason.
*/
UNKNOWN,
/**
* An operation associated with biometric prompt. This may be due to either application or
* system use, but it is not related to KEYGUARD device entry.
*/
BIOMETRIC_PROMPT,
/**
* An operation associated with device entry.
*/
KEYGUARD,
}

View File

@@ -15,7 +15,7 @@ aidl_interface {
],
imports: [
"android.hardware.biometrics.common",
"android.hardware.keymaster",
"android.hardware.keymaster-V3",
],
stability: "vintf",
backend: {
@@ -26,8 +26,5 @@ aidl_interface {
enabled: false,
},
},
versions: [
"1",
"2",
],
versions: ["1"],
}

View File

@@ -1 +0,0 @@
762eb38ce93ea3c7d39a680949cbdbd2371b3f06

View File

@@ -1,50 +0,0 @@
/*
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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;
@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,
}

View File

@@ -1,39 +0,0 @@
/*
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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
interface IFingerprint {
android.hardware.biometrics.fingerprint.SensorProps[] getSensorProps();
android.hardware.biometrics.fingerprint.ISession createSession(in int sensorId, in int userId, in android.hardware.biometrics.fingerprint.ISessionCallback cb);
}

View File

@@ -1,51 +0,0 @@
/*
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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
interface ISession {
void generateChallenge();
void revokeChallenge(in long challenge);
android.hardware.biometrics.common.ICancellationSignal enroll(in android.hardware.keymaster.HardwareAuthToken hat);
android.hardware.biometrics.common.ICancellationSignal authenticate(in long operationId);
android.hardware.biometrics.common.ICancellationSignal detectInteraction();
void enumerateEnrollments();
void removeEnrollments(in int[] enrollmentIds);
void getAuthenticatorId();
void invalidateAuthenticatorId();
void resetLockout(in android.hardware.keymaster.HardwareAuthToken hat);
void close();
void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major);
void onPointerUp(in int pointerId);
void onUiReady();
}

View File

@@ -1,53 +0,0 @@
/*
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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
interface ISessionCallback {
void onChallengeGenerated(in long challenge);
void onChallengeRevoked(in long challenge);
void onAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfo info, in int vendorCode);
void onError(in android.hardware.biometrics.fingerprint.Error error, in int vendorCode);
void onEnrollmentProgress(in int enrollmentId, int remaining);
void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat);
void onAuthenticationFailed();
void onLockoutTimed(in long durationMillis);
void onLockoutPermanent();
void onLockoutCleared();
void onInteractionDetected();
void onEnrollmentsEnumerated(in int[] enrollmentIds);
void onEnrollmentsRemoved(in int[] enrollmentIds);
void onAuthenticatorIdRetrieved(in long authenticatorId);
void onAuthenticatorIdInvalidated(in long newAuthenticatorId);
void onSessionClosed();
}

View File

@@ -1,44 +0,0 @@
/*
* 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.
*/
///////////////////////////////////////////////////////////////////////////////
// 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 SensorProps {
android.hardware.biometrics.common.CommonProps commonProps;
android.hardware.biometrics.fingerprint.FingerprintSensorType sensorType = android.hardware.biometrics.fingerprint.FingerprintSensorType.UNKNOWN;
android.hardware.biometrics.fingerprint.SensorLocation[] sensorLocations;
boolean supportsNavigationGestures;
boolean supportsDetectInteraction;
boolean halHandlesDisplayTouches;
boolean halControlsIllumination;
}

View File

@@ -48,4 +48,9 @@ interface ISession {
void onPointerDown(in int pointerId, in int x, in int y, in float minor, in float major);
void onPointerUp(in int pointerId);
void onUiReady();
android.hardware.biometrics.common.ICancellationSignal authenticateWithContext(in long operationId, in android.hardware.biometrics.common.OperationContext context);
android.hardware.biometrics.common.ICancellationSignal enrollWithContext(in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.biometrics.common.OperationContext context);
android.hardware.biometrics.common.ICancellationSignal detectInteractionWithContext(in android.hardware.biometrics.common.OperationContext context);
void onPointerDownWithContext(in android.hardware.biometrics.fingerprint.PointerContext context);
void onPointerUpWithContext(in android.hardware.biometrics.fingerprint.PointerContext context);
}

View File

@@ -33,10 +33,11 @@
package android.hardware.biometrics.fingerprint;
@VintfStability
parcelable SensorLocation {
int displayId;
int sensorLocationX;
int sensorLocationY;
int sensorRadius;
String display = "";
parcelable PointerContext {
int pointerId = 0;
int x = 0;
int y = 0;
float minor = 0.000000f;
float major = 0.000000f;
boolean isAoD = false;
}

View File

@@ -17,6 +17,8 @@
package android.hardware.biometrics.fingerprint;
import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.biometrics.common.OperationContext;
import android.hardware.biometrics.fingerprint.PointerContext;
import android.hardware.keymaster.HardwareAuthToken;
/**
@@ -140,7 +142,7 @@ interface ISession {
*
* @param hat See above documentation.
* @return ICancellationSignal An object that can be used by the framework to cancel this
* operation.
* operation.
*/
ICancellationSignal enroll(in HardwareAuthToken hat);
@@ -234,7 +236,7 @@ interface ISession {
* - ISessionCallback#onAcquired
*
* @return ICancellationSignal An object that can be used by the framework to cancel this
* operation.
* operation.
*/
ICancellationSignal detectInteraction();
@@ -448,4 +450,27 @@ interface ISession {
* HAL, the framework will invoke this operation to notify when the illumination is showing.
*/
void onUiReady();
/**
* These are alternative methods for some operations to allow the HAL to make optional
* optimizations during execution.
*
* HALs may ignore the additional context and treat all *WithContext methods the same as
* the original methods.
*/
/** See ISession#authenticate(long) */
ICancellationSignal authenticateWithContext(in long operationId, in OperationContext context);
/** See ISession#enroll(HardwareAuthToken) */
ICancellationSignal enrollWithContext(in HardwareAuthToken hat, in OperationContext context);
/** See ISession#detectInteraction() */
ICancellationSignal detectInteractionWithContext(in OperationContext context);
/** See ISession#onPointerDown(int, int, int, float, float) */
void onPointerDownWithContext(in PointerContext context);
/** See ISession#onPointerUp(int) */
void onPointerUpWithContext(in PointerContext context);
}

View File

@@ -0,0 +1,41 @@
/*
* 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;
/**
* Additional context associated with a pointer event.
*/
@VintfStability
parcelable PointerContext {
/* See android.view.MotionEvent#getPointerId. */
int pointerId = 0;
/* The distance in pixels from the left edge of the display. */
int x = 0;
/* The distance in pixels from the top edge of the display. */
int y = 0;
/* See android.view.MotionEvent#getTouchMinor. */
float minor = 0f;
/* See android.view.MotionEvent#getTouchMajor. */
float major = 0f;
/* Flag indicating that the display is in AoD mode. */
boolean isAoD = false;
}

View File

@@ -25,7 +25,7 @@ cc_binary {
"libbase",
"libbinder_ndk",
"android.hardware.biometrics.fingerprint-V2-ndk",
"android.hardware.biometrics.common-V1-ndk",
"android.hardware.biometrics.common-V2-ndk",
],
}

View File

@@ -244,4 +244,30 @@ ndk::ScopedAStatus Session::onUiReady() {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::authenticateWithContext(
int64_t operationId, const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return authenticate(operationId, out);
}
ndk::ScopedAStatus Session::enrollWithContext(const keymaster::HardwareAuthToken& hat,
const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return enroll(hat, out);
}
ndk::ScopedAStatus Session::detectInteractionWithContext(
const common::OperationContext& /*context*/,
std::shared_ptr<common::ICancellationSignal>* out) {
return detectInteraction(out);
}
ndk::ScopedAStatus Session::onPointerDownWithContext(const PointerContext& context) {
return onPointerDown(context.pointerId, context.x, context.y, context.minor, context.major);
}
ndk::ScopedAStatus Session::onPointerUpWithContext(const PointerContext& context) {
return onPointerUp(context.pointerId);
}
} // namespace aidl::android::hardware::biometrics::fingerprint

View File

@@ -79,6 +79,22 @@ class Session : public BnSession {
ndk::ScopedAStatus onUiReady() override;
ndk::ScopedAStatus authenticateWithContext(
int64_t operationId, const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
ndk::ScopedAStatus enrollWithContext(
const keymaster::HardwareAuthToken& hat, const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteractionWithContext(
const common::OperationContext& context,
std::shared_ptr<common::ICancellationSignal>* out) override;
ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override;
ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override;
bool isClosed();
private: