关闭

文章标题

446人阅读 评论(0) 收藏 举报
void FingerprintDaemonProxy::notifyKeystore(const uint8_t *auth_token, const size_t auth_token_length) {
    if (auth_token != NULL && auth_token_length > 0) {
        // TODO: cache service?
        sp < IServiceManager > sm = defaultServiceManager();
        sp < IBinder > binder = sm->getService(String16("android.security.keystore"));
        sp < IKeystoreService > service = interface_cast < IKeystoreService > (binder);
        if (service != NULL) {
            status_t ret = service->addAuthToken(auth_token, auth_token_length);
            if (ret != ResponseCode::NO_ERROR) {
                ALOGE("Falure sending auth token to KeyStore: %d", ret);
            }
        } else {
            ALOGE("Unable to communicate with KeyStore");
        }
    }
}
void FingerprintDaemonProxy::hal_notify_callback(const fingerprint_msg_t *msg) {
    switch (msg->type) {
            case FINGERPRINT_AUTHENTICATED:
            if (msg->data.authenticated.finger.fid != 0) {
                const uint8_t* hat = reinterpret_cast<const uint8_t *>(&msg->data.authenticated.hat);
                instance->notifyKeystore(hat, sizeof(msg->data.authenticated.hat));
            }
            callback->onAuthenticated(device,
                    msg->data.authenticated.finger.fid,
                    msg->data.authenticated.finger.gid);
            break;
    }
}
void authenticate (FingerprintManager.CryptoObject crypto, 
                CancellationSignal cancel, 
                int flags, 
                FingerprintManager.AuthenticationCallback callback, 
                Handler handler)
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:245031次
    • 积分:4065
    • 等级:
    • 排名:第7911名
    • 原创:142篇
    • 转载:41篇
    • 译文:2篇
    • 评论:79条
    我的微博
    博客专栏