Class Info |
|---|
public final class FaceManager FIDO面容认证API的主入口。 |
返回码 | 值 | 描述 | 解决方法 |
|---|---|---|---|
0 | 面容认证可用。 | - | |
1 | 硬件不可用,稍后再试。 | 请检查手机是否故障或更换手机。 | |
2 | 传感器无法处理当前图像时返回错误状态。 | 请检查手机是否故障或更换手机。 | |
3 | 超时。 | 请重试。 | |
4 | 注册时没有足够的存储空间。 | 请检查手机是否故障或更换手机。 | |
5 | 由于面容认证传感器不可用,操作被取消。 | 请检查手机是否故障或更换手机。 | |
6 | 删除面容数据失败。 | 请检查手机是否故障或更换手机。 | |
7 | 解锁次数超过次数限制。 | - | |
8 | 可扩展。 | - | |
9 | 面容认证被禁用。 | - | |
10 | 用户取消了操作。 | - | |
11 | 认证之前面容认证模板未注册。 | - | |
12 | 设备没有面容传感器。 | - | |
1000 | 可扩展的基数。 | - | |
1001 | 系统完整性检查失败。 | 设备存在安全问题,例如被解锁或root。请使用符合安全要求的设备。 | |
1002 | 操作系统版本不支持面容认证。 | - | |
1003 | 更新HMS Core到最新版本,并清理应用数据。 | ||
0 | 获得的图像很好。 | - | |
1 | 当前检测到的情况,面容图像不足以处理。 | - | |
2 | 光线太强,获取的图像太亮。 | - | |
3 | 光线太暗,获取的图像太暗。 | - | |
4 | 面容太近了。 | - | |
5 | 面容太远了。 | - | |
6 | 手机太高,仅获取到的面容上部。 | - | |
7 | 手机太低,仅获取到的面容下部。 | - | |
8 | 手机太靠右,仅获取到的面容右部。 | - | |
9 | 手机太靠左,仅获取到的面容左部。 | - | |
10 | 在图像采集过程中,用户的面容移动过多。 | - | |
11 | 用户的注视偏离传感器太远,导致用户面容的重要部分被隐藏。 | - | |
12 | 传感器前面未检测到面容。 | - | |
13 | 可扩展。 | - | |
1038 | 检测到面容(BioAuthnCallback#onAuthHelp)。 | - | |
1012 | 面容不适配,中间状态(BioAuthnCallback#onAuthHelp)。 | - | |
1012 | 相机权限被禁止(BioAuthnCallback#onAuthError)。 | - | |
1 | 不支持面容模式3D或2D判断。 | - | |
2 | 面容模式2D。 | - | |
3 | 面容模式3D。 | - |
Constructor Name |
|---|
FaceManager(android.content.Context context) 构造一个用户可用于面容认证的FaceManager对象,这个对象用于调用FIDO BioAuthn面容认证API。 |
Qualifier and Type | Method Name and Description |
|---|---|
public int | canAuth() 确定是否可以使用面容认证,包括检测操作系统版本是否支持,硬件是否支持,面容认证模板是否已注册。 |
public void | auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler) 发起一次对当前设备的面容认证请求。 |
public boolean | 获取当前手机是否支持人脸识别,如果当前手机支持人脸识别返回true,如果当前手机不支持人脸识别返回false。 |
public boolean | 用于获取当前手机中是否有人脸录入,如果有人脸录入返回true,如果没有人脸录入返回false。 |
public int | 判断当前面容模式是3D还是2D。 |
Field |
|---|
public static final int FACE_SUCCESS 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:0 面容认证可用。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_HW_UNAVAILABLE 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1 硬件不可用,稍后再试。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_UNABLE_TO_PROCESS 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:2 传感器无法处理当前图像。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_TIMEOUT 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:3 超时。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_NO_SPACE 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:4 注册时没有足够的存储空间。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_CANCELED 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:5 由于面容认证传感器不可用,操作被取消。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_UNABLE_TO_REMOVE 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:6 删除面容数据失败。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_LOCKOUT 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:7 解锁次数超过次数限制。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_VENDOR 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:8 可扩展。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_LOCKOUT_PERMANENT 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:9 面容认证被禁用。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_USER_CANCELED 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:10 用户取消了操作。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_NOT_ENROLLED 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:11 认证之前面容认证模板未注册。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_HW_NOT_PRESENT 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:12 设备没有面容传感器。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_VENDOR_BASE 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1000 可扩展的基数。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_SYS_INTEGRITY_FAILED 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1001 系统完整性检查失败,比如root设备或完整性破坏。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_UNSUPPORTED_OS_VER 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1002 操作系统版本不支持面容认证。支持FIDO BioAuthn面容认证的设备需满足EMUI >=10.0.0。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ERROR_HMS_FRAMEWORK_ERROR 调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1003 HMS Core SDK框架错误码。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_GOOD 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:0 获得的图像很好。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_INSUFFICIENT 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:1 当前检测到的情况,面容图像不足以处理。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_BRIGHT 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:2 光线太强,获取的图像太亮。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_DARK 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:3。 光线太暗,获取的图像太暗。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_CLOSE 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:4 面容太近了。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_FAR 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:5 面容太远了。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_HIGH 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:6 手机太高,仅获取到的面容上部。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_LOW 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:7 手机太低,仅获取到的面容下部。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_RIGHT 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:8 手机太靠右,仅获取到的面容右部。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_LEFT 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:9 手机太靠左,仅获取到的面容左部。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_TOO_MUCH_MOTION 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:10 在图像采集过程中,用户的面容移动过多。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_POOR_GAZE 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:11 用户的注视偏离传感器太远,导致用户面容的重要部分被隐藏。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_NOT_DETECTED 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:12 传感器前面未检测到面容。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_ACQUIRED_VENDOR 调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:13 可扩展。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_MODALITY_UNSUPPORTED 调用getFaceModality接口时的返回值。 参数返回值:1 不支持面容模式3D或2D判断。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_MODALITY_2D 调用getFaceModality接口时的返回值。 参数返回值:2 面容模式2D。其余常量值参阅:Constant-values |
Field |
|---|
public static final int FACE_MODALITY_3D 调用getFaceModality接口时的返回值。 参数返回值:3 面容模式3D。其余常量值参阅:Constant-values |
其他错误码
错误码 | 描述 |
|---|---|
调用auth接口,回调对象BioAuthnCallback的onAuthError方法,返回的errorCode。 参数返回值:1012 相机权限被禁止。(回调函数传递错误码:BioAuthnCallback#onAuthError) | |
调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:1038 检测到面容。(回调函数传递错误码:BioAuthnCallback#onAuthHelp) | |
调用auth接口,回调对象BioAuthnCallback的onAuthHelp方法,返回的helpCode。 参数返回值:1012 面容不匹配。(回调函数传递错误码:BioAuthnCallback#onAuthHelp) |
Constructor |
|---|
public FaceManager(android.content.Context context) 构造一个用户可用于面容认证的FaceManager对象,这个对象用于调用FIDO BioAuthn面容认证API。 |
Parameters
Name | Description |
|---|---|
context | 安卓应用的Context。 |
Method |
|---|
public int canAuth() 确定是否可以使用面容认证,包括检测操作系统版本是否支持,硬件是否支持,面容认证模板是否已注册。 |
Returns
Type | Description |
|---|---|
int | FACE_SUCCESS:当前可以使用面容认证(已注册且可用)。 FACE_ERROR_NOT_ENROLLED:认证之前面容认证模板未注册。 FACE_ERROR_HW_UNAVAILABLE:设备硬件不支持。 FACE_ERROR_UNSUPPORTED_OS_VER:操作系统版本不支持面容认证。 |
Method |
|---|
public void auth(final CryptoObject crypto, final android.os.CancellationSignal cancel, final int flags, final BioAuthnCallback callback, final android.os.Handler handler) 发起一次对当前设备的面容认证请求。 |
Parameters
Name | Description |
|---|---|
crypto | 跟本次认证相关联的密码学对象,可以为null。 |
cancel | 用于取消本次认证的取消信号对象,可以为null。 |
flags | 认证标记,应该为0。 |
callback | 认证结果回调对象,不可以为null。 |
handler | 认证相关消息处理器对象,可以为null。 |
Method |
|---|
public boolean isHardwareDetected() 确定面容认证硬件是否存在并正常工作。 |
Returns
Type | Description |
|---|---|
boolean |
|
Method |
|---|
public boolean hasEnrolledTemplates() 确定系统是否至少注册了一张面容认证模板。 |
Returns
Type | Description |
|---|---|
boolean |
|
Method |
|---|
public int getFaceModality() 判断当前面容模式是3D还是2D。 |
Returns
Type | Description |
|---|---|
int |
|