Editing Functionality of Host Card Emulation in Android

前端 未结 2 809
臣服心动
臣服心动 2020-11-27 15:21

I\'m currently in the process of developing a project for my University course wherein I will be hopefully editing the functionality of the HCE Feature of Android to allow m

2条回答
  •  旧时难觅i
    2020-11-27 16:02

    Android's NFC stack is basically split into five parts:

    • The NFC interface device driver. This is part of the kernel. In a nutshell, this driver simply tunnels data frames (e.g. NCI protocol frames) between a character device file and the NFC controller hardware. You won't have to touch that part for your project.

    • The low-level interface library written in C (libnfc-nci, or libnfc-nxp for devices with NXP's PN544 NFC controller). This library provides a set of high-level functions to interact with the NFC controller. So it basically translates high-level functionality (e.g. "start polling for technologies X, Y and Z") into NCI commands that are sent to the NFC controller through the kernel driver. This is certainly a place where you will need to add modifications. As it's part of AOSP you can compile it using the normal AOSP build system.

    • The JNI interface library written in C++ (libnfc_nci_jni). This layer connects the libnfc-nci C library with high-level Java code. If you want to modify the emulated UID from Android apps, this is certainly a place where you will need to add modifications. As it's part of AOSP you can compile it using the normal AOSP build system.

    • The Android NFC system service written in Java. This service takes control over the whole NFC stack and implements the high-level functionality based on the resources provided by libnfc-nci. If you want to modify the emulated UID from Android apps, this is certainly a place where you will need to add modifications. As it's part of AOSP you can compile it using the normal AOSP build system.

    • The Android core framework provides an API to the functionality of the NFC system service that can be accessed by Android apps.

    With regard to setting/modifying the emulated UID you will certainly want to have a look at these projects that I recently published on GitHub (though they are still work in progress):

    • https://github.com/mobilesec/swr50-android-external_libnfc-nci
    • https://github.com/mobilesec/swr50-android-packages_apps_nfcwatch1

提交回复
热议问题