目录

Constant Summary

TypeNameDesc
intFACE_SUCCESS3D facial authentication is available.
intFACE_ERROR_HW_UNAVAILABLEHardware is unavailable. Try again later.
intFACE_ERROR_UNABLE_TO_PROCESSThe sensor cannot process the current face image.
intFACE_ERROR_TIMEOUTThe request timed out.
intFACE_ERROR_NO_SPACEThe storage space is insufficient for registration.
intFACE_ERROR_CANCELEDThe operation is canceled because the 3D facial authentication sensor is unavailable.
intFACE_ERROR_UNABLE_TO_REMOVEFailed to delete the facial data.
intFACE_ERROR_LOCKOUTThe number of unlocking times reaches the maximum.
intFACE_ERROR_VENDORVendor-defined errors.
intFACE_ERROR_LOCKOUT_PERMANENT3D facial authentication is disabled.
intFACE_ERROR_USER_CANCELEDThe user cancels the 3D facial authentication.
intFACE_ERROR_NOT_ENROLLEDNo 3D facial authentication template is registered before authentication.
intFACE_ERROR_HW_NOT_PRESENTThe user device is not equipped with a facial sensor.
intFACE_ERROR_VENDOR_BASEStart error code of vendor-defined errors.
intFACE_ERROR_SYS_INTEGRITY_FAILEDThe device failed the system integrity check.
intFACE_ERROR_UNSUPPORTED_OS_VERThis version of operating system does not support 3D facial authentication.
intFACE_ERROR_HMS_FRAMEWORK_ERRORHUAWEI HMS Framework error.
intFACE_ERROR_VENDOR:1012Camera permission forbidden.
intFACE_ACQUIRED_GOODThe obtained face image is good.
intFACE_ACQUIRED_INSUFFICIENTThe face image does not meet the processing requirements.
intFACE_ACQUIRED_TOO_BRIGHTThe obtained face image is too bright due to high illumination.
intFACE_ACQUIRED_TOO_DARKThe obtained face image is too dark due to low illumination.
intFACE_ACQUIRED_TOO_CLOSEThe face position is too close to the user device.
intFACE_ACQUIRED_TOO_FARThe face is too far away.
intFACE_ACQUIRED_TOO_HIGHThe user device position is too high, and only the top part of the face is obtained.
intFACE_ACQUIRED_TOO_LOWThe user device position is too low, and only the lower part of the face is obtained.
intFACE_ACQUIRED_TOO_RIGHTThe user device position is to the right, and only the right part of the face is obtained.
intFACE_ACQUIRED_TOO_LEFTThe user device position is to the left, and only the left part of the face is obtained.
intFACE_ACQUIRED_TOO_MUCH_MOTIONThe face moves too many times during image collection.
intFACE_ACQUIRED_POOR_GAZEThe user’s focus is too far away from the sensor, and an important part of the user’s face is hidden.
intFACE_ACQUIRED_NOT_DETECTEDThe sensor detects no face.
intFACE_ACQUIRED_VENDORVendor-defined errors.
int1012The face does not match.(BioAuthnCallback#onAuthHelp)
int1038The sensor detected face.(BioAuthnCallback#onAuthHelp)
int1012

Camera permission forbidden.(BioAuthnCallback#onAuthError)

Public Constructor Summary

Method name

FaceManager(android.content.Context context) 

Constructs a FaceManager object for 3D facial authentication, which is used to call the 3D facial authentication API of FIDO BioAuthn.

Public Method Summary

Return typeMethod name
int

canAuth()

Checks whether 3D facial authentication can be used, including checking whether the operating system version supports 3D facial authentication, whether hardware supports 3D facial authentication, and whether the 3D facial authentication template has been registered.

void

auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler)

Sends a 3D facial authentication request to the user device.

boolean

isHardwareDetected()

Checks whether 3D facial authentication hardware exists and is running properly.

boolean

hasEnrolledTemplates()

Checks whether at least one 3D facial authentication template has been registered in the system.

Constants

Constant
public static final int FACE_SUCCESS

Returned by the canAuth API; 

Value: 0

3D facial authentication is available.

Constant
public static final int FACE_ERROR_HW_UNAVAILABLE

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called;Returned by the canAuth API; 

Value: 1

Hardware is unavailable. Try again later.

Constant
public static final int FACE_ERROR_UNABLE_TO_PROCESS

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 2

The sensor cannot process the current face image.

Constant
public static final int FACE_ERROR_TIMEOUT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 3

The request timed out.

Constant
public static final int FACE_ERROR_NO_SPACE

Value: 4

The storage space is insufficient for registration.

Constant
public static final int FACE_ERROR_CANCELED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 5

The operation is canceled because the 3D facial authentication sensor is unavailable.

Constant
public static final int FACE_ERROR_UNABLE_TO_REMOVE

Value: 6

Failed to delete the facial data.

Constant
public static final int FACE_ERROR_LOCKOUT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 7

The number of unlocking times reaches the maximum.

Constant
public static final int FACE_ERROR_VENDOR

Value: 8

Vendor-defined errors.

Constant
public static final int FACE_ERROR_LOCKOUT_PERMANENT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 9

3D facial authentication is disabled.

Constant
public static final int FACE_ERROR_USER_CANCELED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 10

The user cancels the 3D facial authentication.

Constant
public static final int FACE_ERROR_NOT_ENROLLED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called;Returned by the canAuth API; 

Value: 11

No 3D facial authentication template is registered before authentication.

Constant
public static final int FACE_ERROR_HW_NOT_PRESENT

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 12

The user device is not equipped with a facial sensor.

Constant
public static final int FACE_ERROR_VENDOR_BASE

Value: 1000

Start error code of vendor-defined errors.

Constant
public static final int FACE_ERROR_SYS_INTEGRITY_FAILED

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 1001

The device failed the system integrity check, for example, the device is rooted or the system integrity is damaged.

Constant
public static final int FACE_ERROR_UNSUPPORTED_OS_VER

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called;Returned by the canAuth API; 

Value: 1002

This version of operating system does not support 3D facial authentication. The EMUI version of a user device supporting 3D facial authentication of FIDO BioAuthn must be 10.0.0 or later.

Constant
public static final int FACE_ERROR_HMS_FRAMEWORK_ERROR

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called; 

Value: 1003

HUAWEI HMS Framework error.

Constant
public static final int FACE_ACQUIRED_GOOD

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 0

The obtained face image is good.

Constant
public static final int FACE_ACQUIRED_INSUFFICIENT

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 1

The face image does not meet the processing requirements.

Constant
public static final int FACE_ACQUIRED_TOO_BRIGHT

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 2

The obtained face image is too bright due to high illumination.

Constant
public static final int FACE_ACQUIRED_TOO_DARK

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 3

The obtained face image is too dark due to low illumination.

Constant
public static final int FACE_ACQUIRED_TOO_CLOSE

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 4

The face position is too close to the user device.

Constant
public static final int FACE_ACQUIRED_TOO_FAR

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 5

The face is too far away.

Constant
public static final int FACE_ACQUIRED_TOO_HIGH

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 6

The user device position is too high, and only the top part of the face is obtained.

Constant
public static final int FACE_ACQUIRED_TOO_LOW

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 7

The user device position is too low, and only the lower part of the face is obtained.

Constant
public static final int FACE_ACQUIRED_TOO_RIGHT

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 8

The user device position is to the right, and only the right part of the face is obtained.

Constant
public static final int FACE_ACQUIRED_TOO_LEFT

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 9

The user device position is to the left, and only the left part of the face is obtained.

Constant
public static final int FACE_ACQUIRED_TOO_MUCH_MOTION

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 10

The face moves too many times during image collection.

Constant
public static final int FACE_ACQUIRED_POOR_GAZE

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method 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 hidden.

Constant
public static final int FACE_ACQUIRED_NOT_DETECTED

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 12

The sensor detects no face.

Constant
public static final int FACE_ACQUIRED_VENDOR

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called; 

Value: 13

Vendor-defined errors.

Other Error Code

Error Codedescription
1012

Returned in the errorCode parameter sent by the onAuthError method of BioAuthnCallback when the auth method is called;

Value: 1012

Camera permission forbidden.(BioAuthnCallback#onAuthError)

1038

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called;

Value: 1038

The sensor detected face.(BioAuthnCallback#onAuthHelp)

1012

Returned in the helpCode parameter sent by the onAuthHelp method of BioAuthnCallback when the auth method is called;

Value: 1012

The face does not match(BioAuthnCallback#onAuthHelp)

Public Constructors

Method
public FaceManager(android.content.Context context)
Constructs a FaceManager object for 3D facial authentication, which is used to call the 3D facial authentication API of FIDO BioAuthn.

Parameters

Parameter nameParameter desc
contextContext of an Android app.

Public Methods

Method
public int canAuth()
Checks whether 3D facial authentication can be used, including checking whether the operating system version supports 3D facial authentication, whether hardware supports 3D facial authentication, and whether the 3D facial authentication template has been registered.

Return

typedesc
int

FACE_SUCCESS

3D facial authentication is available (with faces registered and 3D facial authentication hardware available).

FACE_ERROR_NOT_ENROLLED

The 3D facial authentication template has not been registered before authentication.

FACE_ERROR_HW_UNAVAILABLE

The user device does not provide the 3D facial sensor.

FACE_ERROR_UNSUPPORTED_OS_VER

The operating system version does not support 3D facial authentication.

Method
public void auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler)
Sends a 3D facial authentication request to the user device.

Parameters

Parameter nameParameter desc
cryptoCryptographic object associated with the authentication. The value can be null.
cancelCancellation signal object for canceling this authentication. The value can be null.
flagsReserved.
callbackCallback. The value cannot be null.
handlerObject of the authentication-related message processor. The value can be null.
Method
public boolean isHardwareDetected()
Checks whether 3D facial authentication hardware exists and is running properly.

Return

typedesc
booleantrue: yes; false: no
Method
public boolean hasEnrolledTemplates()
Checks whether at least one 3D facial authentication template has been registered in the system.

Return

typedesc
booleantrue: yes; false: no