Update the enrollment API

Bug: 174619156
Test: m android.hardware.biometrics.face-update-api
Change-Id: I4683ef3217a3053363cae460a961a75d90cf2e51
This commit is contained in:
Ilya Matyukhin 2020-12-29 14:41:23 -08:00
parent 69fff4b8a9
commit 330dae0264
24 changed files with 501 additions and 20 deletions

View file

@ -0,0 +1,23 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@VintfStability
parcelable AuthenticationFrame {
android.hardware.biometrics.face.BaseFrame data;
}

View file

@ -0,0 +1,28 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@VintfStability
parcelable BaseFrame {
android.hardware.biometrics.face.AcquiredInfo acquiredInfo;
int vendorCode;
float pan;
float tilt;
float distance;
boolean isCancellable;
}

View file

@ -0,0 +1,25 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@VintfStability
parcelable Cell {
int x;
int y;
int z;
}

View file

@ -0,0 +1,25 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@VintfStability
parcelable EnrollmentFrame {
@nullable android.hardware.biometrics.face.Cell cell;
android.hardware.biometrics.face.EnrollmentStage stage;
android.hardware.biometrics.face.BaseFrame data;
}

View file

@ -0,0 +1,28 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@Backing(type="byte") @VintfStability
enum EnrollmentStage {
FIRST_FRAME_RECEIVED = 0,
WAITING_FOR_CENTERING = 1,
HOLD_STILL_IN_CENTER = 2,
ENROLLING_MOVEMENT_1 = 3,
ENROLLING_MOVEMENT_2 = 4,
ENROLLMENT_FINISHED = 5,
}

View file

@ -0,0 +1,24 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@VintfStability
parcelable EnrollmentStageConfig {
android.hardware.biometrics.face.EnrollmentStage stage;
List<android.hardware.biometrics.face.Cell> cells;
}

View file

@ -0,0 +1,24 @@
///////////////////////////////////////////////////////////////////////////////
// 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.face;
@Backing(type="byte") @VintfStability
enum EnrollmentType {
DEFAULT = 0,
ACCESSIBILITY = 1,
}

View file

@ -21,7 +21,7 @@ package android.hardware.biometrics.face;
interface ISession {
void generateChallenge(in int cookie, in int timeoutSec);
void revokeChallenge(in int cookie, in long challenge);
android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.common.NativeHandle previewSurface);
android.hardware.biometrics.common.ICancellationSignal enroll(in int cookie, in android.hardware.biometrics.face.EnrollmentType enrollmentType, in android.hardware.keymaster.HardwareAuthToken hat, in android.hardware.common.NativeHandle previewSurface);
android.hardware.biometrics.common.ICancellationSignal authenticate(in int cookie, in long operationId);
android.hardware.biometrics.common.ICancellationSignal detectInteraction(in int cookie);
void enumerateEnrollments(in int cookie);

View file

@ -22,7 +22,8 @@ interface ISessionCallback {
void onStateChanged(in int cookie, in android.hardware.biometrics.face.SessionState state);
void onChallengeGenerated(in long challenge);
void onChallengeRevoked(in long challenge);
void onAcquired(in android.hardware.biometrics.face.AcquiredInfo info, in int vendorCode);
void onAuthenticationFrame(in android.hardware.biometrics.face.AuthenticationFrame frame);
void onEnrollmentFrame(in android.hardware.biometrics.face.EnrollmentFrame frame);
void onError(in android.hardware.biometrics.face.Error error, in int vendorCode);
void onEnrollmentProgress(in int enrollmentId, int remaining);
void onAuthenticationSucceeded(in int enrollmentId, in android.hardware.keymaster.HardwareAuthToken hat);

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.

View file

@ -0,0 +1,31 @@
/*
* 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.face;
import android.hardware.biometrics.face.BaseFrame;
/**
* Describes an individual frame captured during authentication.
*/
@VintfStability
parcelable AuthenticationFrame {
/**
* The frame metadata. Can be used by the framework to provide user feedback.
*/
BaseFrame data;
}

View file

@ -0,0 +1,68 @@
/*
* 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.face;
import android.hardware.biometrics.face.AcquiredInfo;
/**
* Metadata of an individual frame. Can be used by the framework to provide user feedback.
* This parcelable is part of AuthenticationFrame and EnrollmentFrame, and shouldn't be used
* independently of those parcelables.
*/
@VintfStability
parcelable BaseFrame {
/**
* Information about the frame that can be used by the framework to provide feedback to the
* user, for example ask the user to move their face in a certain way.
*/
AcquiredInfo acquiredInfo;
/**
* If acquiredInfo is set to AcquiredInfo::VENDOR. This is the index into the configuration
* "com.android.internal.R.array.face_acquired_vendor" that's installed on the vendor partition.
* Otherwise, this value must be ignored.
*/
int vendorCode;
/**
* Pan value. It is recommended to use the range of [-1, 1] to represent valid values, and
* anything outside of that range to represent errors. However, vendors are free to define
* their own way of representing valid values and errors.
*/
float pan;
/**
* Tilt value. It is recommended to use the range of [-1, 1] to represent valid values, and
* anything outside of that range to represent errors. However, vendors are free to define
* their own way of representing valid values and errors.
*/
float tilt;
/**
* Distance value. It is recommended to use the range of [-1, 1] to represent valid values, and
* anything outside of that range to represent errors. However, vendors are free to define
* their own way of representing valid values and errors.
*/
float distance;
/**
* Indicates that the HAL can no longer continue with authentication or enrollment. This allows
* the framework to correlate a failure condition with a particular AcquiredInfo, rather than
* having a sequence of AcquiredInfo + Error.
*/
boolean isCancellable;
}

View file

@ -0,0 +1,27 @@
/*
* 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.face;
/**
* Coordinates of an enrollment UI cell in a vendor-defined coordinate system.
*/
@VintfStability
parcelable Cell {
int x;
int y;
int z;
}

View file

@ -0,0 +1,42 @@
/*
* 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.face;
import android.hardware.biometrics.face.Cell;
import android.hardware.biometrics.face.EnrollmentStage;
import android.hardware.biometrics.face.BaseFrame;
/**
* Describes an individual frame captured during enrollment.
*/
@VintfStability
parcelable EnrollmentFrame {
/**
* The enrollment UI cell that was captured in this frame, or null if no cell was captured.
*/
@nullable Cell cell;
/**
* The enrollment stage for which this frame was captured.
*/
EnrollmentStage stage;
/**
* The frame metadata. Can be used by the framework to provide user feedback.
*/
BaseFrame data;
}

View file

@ -0,0 +1,55 @@
/*
* 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.face;
/**
* Enrollment stages that can be mapped to the enrollment UI actions in the framework.
*/
@VintfStability
@Backing(type="byte")
enum EnrollmentStage {
/**
* HAL has obtained the first camera frame.
*/
FIRST_FRAME_RECEIVED,
/**
* HAL is waiting for the user's face to be centered.
*/
WAITING_FOR_CENTERING,
/**
* HAL is expecting the user's face to stay centered.
*/
HOLD_STILL_IN_CENTER,
/**
* Vendor defined movement 1.
*/
ENROLLING_MOVEMENT_1,
/**
* Vendor defined movement 2.
*/
ENROLLING_MOVEMENT_2,
/**
* HAL has finished the enrollment.
*/
ENROLLMENT_FINISHED,
}

View file

@ -0,0 +1,33 @@
/*
* 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.face;
import android.hardware.biometrics.face.Cell;
import android.hardware.biometrics.face.EnrollmentStage;
@VintfStability
parcelable EnrollmentStageConfig {
/**
* The stage that's being configured.
*/
EnrollmentStage stage;
/**
* Optional list of cells that must be completed to finish this stage.
*/
List<Cell> cells;
}

