Class Info |
|---|
public final class FaceManager Main entrance to the facial authentication API of FIDO. |
Return Code | Value | Description | Solution |
|---|---|---|---|
0 | Facial authentication is available. | - | |
1 | No authentication hardware is available. | Verify that the device works properly or use another device. | |
2 | The sensor cannot process the current face image. | Verify that the device works properly or use another device. | |
3 | The request timed out. | Try again. | |
4 | The storage space is insufficient for registration. | Verify that the device works properly or use another device. | |
5 | The operation is canceled because the facial authentication sensor is unavailable. | Verify that the device works properly or use another device. | |
6 | Face data failed to be deleted. | Verify that the device works properly or use another device. | |
7 | The number of unlocking attempts reaches the maximum. | - | |
8 | Vendor-defined errors. | - | |
9 | Facial authentication is disabled. | - | |
10 | The user cancels the authentication. | - | |
11 | No facial authentication template is enrolled before authentication. | - | |
12 | The device does not have a facial authentication sensor. | - | |
1000 | Vendor-defined errors. | - | |
1001 | The device failed the system integrity check. The possible cause is that the device is unlocked or rooted. | Use a device meeting the security requirements. | |
1002 | Facial authentication is not supported in this OS version. | - | |
1003 | Update HMS Core (APK) to the latest version and clear app data. | ||
0 | The obtained face image is clear. | - | |
1 | The face image does not meet the processing requirements. | - | |
2 | The obtained face image is too bright due to high illumination. | - | |
3 | The obtained face image is too dark due to low illumination. | - | |
4 | The face position is too close to the user device. | - | |
5 | The face position is too far away from the user device. | - | |
6 | The user device position is too high, and only the top part of the face is obtained. | - | |
7 | The user device position is too low, and only the bottom part of the face is obtained. | - | |
8 | The user device position is to the right, and only the right part of the face is obtained. | - | |
9 | The user device position is to the left, and only the left part of the face is obtained. | - | |
10 | The face moves too frequently during image collection. | - | |
11 | The user's focus is too far away from the sensor, and an important part of the user's face is not detected. | - | |
12 | The sensor detects no face. | - | |
13 | Vendor-defined errors. | - | |
1038 | A face was detected. (BioAuthnCallback#onAuthHelp) | - | |
1012 | The face does not match the enrolled one. (BioAuthnCallback#onAuthHelp) | - | |
1012 | The camera permission is not granted. (BioAuthnCallback#onAuthError) | - | |
1 | Face modality (2D or 3D) check is not supported. | - | |
2 | 2D face modality. | - | |
3 | 3D face modality. | - |
Constructor Name |
|---|
FaceManager(android.content.Context context) Constructs a FaceManager object for facial authentication, which is used to call the facial authentication API of FIDO BioAuthn. |
Qualifier and Type | Method Name and Description |
|---|---|
public int | canAuth() Checks whether facial authentication can be used, including checking whether facial authentication is supported in this OS version, whether the device hardware supports facial authentication, and whether a facial authentication template has been enrolled. |
public void | auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler) Initiates a facial authentication request on the device. |
public boolean | Checks whether the device supports facial recognition. The value true will be returned if the device supports facial recognition, and false otherwise. |
public boolean | Checks whether the device has an enrolled face. The value true will be returned if the device has an enrolled face, and false otherwise. |
public int | Checks whether the current face modality is 3D or 2D. |
Field |
|---|
public static final int FACE_SUCCESS errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 0 Facial authentication is available. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_HW_UNAVAILABLE errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1 No authentication hardware is available. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_UNABLE_TO_PROCESS errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 2 The sensor cannot process the current face image. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_TIMEOUT errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 3 The request timed out. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_NO_SPACE errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 4 The storage space is insufficient for registration. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_CANCELED errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 5 The operation is canceled because the facial authentication sensor is unavailable. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_UNABLE_TO_REMOVE errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 6 Failed to delete face data. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_LOCKOUT errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 7 The number of unlocking attempts reaches the maximum. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_VENDOR errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 8 Vendor-defined errors. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_LOCKOUT_PERMANENT errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 9 Facial authentication is disabled. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_USER_CANCELED errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 10 The user cancels the authentication. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_NOT_ENROLLED errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 11 No facial authentication template is enrolled before authentication. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_HW_NOT_PRESENT errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 12 The device does not have a facial authentication sensor. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_VENDOR_BASE errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1000 Vendor-defined errors. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_SYS_INTEGRITY_FAILED errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1001 The device failed the system integrity check, for example, the device has been rooted or the system integrity has been damaged. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_UNSUPPORTED_OS_VER errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1002 Facial authentication is not supported in this OS version. Facial authentication of FIDO BioAuthn can only be used on devices running EMUI 10.0.0 or later. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ERROR_HMS_FRAMEWORK_ERROR errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1003 An HMS Core framework error occurred. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_GOOD helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 0 The obtained face image is clear. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_INSUFFICIENT helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 1 The face image does not meet the processing requirements. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_BRIGHT helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 2 The obtained face image is too bright due to high illumination. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_DARK helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 3 The obtained face image is too dark due to low illumination. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_CLOSE helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 4 The face position is too close to the user device. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_FAR helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 5 The face position is too far away from the user device. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_HIGH helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 6 The user device position is too high, and only the top part of the face is obtained. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_LOW helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 7 The user device position is too low, and only the bottom part of the face is obtained. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_RIGHT helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 8 The user device position is to the right, and only the right part of the face is obtained. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_LEFT helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 9 The user device position is to the left, and only the left part of the face is obtained. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_MUCH_MOTION helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 10 The face moves too frequently during image collection. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_POOR_GAZE helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 11 The user's focus is too far away from the sensor, and an important part of the user's face is not detected. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_NOT_DETECTED helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 12 The sensor detects no face. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_ACQUIRED_VENDOR helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 13 Vendor-defined errors. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_MODALITY_UNSUPPORTED Return value of the getFaceModality method. Value: 1 Face modality (2D or 3D) check is not supported. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_MODALITY_2D Return value of the getFaceModality method. Value: 2 2D face modality. For other constant values, please refer to Constant-values. |
Field |
|---|
public static final int FACE_MODALITY_3D Return value of the getFaceModality method. Value: 3 3D face modality. For other constant values, please refer to Constant-values. |
Other Result Codes
Result Code | Description |
|---|---|
errorCode returned by the onAuthError method of BioAuthnCallback after the auth API is called. Value: 1012 The camera permission is not granted. (Result code passed to the callback: BioAuthnCallback#onAuthError) | |
helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 1038 A face was detected. (Result code passed to the callback: BioAuthnCallback#onAuthHelp) | |
helpCode returned by the onAuthHelp method of BioAuthnCallback after the auth API is called. Value: 1012 The face does not match the enrolled one. (Result code passed to the callback: BioAuthnCallback#onAuthHelp) |
Constructor |
|---|
public FaceManager(android.content.Context context) Constructs a FaceManager object for facial authentication, which is used to call the facial authentication API of FIDO BioAuthn. |
Parameters
Name | Description |
|---|---|
context | Context of an Android app. |
Method |
|---|
public int canAuth() Checks whether facial authentication can be used, including checking whether facial authentication is supported in this OS version, whether the device hardware supports facial authentication, and whether a facial authentication template has been enrolled. |
Returns
Type | Description |
|---|---|
int | FACE_SUCCESS: Facial authentication is available. (A valid facial template has been enrolled and the authentication hardware is available.) FACE_ERROR_NOT_ENROLLED: No facial authentication template is enrolled before authentication. FACE_ERROR_HW_UNAVAILABLE: The device hardware does not support facial authentication. FACE_ERROR_UNSUPPORTED_OS_VER: Facial authentication is not supported in this OS version. |
Method |
|---|
public void auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler) Initiates a facial authentication request on the device. |
Parameters
Name | Description |
|---|---|
crypto | Encryption object associated with the authentication. The value can be null. |
cancel | Cancellation signal object for canceling the authentication. The value can be null. |
flags | Authentication flag. The value should be 0. |
callback | Authentication result callback. The value cannot be null. |
handler | Authentication-related message processor object. The value can be null. |
Method |
|---|
public boolean isHardwareDetected() Checks whether facial authentication hardware exists and works properly. |
Returns
Type | Description |
|---|---|
boolean | true if facial authentication hardware exists and works properly; false otherwise. |
Method |
|---|
public boolean hasEnrolledTemplates() Checks whether at least one facial authentication template has been enrolled in the system. |
Returns
Type | Description |
|---|---|
boolean | true if at least one facial authentication template has been enrolled in the system; false otherwise. |
Method |
|---|
public int getFaceModality() Checks whether the current face modality is 3D or 2D. |
Returns
Type | Description |
|---|---|
int |
|