aboutsummaryrefslogtreecommitdiff
path: root/org.ifaa.android.manager/src/org/ifaa/android/manager/IFAAManager.java
blob: 82cb659d2b71fdc10cb1768a6d26ce989d959b7d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package org.ifaa.android.manager;

import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Build.VERSION;
import android.os.SystemProperties;

public abstract class IFAAManager {
    private static final int IFAA_VERSION_V2 = 2;
    private static final int IFAA_VERSION_V3 = 3;
    private static final int IFAA_VERSION_V4 = 4;

    static int sIfaaVer;
    static boolean sIsFod = SystemProperties.getBoolean("ro.hardware.fp.fod", false);

    /**
     * 返回手机系统上支持的校验方式,目前IFAF协议1.0版本指纹为0x01、虹膜为0x02
     */
    @UnsupportedAppUsage
    public abstract int getSupportBIOTypes(Context context);

    /**
     * 启动系统的指纹/虹膜管理应用界面,让用户进行指纹录入。指纹录入是在系统的指纹管理应用中实现的,
     * 本函数的作用只是将指纹管理应用运行起来,直接进行页面跳转,方便用户录入。
     * @param context
     * @param authType 生物特征识别类型,指纹为1,虹膜为2
     * @return 0,成功启动指纹管理应用;-1,启动指纹管理应用失败。
     */
    @UnsupportedAppUsage
    public abstract int startBIOManager(Context context, int authType);

    /**
     * 通过ifaateeclient的so文件实现REE到TA的通道
     * @param context
     * @param param 用于传输到IFAA TA的数据buffer
     * @return IFAA TA返回给REE数据buffer
     */
    @UnsupportedAppUsage
    public native byte[] processCmd(Context context, byte[] param);

    /**
     * 获取设备型号,同一款机型型号需要保持一致
     */
    @UnsupportedAppUsage
    public abstract String getDeviceModel();

    /**
     * 获取IFAAManager接口定义版本,目前为1
     */
    @UnsupportedAppUsage
    public abstract int getVersion();

    /**
     * load so to communicate from REE to TEE
     */
    static {
        sIfaaVer = 1;

        if (VERSION.SDK_INT >= 28) {
            sIfaaVer = IFAA_VERSION_V4;
        } else if (sIsFod) {
            sIfaaVer = IFAA_VERSION_V3;
        } else if (VERSION.SDK_INT >= 24) {
            sIfaaVer = IFAA_VERSION_V2;
        } else {
            System.loadLibrary("teeclientjni"); //teeclientjni for TA test binary //ifaateeclient
        }
    }
}