目录

CLASS info
public class FingerprintManager extends java.lang.Object
Represents an entry point for the API for checking whether fingerprint authentication of FIDO BioAuthn is available.

Constant Summary

TypeNameDesc
intFINGERPRINT_ACQUIRED_GOODThe obtained fingerprint image is good.
intFINGERPRINT_ACQUIRED_PARTIALThe detected fingerprint image is incomplete.
intFINGERPRINT_ACQUIRED_INSUFFICIENTThe fingerprint image is too noisy due to a detected condition (that is, dry skin) or a possible dirty sensor.
intFINGERPRINT_ACQUIRED_IMAGER_DIRTYThe fingerprint image is too noisy due to suspected or detected dirt on the sensor.
intFINGERPRINT_ACQUIRED_TOO_SLOWThe fingerprint image cannot be read due to lack of motion.
intFINGERPRINT_ACQUIRED_TOO_FASTThe fingerprint image is incomplete due to quick motion.
intFINGERPRINT_ACQUIRED_VENDOR: 1038A fingerprint is detected.
intFINGERPRINT_ACQUIRED_VENDOR: 1012The fingerprint does not match.
intFINGERPRINT_SUCCESSNo error is detected.
intFINGERPRINT_ERROR_HW_UNAVAILABLEHardware is unavailable.
intFINGERPRINT_ERROR_UNABLE_TO_PROCESSThe sensor cannot process the current fingerprint image.
intFINGERPRINT_ERROR_TIMEOUTThe current request timed out.
intFINGERPRINT_ERROR_NO_SPACEThe storage space is insufficient for the operation.
intFINGERPRINT_ERROR_CANCELEDThe operation is canceled because the fingerprint authentication sensor is unavailable.
intFINGERPRINT_ERROR_LOCKOUTThe operation is canceled because the API is locked when the number of attempts reaches the maximum.
intFINGERPRINT_ERROR_VENDORA vendor-defined error occurred.
intFINGERPRINT_ERROR_LOCKOUT_PERMANENTThe operation is canceled when the number of fingerprint authentication locking times reaches the maximum.
intFINGERPRINT_ERROR_USER_CANCELEDThe user cancels the fingerprint authentication.
intFINGERPRINT_ERROR_NO_FINGERPRINTSThe user has not registered any fingerprints.
intFINGERPRINT_ERROR_HW_NOT_PRESENTNo fingerprint authentication hardware is provided.
intFINGERPRINT_ERROR_SYS_INTEGRITY_FAILEDThe device failed the system integrity check.
intFINGERPRINT_ERROR_CRYPTO_VERIFY_FAILEDThe fingerprint authentication result failed the key-based encryption verification.
intFINGERPRINT_ERROR_HMS_FRAMEWORK_ERRORAn HMS Core framework error occurred.
intFINGERPRINT_ERROR_UNSUPPORTED_OS_VERThis version of operating system does not support fingerprint authentication.

Public Constructor Summary

Method name

