目录

Constant Summary

TypeNameDesc
intFACE_SUCCESS
3D面容认证可用。
intFACE_ERROR_HW_UNAVAILABLE硬件不可用,稍后再试。
intFACE_ERROR_UNABLE_TO_PROCESS传感器无法处理当前图像时返回错误状态。
intFACE_ERROR_TIMEOUT超时。
intFACE_ERROR_NO_SPACE注册时没有足够的存储空间。
intFACE_ERROR_CANCELED由于3D面容认证传感器不可用,操作被取消。
intFACE_ERROR_UNABLE_TO_REMOVE删除3D面容数据失败。
intFACE_ERROR_LOCKOUT解锁次数超过次数限制。
intFACE_ERROR_VENDOR可扩展。
intFACE_ERROR_LOCKOUT_PERMANENT3D面容认证被禁用。
intFACE_ERROR_USER_CANCELED用户取消了操作。
intFACE_ERROR_NOT_ENROLLED认证之前3D面容认证模板未注册。
intFACE_ERROR_HW_NOT_PRESENT设备没有3D面容传感器。
intFACE_ERROR_VENDOR_BASE可扩展的基数。
intFACE_ERROR_SYS_INTEGRITY_FAILED系统完整性检查失败。
intFACE_ERROR_UNSUPPORTED_OS_VER操作系统版本不支持3D面容认证。
intFACE_ERROR_HMS_FRAMEWORK_ERROR华为移动服务框架错误。
intFACE_ACQUIRED_GOOD获得的图像很好。
intFACE_ACQUIRED_INSUFFICIENT当前检测到的情况,3D面容图像不足以处理。
intFACE_ACQUIRED_TOO_BRIGHT光线太强,获取的图像太亮。
intFACE_ACQUIRED_TOO_DARK光线太暗,获取的图像太暗。
intFACE_ACQUIRED_TOO_CLOSE面容太近了。
intFACE_ACQUIRED_TOO_FAR面容太远了。
intFACE_ACQUIRED_TOO_HIGH手机太高,仅获取到的面容上部。
intFACE_ACQUIRED_TOO_LOW手机太低,仅获取到的面容下部。
intFACE_ACQUIRED_TOO_RIGHT手机太靠右,仅获取到的面容右部。
intFACE_ACQUIRED_TOO_LEFT手机太靠左,仅获取到的面容左部。
intFACE_ACQUIRED_TOO_MUCH_MOTION在图像采集过程中,用户的面容移动过多。
intFACE_ACQUIRED_POOR_GAZE用户的注视偏离传感器太远,导致用户面容的重要部分被隐藏。
intFACE_ACQUIRED_NOT_DETECTED传感器前面未检测到面容。
intFACE_ACQUIRED_VENDOR可扩展。
int1038检测到面容(BioAuthnCallback#onAuthHelp)。
int1012面容不适配,中间状态(BioAuthnCallback#onAuthHelp)。
int1012相机权限被禁止(BioAuthnCallback#onAuthError)。

Public Constructor Summary

Method name

FaceManager(android.content.Context context)

构造一个用户可用于3D面容认证的FaceManager对象,这个对象用于调用 FIDO BioAuthn 3D面容认证API。

Public Method Summary

Return typeMethod name
int

canAuth()

确定是否可以使用3D面容认证,包括检测操作系统版本是否支持,硬件是否支持,3D面容认证模板是否已注册。

void

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

发起一次对当前设备的3D面容认证请求。

boolean

isHardwareDetected()

确定3D面容认证硬件是否存在并正常工作。

boolean

hasEnrolledTemplates()

确定系统是否至少注册了一张3D面容认证模板。

Constants

Constant
public static final int FACE_SUCCESS

canAuth 接口的返回值: 0

3D面容认证可用。

Constant
public static final int FACE_ERROR_HW_UNAVAILABLE

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回;canAuth 接口的返回值: 1

硬件不可用,稍后再试。

Constant
public static final int FACE_ERROR_UNABLE_TO_PROCESS

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 2

传感器无法处理当前图像。

Constant
public static final int FACE_ERROR_TIMEOUT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 3

超时。

Constant
public static final int FACE_ERROR_NO_SPACE

值: 4

注册时没有足够的存储空间。

Constant
public static final int FACE_ERROR_CANCELED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 5

由于3D面容认证传感器不可用,操作被取消。

Constant
public static final int FACE_ERROR_UNABLE_TO_REMOVE

值: 6

删除3D面容数据失败。

Constant
public static final int FACE_ERROR_LOCKOUT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 7

解锁次数超过次数限制。

Constant
public static final int FACE_ERROR_VENDOR

值: 8

可扩展。

Constant
public static final int FACE_ERROR_LOCKOUT_PERMANENT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 9

3D面容认证被禁用。

Constant
public static final int FACE_ERROR_USER_CANCELED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 10

用户取消了操作。

Constant
public static final int FACE_ERROR_NOT_ENROLLED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回;canAuth 接口的返回值: 11

认证之前3D面容认证模板未注册。

Constant
public static final int FACE_ERROR_HW_NOT_PRESENT

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 12

设备没有3D面容传感器。

Constant
public static final int FACE_ERROR_VENDOR_BASE

值: 1000

可扩展的基数。

Constant
public static final int FACE_ERROR_SYS_INTEGRITY_FAILED

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1001

系统完整性检查失败,比如root设备,或 完整性破坏。

Constant
public static final int FACE_ERROR_UNSUPPORTED_OS_VER

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回;canAuth 接口的返回值: 1002

操作系统版本不支持3D面容认证。支持FIDO BioAuthn 3D面容认证的设备需满足 EMUI >=10.0.0。

Constant
public static final int FACE_ERROR_HMS_FRAMEWORK_ERROR

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1003

华为移动服务框架错误。

Constant
public static final int FACE_ACQUIRED_GOOD

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 0

获得的图像很好。

Constant
public static final int FACE_ACQUIRED_INSUFFICIENT

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 1

当前检测到的情况,面容图像不足以处理。

Constant
public static final int FACE_ACQUIRED_TOO_BRIGHT

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 2

光线太强,获取的图像太亮。

Constant
public static final int FACE_ACQUIRED_TOO_DARK

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 3

光线太暗,获取的图像太暗。

Constant
public static final int FACE_ACQUIRED_TOO_CLOSE

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 4

面容太近了。

Constant
public static final int FACE_ACQUIRED_TOO_FAR

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 5

面容太远了。

Constant
public static final int FACE_ACQUIRED_TOO_HIGH

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 6

手机太高,仅获取到的面容上部。

Constant
public static final int FACE_ACQUIRED_TOO_LOW

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 7

手机太低,仅获取到的面容下部。

Constant
public static final int FACE_ACQUIRED_TOO_RIGHT

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 8

手机太靠右,仅获取到的面容右部。

Constant
public static final int FACE_ACQUIRED_TOO_LEFT

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 9

手机太靠左,仅获取到的面容左部。

Constant
public static final int FACE_ACQUIRED_TOO_MUCH_MOTION

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 10

在图像采集过程中,用户的面容移动过多。

Constant
public static final int FACE_ACQUIRED_POOR_GAZE

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 11

用户的注视偏离传感器太远,导致用户面容的重要部分被隐藏。

Constant
public static final int FACE_ACQUIRED_NOT_DETECTED

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 12

传感器前面未检测到面容。

Constant
public static final int FACE_ACQUIRED_VENDOR

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数返回值: 13

可扩展。

其他错误码

错误码描述
1012

调用auth接口时通过回调对象BioAuthnCallback的onAuthError方法的errorCode参数返回值: 1012

相机权限被禁止。(BioAuthnCallback#onAuthError)

1038

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数,返回值: 1038

检测到3D面容。(BioAuthnCallback#onAuthHelp)

1012

调用auth接口时通过回调对象BioAuthnCallback的onAuthHelp方法的helpCode参数,返回值: 1012

面容不匹配。(BioAuthnCallback#onAuthHelp)


Public Constructors

Method
public FaceManager(android.content.Context context)
构造一个用户可用于3D面容认证的FaceManager对象,这个对象用于调用 FIDO BioAuthn 3D面容认证API。

Parameters

Parameter nameParameter desc
context安卓应用的 Context。

Public Methods

Method
public int canAuth()
确定是否可以使用3D面容认证,包括检测操作系统版本是否支持,硬件是否支持,3D面容认证模板是否已注册。

Return

typedesc
int

FACE_SUCCESS 

如果当前可以使用3D面容认证(已注册且可用)。

FACE_ERROR_NOT_ENROLLED 

如果认证之前3D面容认证模板未注册。

FACE_ERROR_HW_UNAVAILABLE 

如果设备硬件不支持,没有3D结构光。

FACE_ERROR_UNSUPPORTED_OS_VER 

如果操作系统版本不支持3D面容认证。

Method
public void auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler)
发起一次对当前设备的3D面容认证请求。

Parameters

Parameter nameParameter desc
crypto跟本次认证相关联的密码学对象,可以为null。
cancel用于取消本次认证的取消信号对象,可以为null。
flags认证标记,应该为0。
callback认证结果回调对象,不可以为null。
handler认证相关消息处理器对象,可以为null。
Method
public boolean isHardwareDetected()
确定3D面容认证硬件是否存在并正常工作。

Return

typedesc
boolean是:true, 否:false。
Method
public boolean hasEnrolledTemplates()
确定系统是否至少注册了一张3D面容认证模板。

Return

typedesc
boolean是:true, 否:false。