Merge "Add AIDL constants to framework constants" into sc-dev

This commit is contained in:
Kevin Chyn
2021-05-26 02:17:53 +00:00
committed by Android (Google) Code Review
4 changed files with 38 additions and 23 deletions

View File

@@ -53,9 +53,6 @@ public interface BiometricFaceConstants {
// authentication or removal. Must agree with the list in HAL h file // authentication or removal. Must agree with the list in HAL h file
// //
/**
* @hide
*/
@IntDef({FACE_ERROR_HW_UNAVAILABLE, @IntDef({FACE_ERROR_HW_UNAVAILABLE,
FACE_ERROR_UNABLE_TO_PROCESS, FACE_ERROR_UNABLE_TO_PROCESS,
FACE_ERROR_TIMEOUT, FACE_ERROR_TIMEOUT,
@@ -110,8 +107,6 @@ public interface BiometricFaceConstants {
/** /**
* The {@link FaceManager#remove} call failed. Typically this will happen when the * The {@link FaceManager#remove} call failed. Typically this will happen when the
* provided face id was incorrect. * provided face id was incorrect.
*
* @hide
*/ */
int FACE_ERROR_UNABLE_TO_REMOVE = 6; int FACE_ERROR_UNABLE_TO_REMOVE = 6;
@@ -160,8 +155,6 @@ public interface BiometricFaceConstants {
/** /**
* The user pressed the negative button. This is a placeholder that is currently only used * The user pressed the negative button. This is a placeholder that is currently only used
* by the support library. * by the support library.
*
* @hide
*/ */
int FACE_ERROR_NEGATIVE_BUTTON = 13; int FACE_ERROR_NEGATIVE_BUTTON = 13;
@@ -177,24 +170,23 @@ public interface BiometricFaceConstants {
* security update has addressed this issue. This error can be received if for example, * security update has addressed this issue. This error can be received if for example,
* authentication was requested with {@link Authenticators#BIOMETRIC_STRONG}, but the * authentication was requested with {@link Authenticators#BIOMETRIC_STRONG}, but the
* sensor's strength can currently only meet {@link Authenticators#BIOMETRIC_WEAK}. * sensor's strength can currently only meet {@link Authenticators#BIOMETRIC_WEAK}.
* @hide
*/ */
int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15; int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15;
/** /**
* Authentication cannot proceed because re-enrollment is required. * Authentication cannot proceed because re-enrollment is required.
* @hide
*/ */
int BIOMETRIC_ERROR_RE_ENROLL = 16; int BIOMETRIC_ERROR_RE_ENROLL = 16;
/** /**
* Unknown error received from the HAL. * Unknown error received from the HAL.
* @hide
*/ */
int FACE_ERROR_UNKNOWN = 17; int FACE_ERROR_UNKNOWN = 17;
/** /**
* @hide * Vendor codes received from the HAL start at 0. Codes that the framework exposes to keyguard
* append this value for some reason. We should probably remove this and just send the actual
* vendor code.
*/ */
int FACE_ERROR_VENDOR_BASE = 1000; int FACE_ERROR_VENDOR_BASE = 1000;
@@ -203,9 +195,6 @@ public interface BiometricFaceConstants {
// existing constants. These must agree with face@1.0/types.hal. // existing constants. These must agree with face@1.0/types.hal.
// //
/**
* @hide
*/
@IntDef({FACE_ACQUIRED_GOOD, @IntDef({FACE_ACQUIRED_GOOD,
FACE_ACQUIRED_INSUFFICIENT, FACE_ACQUIRED_INSUFFICIENT,
FACE_ACQUIRED_TOO_BRIGHT, FACE_ACQUIRED_TOO_BRIGHT,
@@ -229,7 +218,10 @@ public interface BiometricFaceConstants {
FACE_ACQUIRED_START, FACE_ACQUIRED_START,
FACE_ACQUIRED_SENSOR_DIRTY, FACE_ACQUIRED_SENSOR_DIRTY,
FACE_ACQUIRED_VENDOR, FACE_ACQUIRED_VENDOR,
FACE_ACQUIRED_UNKNOWN}) FACE_ACQUIRED_UNKNOWN,
FACE_ACQUIRED_FIRST_FRAME_RECEIVED,
FACE_ACQUIRED_DARK_GLASSES_DETECTED,
FACE_ACQUIRED_MOUTH_COVERING_DETECTED})
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@interface FaceAcquired {} @interface FaceAcquired {}
@@ -402,19 +394,35 @@ public interface BiometricFaceConstants {
/** /**
* Hardware vendors may extend this list if there are conditions that do not fall under one of * Hardware vendors may extend this list if there are conditions that do not fall under one of
* the above categories. Vendors are responsible for providing error strings for these errors. * the above categories. Vendors are responsible for providing error strings for these errors.
*
* @hide
*/ */
int FACE_ACQUIRED_VENDOR = 22; int FACE_ACQUIRED_VENDOR = 22;
/** /**
* Unknown acquired code received from the HAL. * Unknown acquired code received from the HAL.
* @hide
*/ */
int FACE_ACQUIRED_UNKNOWN = 23; int FACE_ACQUIRED_UNKNOWN = 23;
/** /**
* @hide * The first frame from the camera has been received.
*/
int FACE_ACQUIRED_FIRST_FRAME_RECEIVED = 24;
/**
* Dark glasses detected. This can be useful for providing relevant feedback to the user and
* enabling an alternative authentication logic if the implementation supports it.
*/
int FACE_ACQUIRED_DARK_GLASSES_DETECTED = 25;
/**
* A face mask or face covering detected. This can be useful for providing relevant feedback to
* the user and enabling an alternative authentication logic if the implementation supports it.
*/
int FACE_ACQUIRED_MOUTH_COVERING_DETECTED = 26;
/**
* Vendor codes received from the HAL start at 0. Codes that the framework exposes to keyguard
* append this value for some reason. We should probably remove this and just send the actual
* vendor code.
*/ */
int FACE_ACQUIRED_VENDOR_BASE = 1000; int FACE_ACQUIRED_VENDOR_BASE = 1000;
} }

View File

@@ -17,6 +17,7 @@
package android.hardware.face; package android.hardware.face;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.hardware.biometrics.BiometricFaceConstants;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
@@ -26,7 +27,7 @@ import android.os.Parcelable;
* @hide * @hide
*/ */
public final class FaceDataFrame implements Parcelable { public final class FaceDataFrame implements Parcelable {
private final int mAcquiredInfo; @BiometricFaceConstants.FaceAcquired private final int mAcquiredInfo;
private final int mVendorCode; private final int mVendorCode;
private final float mPan; private final float mPan;
private final float mTilt; private final float mTilt;
@@ -48,7 +49,7 @@ public final class FaceDataFrame implements Parcelable {
* @param isCancellable Whether the ongoing face operation should be canceled. * @param isCancellable Whether the ongoing face operation should be canceled.
*/ */
public FaceDataFrame( public FaceDataFrame(
int acquiredInfo, @BiometricFaceConstants.FaceAcquired int acquiredInfo,
int vendorCode, int vendorCode,
float pan, float pan,
float tilt, float tilt,
@@ -69,7 +70,7 @@ public final class FaceDataFrame implements Parcelable {
* @param vendorCode An integer representing a custom vendor-specific message. Ignored unless * @param vendorCode An integer representing a custom vendor-specific message. Ignored unless
* {@code acquiredInfo} is {@code FACE_ACQUIRED_VENDOR}. * {@code acquiredInfo} is {@code FACE_ACQUIRED_VENDOR}.
*/ */
public FaceDataFrame(int acquiredInfo, int vendorCode) { public FaceDataFrame(@BiometricFaceConstants.FaceAcquired int acquiredInfo, int vendorCode) {
mAcquiredInfo = acquiredInfo; mAcquiredInfo = acquiredInfo;
mVendorCode = vendorCode; mVendorCode = vendorCode;
mPan = 0f; mPan = 0f;
@@ -83,6 +84,7 @@ public final class FaceDataFrame implements Parcelable {
* *
* @see android.hardware.biometrics.BiometricFaceConstants * @see android.hardware.biometrics.BiometricFaceConstants
*/ */
@BiometricFaceConstants.FaceAcquired
public int getAcquiredInfo() { public int getAcquiredInfo() {
return mAcquiredInfo; return mAcquiredInfo;
} }

View File

@@ -1449,6 +1449,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
case FACE_ACQUIRED_ROLL_TOO_EXTREME: case FACE_ACQUIRED_ROLL_TOO_EXTREME:
return context.getString(R.string.face_acquired_roll_too_extreme); return context.getString(R.string.face_acquired_roll_too_extreme);
case FACE_ACQUIRED_FACE_OBSCURED: case FACE_ACQUIRED_FACE_OBSCURED:
case FACE_ACQUIRED_DARK_GLASSES_DETECTED:
case FACE_ACQUIRED_MOUTH_COVERING_DETECTED:
return context.getString(R.string.face_acquired_obscured); return context.getString(R.string.face_acquired_obscured);
case FACE_ACQUIRED_SENSOR_DIRTY: case FACE_ACQUIRED_SENSOR_DIRTY:
return context.getString(R.string.face_acquired_sensor_dirty); return context.getString(R.string.face_acquired_sensor_dirty);

View File

@@ -120,10 +120,13 @@ final class AidlConversionUtils {
return BiometricFaceConstants.FACE_ACQUIRED_SENSOR_DIRTY; return BiometricFaceConstants.FACE_ACQUIRED_SENSOR_DIRTY;
case AcquiredInfo.VENDOR: case AcquiredInfo.VENDOR:
return BiometricFaceConstants.FACE_ACQUIRED_VENDOR; return BiometricFaceConstants.FACE_ACQUIRED_VENDOR;
case AcquiredInfo.UNKNOWN:
case AcquiredInfo.FIRST_FRAME_RECEIVED: case AcquiredInfo.FIRST_FRAME_RECEIVED:
return BiometricFaceConstants.FACE_ACQUIRED_FIRST_FRAME_RECEIVED;
case AcquiredInfo.DARK_GLASSES_DETECTED: case AcquiredInfo.DARK_GLASSES_DETECTED:
return BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED;
case AcquiredInfo.MOUTH_COVERING_DETECTED: case AcquiredInfo.MOUTH_COVERING_DETECTED:
return BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED;
case AcquiredInfo.UNKNOWN:
default: default:
return BiometricFaceConstants.FACE_ACQUIRED_UNKNOWN; return BiometricFaceConstants.FACE_ACQUIRED_UNKNOWN;
} }