FingerprintManager(android.app.Activity activity, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Constructs a FingerprintManager object for fingerprint authentication. The object is used to call the BioAuthn fingerprint authentication API of HUAWEI FIDO.

FingerprintManager(android.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Constructs a FingerprintManager object for fingerprint authentication. The object is used to call the BioAuthn fingerprint authentication API of HUAWEI FIDO.

Public Method Summary

Return typeMethod name
int

canAuth()

Checks whether fingerprint authentication is available.

void

auth(final CryptoObject crypto)

Performs fingerprint authentication. This method is associated with a private key or public-private key pair, which can be used only after the user passes the fingerprint authentication.

void

auth()

Performs fingerprint authentication.

void

cancelAuth()

Cancels fingerprint authentication.

Constants

Constant
public static final int FINGERPRINT_ACQUIRED_GOOD

Value: 0

The obtained fingerprint image is good.

Constant
public static final int FINGERPRINT_ACQUIRED_PARTIAL

Value: 1

The detected fingerprint image is incomplete. If this error occurs during registration, provide a solution for the user, for example, pressing the sensor with force.

Constant
public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT

Value: 2

The fingerprint image is too noisy due to a detected condition (that is, dry skin) or a possible dirty sensor. For details about the constant indicating a dirty sensor, please refer to FINGERPRINT_ACQUIRED_IMAGER_DIRTY.

Constant
public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY

Value: 3

The fingerprint image is too noisy due to suspected or detected dirt on the sensor. For example, if FINGERPRINT_ACQUIRED_INSUFFICIENT is returned for multiple times or dirt is detected on the sensor (such as a stuck pixel or stripe), this value can be returned. When a user attempts to use the sensor again, ask the user to clean the sensor first.

Constant
public static final int FINGERPRINT_ACQUIRED_TOO_SLOW

Value: 4

The fingerprint image cannot be read due to lack of motion. This constant is most applicable to scenarios where linear array sensors that require sliding are used.

Constant
public static final int FINGERPRINT_ACQUIRED_TOO_FAST

Value: 5

The fingerprint image is incomplete due to quick motion. This error is most appropriate for linear array sensors. However, if a user moves their finger during fingerprint collection, this error may also occur. You shall ask the user to slowly (linearly) move their finger or place their finger on the sensor for a longer time.

public static final int FACE_ACQUIRED_VENDOR:1038

Value: 1038

Returned using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.A fingerprint is detected.

Constant
public static final int FACE_ACQUIRED_VENDOR:1012

Value: 1012

Returned using the helpCode parameter in the onAuthHelp method of BioAuthnCallback when the auth method is called.The fingerprint does not match.

Constant
public static final int FINGERPRINT_SUCCESS

Value: 0

Fingerprint authentication is available (with registered fingerprints and available authentication hardware).

Constant
public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE

Value: 1

Hardware is unavailable.

Constant
public static final int FINGERPRINT_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 fingerprint image.

Constant
public static final int FINGERPRINT_ERROR_TIMEOUT

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

The current request timed out. The timeout mechanism prevents infinite waiting for the fingerprint sensor’s response. The timeout interval varies according to the user device and sensor. Generally, the timeout interval is 30 seconds.

Constant
public static final int FINGERPRINT_ERROR_NO_SPACE

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

The storage space is insufficient for the operation such as registration.

Constant
public static final int FINGERPRINT_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 fingerprint authentication sensor is unavailable.

Constant
public static final int FINGERPRINT_ERROR_LOCKOUT

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

The operation is canceled because the API is locked when the number of attempts reaches the maximum. The API is locked for 30 seconds after five attempt failures.

Constant
public static final int ERROR_VENDOR

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

A vendor-defined error occurred.

Constant
public static final int FINGERPRINT_ERROR_LOCKOUT_PERMANENT

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

The operation is canceled when the number of fingerprint authentication locking times reaches the maximum. Then, fingerprint authentication is disabled until the user is authenticated in a stronger authentication mode, including PIN, pattern, and password authentication.

Constant
public static final int FINGERPRINT_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. After receiving this error code, the app enables the standby authentication mode, for example, password authentication. The app also needs to provide the fingerprint authentication enabling method, for example, a button.

Constant
public static final int FINGERPRINT_ERROR_NO_FINGERPRINTS
Value: 11The user has not registered any fingerprints.
Constant
public static final int FINGERPRINT_ERROR_NO_FINGERPRINTS
Returned by the canAuth method.Value: 12No fingerprint authentication hardware is provided.
Constant
public static final int FINGERPRINT_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 FINGERPRINT_ERROR_CRYPTO_VERIFY_FAILED

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

The fingerprint authentication result failed the key-based encryption verification.

Constant
public static final int FINGERPRINT_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 FINGERPRINT_ERROR_UNSUPPORTED_OS_VER

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

This version of operating system does not support fingerprint authentication. Fingerprint authentication of FIDO BioAuthn is available only to devices running Android 6.0 or later.

Public Constructors

Method
public FingerprintManager(android.app.FragmentActivity activity, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Parameters

Parameter nameParameter desc
activityActivity of an Android app, which references the activity of the client.
executorExecutor for processing the callback event.
callbackCallback object for processing the authentication event.
Method
public FingerprintManager(android.app.Fragment fragment, java.util.concurrent.Executor executor, BioAuthnCallback callback)

Parameters

Parameter nameParameter desc
fragmentFragment of an Android app, which references the fragment of the client.
executorExecutor for processing the callback event.
callbackCallback object for processing the authentication event.

Public Methods

Method
public int canAuth()
Checks whether fingerprint authentication is available.

Return

typedesc
int

FINGERPRINT_SUCCESS: 

Fingerprint authentication is available (with registered fingerprints and available authentication hardware).

FINGERPRINT_ERROR_HW_UNAVAILABLE: 

Hardware is unavailable.

FINGERPRINT_ERROR_NO_FINGERPRINTS: 

The user has not registered any fingerprints.

FINGERPRINT_ERROR_NO_HARDWARE: 

No fingerprint authentication hardware is provided.

FINGERPRINT_ERROR_UNSUPPORTED_OS_VER:

This version of operating system does not support fingerprint authentication.

Method
public void auth(final CryptoObject crypto)
Performs fingerprint authentication. This method is associated with a private key or public-private key pair, which can be used only after the user passes the fingerprint authentication.

Parameters

Parameter nameParameter desc
cryptoEncryption object associated with fingerprint authentication.
Method
public void auth()
Performs fingerprint authentication.
Method
public void cancelAuth()
Closes the fingerprint authentication pop-up.