Search code examples
androidandroid-source

Android AOSP how to incl/excl modules from specific build


I downloaded AOSP source for Pixel XL (android-8.0.0_r3), the build is ok with lunch aosp_marlin-userdebug.

I understand that Pixel XL is using NFC chipset PN54X found in system/nfc/halimpl/pn54x. What bother me is under system/nfc/halimpl there are bcm2079X and pn54x 2 different modules, where in the source instruct pn54x's Android.mk being included in aosp_marlin-userdebug build but not bcm2079X? If I wanted to drop pn54x from the build and include bcm2079X how can I do so?


If you look closely at system/nfc/Android.bp, you will find halimpl/bcm2079x/nfc_nci.c is included. However, there is also a nfc_nci.c in pn54x. When I try injecting error into each file then build, I notice halimpl/bcm2079x/nfc_nci.c no error is reported, means the file is actually ignored by build. But how?


Solution

  • The answer is in AOSP\device\google\marlin\device-marlin.mk the nfc module is included in the .mk file:

    # NFC packages
    PRODUCT_PACKAGES += \
        nfc_nci.marlin
    

    The module name has to follow what found in AOSP\src\system\nfc\halimpl\pn54x\Android.mk (android.mk):

    LOCAL_MODULE := nfc_nci.$(TARGET_DEVICE)
    

    To remove or add a nfc module, you will have to modify the device-marlin.mk accordingly.