View file

@ -0,0 +1,24 @@
/*
* 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.face;
@VintfStability
@Backing(type="byte")
enum EnrollmentType {
DEFAULT,
ACCESSIBILITY,
}

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.

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.

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.

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.
@ -17,6 +17,7 @@
package android.hardware.biometrics.face;
import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.biometrics.face.EnrollmentType;
import android.hardware.keymaster.HardwareAuthToken;
import android.hardware.common.NativeHandle;
@ -84,6 +85,18 @@ interface ISession {
*/
void revokeChallenge(in int cookie, in long challenge);
/**
* getEnrollmentConfig:
*
* Returns the enrollment configuration depending on the provided enrollment type. Enrollment
* configuration determines how many stages the enrollment will have and the requirements for
* each of the stages.
*
* @param enrollmentType See the EnrollmentType enum.
* @return A list of EnrollmentStageConfig that describes each enrollment stage.
*
List<EnrollmentStageConfig> getEnrollmentConfig(in EnrollmentType enrollmentType);
/**
* enroll:
*
@ -118,6 +131,7 @@ interface ISession {
*
* @param cookie An identifier used to track subsystem operations related to this call path. The
* client must guarantee that it is unique per ISession.
* @param enrollmentType See the EnrollmentType enum.
* @param previewSurface A surface provided by the framework if SensorProps#halControlsPreview is
* set to true. The HAL must send the preview frames to previewSurface if
* it's not null.
@ -125,7 +139,8 @@ interface ISession {
* @return ICancellationSignal An object that can be used by the framework to cancel this
* operation.
*/
ICancellationSignal enroll(in int cookie, in HardwareAuthToken hat, in NativeHandle previewSurface);
ICancellationSignal enroll(in int cookie, in EnrollmentType enrollmentType,
in HardwareAuthToken hat, in NativeHandle previewSurface);
/**
* authenticate:

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.
@ -17,6 +17,8 @@
package android.hardware.biometrics.face;
import android.hardware.biometrics.face.AcquiredInfo;
import android.hardware.biometrics.face.AuthenticationFrame;
import android.hardware.biometrics.face.EnrollmentFrame;
import android.hardware.biometrics.face.Error;
import android.hardware.biometrics.face.SessionState;
import android.hardware.keymaster.HardwareAuthToken;
@ -40,20 +42,26 @@ interface ISessionCallback {
/**
* This method must only be used to notify the framework during the following states:
* 1) SessionState::ENROLLING
* 2) SessionState::AUTHENTICATING
* 3) SessionState::DETECTING_INTERACTION
* 1) SessionState::AUTHENTICATING
* 2) SessionState::DETECTING_INTERACTION
*
* These messages may be used to provide user guidance multiple times if necessary per
* operation.
*
* @param info See the AcquiredInfo enum.
* @param vendorCode Only valid if info == AcquiredInfo::VENDOR. The vendorCode must be used to
* index into the configuration
* com.android.internal.R.array.face_acquired_vendor that's installed
* on the vendor partition.
* @param frame See the AuthenticationFrame enum.
*/
void onAcquired(in AcquiredInfo info, in int vendorCode);
void onAuthenticationFrame(in AuthenticationFrame frame);
/**
* This method must only be used to notify the framework during the SessionState::ENROLLING
* state.
*
* These messages may be used to provide user guidance multiple times if necessary per
* operation.
*
* @param frame See the EnrollmentFrame enum.
*/
void onEnrollmentFrame(in EnrollmentFrame frame);
/**
* This method must only be used to notify the framework during the following states:

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.

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.