目录

CLASS info
public class FaceManager extends java.lang.Object
Represents the main entry for the BioAuthn 3D facial authentication API of HUAWEI FIDO.

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_TIMEOUTTimed 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 3D face data.
intFACE_ERROR_LOCKOUTThe number of unlocking times reaches the maximum.
intFACE_ERROR_VENDORVendor-defined error.
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 device does not have a 3D facial authentication sensor.
intFACE_ERROR_VENDOR_BASEStart result 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_ERRORHMS Core framework error.
intFACE_ERROR_VENDOR:1012The camera permission is disabled.
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 because of 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_FAR
The face position is too far from the user device.
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 high, and only the bottom 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 error.
intFACE_ACQUIRED_VENDOR:1038A face is detected.
intFACE_ACQUIRED_VENDOR:1012The face does not match.

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 method.Value: 0

3D facial authentication is available.

Constant
public static final int FACE_ERROR_HW_UNAVAILABLE

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Alternatively, returned by the canAuth method.Value: 1

Hardware is unavailable. Try again later.

Constant
public static final int FACE_ERROR_UNABLE_TO_PROCESS

Returned using the errorCode parameter in 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 using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Value: 3

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 using the errorCode parameter in 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 3D face data.

Constant
public static final int FACE_ERROR_LOCKOUT

Returned using the errorCode parameter in 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 error.

Constant
public static final int FACE_ERROR_LOCKOUT_PERMANENT

Returned using the errorCode parameter in 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 using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Value: 10

The user cancels the fingerprint authentication.

Constant
public static final int FACE_ERROR_NOT_ENROLLED

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Alternatively, returned by the canAuth method.Value: 11

No 3D facial authentication template is registered before authentication.

Constant
public static final int FACE_ERROR_HW_NOT_PRESENT

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Value: 12

The device does not have a 3D facial authentication sensor.

Constant
public static final int FACE_ERROR_VENDOR_BASE

Value: 1000

Start result code of vendor-defined errors.

Constant
public static final int FACE_ERROR_SYS_INTEGRITY_FAILED

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method 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.

Constant
public static final int FACE_ERROR_UNSUPPORTED_OS_VER

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Alternatively, returned by the canAuth method.Value: 1002

This version of operating system does not support 3D facial authentication. 3D facial authentication of FIDO BioAuthn is available only to devices running EMUI 10.0.0 or later.

Constant
public static final int FACE_ERROR_HMS_FRAMEWORK_ERROR

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Value: 1003

HMS Core framework error.

Constant
public static final int FACE_ERROR_VENDOR:1012

Returned using the errorCode parameter in the onAuthError method of BioAuthnCallback when the auth method is called.Value: 1012

The camera permission is disabled.

Constant
public static final int FACE_ACQUIRED_GOOD

Returned using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 2

The obtained face image is too bright because of high illumination.

Constant
public static final int FACE_ACQUIRED_TOO_DARK

Returned using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 5

The face position is too far from the user device.

Constant
public static final int FACE_ACQUIRED_TOO_HIGH

Returned using the helpCode parameter in 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 using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 7

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

Constant
public static final int FACE_ACQUIRED_TOO_RIGHT

Returned using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in 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 using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 13

Vendor-defined error.

Constant
public static final int FACE_ACQUIRED_VENDOR:1038

Returned using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 1038

A face is detected.

Constant
public static final int FACE_ACQUIRED_VENDOR:1012

Returned using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.Value: 1012

The face does not match.

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: 

Hardware is unavailable.

FACE_ERROR_UNSUPPORTED_OS_VER: 

This version of operating system 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
cryptoEncryption object associated with this 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: 3D facial authentication hardware exists and is running properly. false: 3D facial authentication hardware does not exist or is running improperly.
Method
public boolean hasEnrolledTemplates()
Checks whether at least one 3D facial authentication template has been registered in the system.

Return

typedesc
booleantrue: At least one 3D facial authentication template has been registered in the system. false: No 3D facial authentication template has been registered in the system.