Search code examples
javaandroidbuildandroid-source

How is platform/frameworks/base built? AOSP source


I'm looking at platform/frameworks/base. It looks like it's a lot of things from Android's core. It's mainly in Java: https://github.com/GrapheneOS/platform_frameworks_base/blob/11/Android.mk

When we look into its Android.mk file, the most interesting part is:

$(SDK_METADATA): $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/framework-doc-stubs-metadata.zip
    rm -rf $(SDK_METADATA_DIR)
    mkdir -p $(SDK_METADATA_DIR)
    unzip -qo $< -d $(SDK_METADATA_DIR)

I'm trying to understand how and what is built from this repo. It's clear that nothing is being built in this makefile, mostly because java code is built from ART. So, what's happening?

It looks like it unzips file from this: SDK_METADATA_DIR :=$= $(call intermediates-dir-for,PACKAGING,framework-doc-stubs-metadata,,COMMON), but then it does nothing more.

How does this repo ends up being built?


Solution

  • The more interesting targets are defined in the Android.bp file.

    There are multiple targets that gets built from that repository, so take a look at the java_library targets with names starting with "framework", and the comments on the framework target to find what you need.

    // This "framework" module is NOT installed to the device. It's
    // "framework-minus-apex" that gets installed to the device. Note that
    // the filename is still framework.jar (via the stem property) for
    // compatibility reason. The purpose of this module is to provide
    // framework APIs (both public and private) for bundled apps.
    // "framework-minus-apex" can't be used for the purpose because 1)
    // many apps have already hardcoded the name "framework" and
    // 2) it lacks API symbols from updatable modules - as it's clear from
    // its suffix "-minus-apex".