summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Kevin Chyn <kchyn@google.com> 2021-05-26 02:17:53 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-05-26 02:17:53 +0000
commit90135f22d9d3622b01cd41b3b4a2d66bd5ff9fdb (patch)
tree3f9376f358afafc3c70f07c62a4bb4f9cf88b9fb
parent4fe3d7ecaf2813c68fdc38c50977daeb3f01954b (diff)
parent9e1ae2cec00e6683282548af99bde8cb610735da (diff)
Merge "Add AIDL constants to framework constants" into sc-dev
-rw-r--r--core/java/android/hardware/biometrics/BiometricFaceConstants.java46
-rw-r--r--core/java/android/hardware/face/FaceDataFrame.java8
-rw-r--r--core/java/android/hardware/face/FaceManager.java2
-rw-r--r--services/core/java/com/android/server/biometrics/sensors/face/aidl/AidlConversionUtils.java5
4 files changed, 38 insertions, 23 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricFaceConstants.java b/core/java/android/hardware/biometrics/BiometricFaceConstants.java
index 83e273a91f91..fe43c83d17f1 100644
--- a/core/java/android/hardware/biometrics/BiometricFaceConstants.java
+++ b/core/java/android/hardware/biometrics/BiometricFaceConstants.java
@@ -53,9 +53,6 @@ public interface BiometricFaceConstants {
// authentication or removal. Must agree with the list in HAL h file
//
- /**
- * @hide
- */
@IntDef({FACE_ERROR_HW_UNAVAILABLE,
FACE_ERROR_UNABLE_TO_PROCESS,
FACE_ERROR_TIMEOUT,
@@ -110,8 +107,6 @@ public interface BiometricFaceConstants {
/**
* The {@link FaceManager#remove} call failed. Typically this will happen when the
* provided face id was incorrect.
- *
- * @hide
*/
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
* by the support library.
- *
- * @hide
*/
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,
* authentication was requested with {@link Authenticators#BIOMETRIC_STRONG}, but the
* sensor's strength can currently only meet {@link Authenticators#BIOMETRIC_WEAK}.
- * @hide
*/
int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15;
/**
* Authentication cannot proceed because re-enrollment is required.
- * @hide
*/
int BIOMETRIC_ERROR_RE_ENROLL = 16;
/**
* Unknown error received from the HAL.
- * @hide
*/
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;
@@ -203,9 +195,6 @@ public interface BiometricFaceConstants {
// existing constants. These must agree with face@1.0/types.hal.
//
- /**
- * @hide
- */
@IntDef({FACE_ACQUIRED_GOOD,
FACE_ACQUIRED_INSUFFICIENT,
FACE_ACQUIRED_TOO_BRIGHT,
@@ -229,7 +218,10 @@ public interface BiometricFaceConstants {
FACE_ACQUIRED_START,
FACE_ACQUIRED_SENSOR_DIRTY,
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)
@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
* the above categories. Vendors are responsible for providing error strings for these errors.
- *
- * @hide
*/
int FACE_ACQUIRED_VENDOR = 22;
/**
* Unknown acquired code received from the HAL.
- * @hide
*/
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;
}
diff --git a/core/java/android/hardware/face/FaceDataFrame.java b/core/java/android/hardware/face/FaceDataFrame.java
index 092359c99173..4dbfc85f0969 100644
--- a/core/java/android/hardware/face/FaceDataFrame.java
+++ b/core/java/android/hardware/face/FaceDataFrame.java
@@ -17,6 +17,7 @@
package android.hardware.face;
import android.annotation.NonNull;
+import android.hardware.biometrics.BiometricFaceConstants;
import android.os.Parcel;
import android.os.Parcelable;
@@ -26,7 +27,7 @@ import android.os.Parcelable;
* @hide
*/
public final class FaceDataFrame implements Parcelable {
- private final int mAcquiredInfo;
+ @BiometricFaceConstants.FaceAcquired private final int mAcquiredInfo;
private final int mVendorCode;
private final float mPan;
private final float mTilt;
@@ -48,7 +49,7 @@ public final class FaceDataFrame implements Parcelable {
* @param isCancellable Whether the ongoing face operation should be canceled.
*/
public FaceDataFrame(
- int acquiredInfo,
+ @BiometricFaceConstants.FaceAcquired int acquiredInfo,
int vendorCode,
float pan,
float tilt,
@@ -69,7 +70,7 @@ public final class FaceDataFrame implements Parcelable {
* @param vendorCode An integer representing a custom vendor-specific message. Ignored unless
* {@code acquiredInfo} is {@code FACE_ACQUIRED_VENDOR}.
*/
- public FaceDataFrame(int acquiredInfo, int vendorCode) {
+ public FaceDataFrame(@BiometricFaceConstants.FaceAcquired int acquiredInfo, int vendorCode) {
mAcquiredInfo = acquiredInfo;
mVendorCode = vendorCode;
mPan = 0f;
@@ -83,6 +84,7 @@ public final class FaceDataFrame implements Parcelable {
*
* @see android.hardware.biometrics.BiometricFaceConstants
*/
+ @BiometricFaceConstants.FaceAcquired
public int getAcquiredInfo() {
return mAcquiredInfo;
}
diff --git a/core/java/android/hardware/face/FaceManager.java b/core/java/android/hardware/face/FaceManager.java
index 55c90ce2a32f..12557f9b73eb 100644
--- a/core/java/android/hardware/face/FaceManager.java
+++ b/core/java/android/hardware/face/FaceManager.java
@@ -1449,6 +1449,8 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
case FACE_ACQUIRED_ROLL_TOO_EXTREME:
return context.getString(R.string.face_acquired_roll_too_extreme);
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);
case FACE_ACQUIRED_SENSOR_DIRTY:
return context.getString(R.string.face_acquired_sensor_dirty);
diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/AidlConversionUtils.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/AidlConversionUtils.java
index 6ad4308d7608..573c20fe041b 100644
--- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/AidlConversionUtils.java
+++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/AidlConversionUtils.java
@@ -120,10 +120,13 @@ final class AidlConversionUtils {
return BiometricFaceConstants.FACE_ACQUIRED_SENSOR_DIRTY;
case AcquiredInfo.VENDOR:
return BiometricFaceConstants.FACE_ACQUIRED_VENDOR;
- case AcquiredInfo.UNKNOWN:
case AcquiredInfo.FIRST_FRAME_RECEIVED:
+ return BiometricFaceConstants.FACE_ACQUIRED_FIRST_FRAME_RECEIVED;
case AcquiredInfo.DARK_GLASSES_DETECTED:
+ return BiometricFaceConstants.FACE_ACQUIRED_DARK_GLASSES_DETECTED;
case AcquiredInfo.MOUTH_COVERING_DETECTED:
+ return BiometricFaceConstants.FACE_ACQUIRED_MOUTH_COVERING_DETECTED;
+ case AcquiredInfo.UNKNOWN:
default:
return BiometricFaceConstants.FACE_ACQUIRED_UNKNOWN;
}