diff --git a/core/art_config.mk b/core/art_config.mk index 1ea05db2c3..f47a8e21f7 100644 --- a/core/art_config.mk +++ b/core/art_config.mk @@ -44,3 +44,17 @@ else endif ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC) + +# Create APEX_BOOT_JARS_EXCLUDED which is a list of jars to be removed from +# ApexBoorJars when built from mainline prebuilts. +# soong variables indicate whether the prebuilt is enabled: +# - $(m)_module/source_build for art and TOGGLEABLE_PREBUILT_MODULES +# - ANDROID/module_build_from_source for other mainline modules +APEX_BOOT_JARS_EXCLUDED := +$(foreach pair, $(PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY),\ + $(eval m := $(subst com.android.,,$(call word-colon,1,$(pair)))) \ + $(if $(call soong_config_get,$(m)_module,source_build), \ + $(if $(filter true,$(call soong_config_get,$(m)_module,source_build)),, \ + $(eval APEX_BOOT_JARS_EXCLUDED += $(pair))), \ + $(if $(filter true,$(call soong_config_get,ANDROID,module_build_from_source)),, \ + $(eval APEX_BOOT_JARS_EXCLUDED += $(pair))))) diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index badf189fb3..10fbe8f184 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -94,7 +94,7 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))) $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) - $(call add_json_list, ApexBootJars, $(PRODUCT_APEX_BOOT_JARS)) + $(call add_json_list, ApexBootJars, $(filter-out $(APEX_BOOT_JARS_EXCLUDED), $(PRODUCT_APEX_BOOT_JARS))) $(call add_json_list, ArtApexJars, $(filter $(PRODUCT_BOOT_JARS),$(ART_APEX_JARS))) $(call add_json_list, TestOnlyArtBootImageJars, $(PRODUCT_TEST_ONLY_ART_BOOT_IMAGE_JARS)) $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS)) diff --git a/core/soong_config.mk b/core/soong_config.mk index e39f2fa72f..08e9a653ab 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -164,7 +164,7 @@ $(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(fi $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) -$(call add_json_list, ApexBootJars, $(PRODUCT_APEX_BOOT_JARS)) +$(call add_json_list, ApexBootJars, $(filter-out $(APEX_BOOT_JARS_EXCLUDED), $(PRODUCT_APEX_BOOT_JARS))) $(call add_json_bool, VndkUseCoreVariant, $(TARGET_VNDK_USE_CORE_VARIANT)) $(call add_json_bool, VndkSnapshotBuildArtifacts, $(VNDK_SNAPSHOT_BUILD_ARTIFACTS)) diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk index 3f2376dd4b..56b1946330 100644 --- a/target/product/default_art_config.mk +++ b/target/product/default_art_config.mk @@ -57,6 +57,8 @@ PRODUCT_BOOT_JARS += \ ims-common # APEX boot jars. Keep the list sorted by module names and then library names. +# Note: If the existing apex introduces the new jar, also add it to +# PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY below. # Note: core-icu4j is moved back to PRODUCT_BOOT_JARS in product_config.mk at a later stage. # Note: For modules available in Q, DO NOT add new entries here. PRODUCT_APEX_BOOT_JARS := \ @@ -85,6 +87,12 @@ PRODUCT_APEX_BOOT_JARS := \ com.android.virt:framework-virtualization \ com.android.wifi:framework-wifi \ +# TODO(b/308174306): Adjust this after multiple prebuilts version is supported. +# APEX boot jars that are not in prebuilt apexes. +# Keep the list sorted by module names and then library names. +PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY := \ + com.android.mediaprovider:framework-pdf \ + # List of system_server classpath jars delivered via apex. # Keep the list sorted by module names and then library names. # Note: For modules available in Q, DO NOT add new entries here.