blob: f47a8e21f7f48b24a11bd3a2356e0b9c198caac2 [file] [log] [blame]
Jiakai Zhangd6c6e3a2022-11-16 11:52:00 +00001# ART configuration that has to be determined after product config is resolved.
2#
3# Inputs:
4# PRODUCT_ENABLE_UFFD_GC: See comments in build/make/core/product.mk.
5# OVERRIDE_ENABLE_UFFD_GC: Overrides PRODUCT_ENABLE_UFFD_GC. Can be passed from the commandline for
6# debugging purposes.
7# BOARD_API_LEVEL: See comments in build/make/core/main.mk.
8# BOARD_SHIPPING_API_LEVEL: See comments in build/make/core/main.mk.
9# PRODUCT_SHIPPING_API_LEVEL: See comments in build/make/core/product.mk.
10#
11# Outputs:
12# ENABLE_UFFD_GC: Whether to use userfaultfd GC.
13
14config_enable_uffd_gc := \
15 $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC))
16
17ifeq (,$(filter-out default,$(config_enable_uffd_gc)))
18 ENABLE_UFFD_GC := true
19
20 # Disable userfaultfd GC if the device doesn't support it (i.e., if
21 # `min(ro.board.api_level ?? ro.board.first_api_level ?? MAX_VALUE,
22 # ro.product.first_api_level ?? ro.build.version.sdk ?? MAX_VALUE) < 31`)
23 # This logic aligns with how `ro.vendor.api_level` is calculated in
24 # `system/core/init/property_service.cpp`.
25 # We omit the check on `ro.build.version.sdk` here because we are on the latest build system.
26 board_api_level := $(firstword $(BOARD_API_LEVEL) $(BOARD_SHIPPING_API_LEVEL))
27 ifneq (,$(board_api_level))
28 ifeq (true,$(call math_lt,$(board_api_level),31))
29 ENABLE_UFFD_GC := false
30 endif
31 endif
32
33 ifneq (,$(PRODUCT_SHIPPING_API_LEVEL))
34 ifeq (true,$(call math_lt,$(PRODUCT_SHIPPING_API_LEVEL),31))
35 ENABLE_UFFD_GC := false
36 endif
37 endif
38else ifeq (true,$(config_enable_uffd_gc))
39 ENABLE_UFFD_GC := true
40else ifeq (false,$(config_enable_uffd_gc))
41 ENABLE_UFFD_GC := false
42else
43 $(error Unknown PRODUCT_ENABLE_UFFD_GC value: $(config_enable_uffd_gc))
44endif
45
46ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(ENABLE_UFFD_GC)
Alyssa Ketpreechasawatba231d22023-10-26 13:17:31 +000047
48# Create APEX_BOOT_JARS_EXCLUDED which is a list of jars to be removed from
49# ApexBoorJars when built from mainline prebuilts.
50# soong variables indicate whether the prebuilt is enabled:
51# - $(m)_module/source_build for art and TOGGLEABLE_PREBUILT_MODULES
52# - ANDROID/module_build_from_source for other mainline modules
53APEX_BOOT_JARS_EXCLUDED :=
54$(foreach pair, $(PRODUCT_APEX_BOOT_JARS_FOR_SOURCE_BUILD_ONLY),\
55 $(eval m := $(subst com.android.,,$(call word-colon,1,$(pair)))) \
56 $(if $(call soong_config_get,$(m)_module,source_build), \
57 $(if $(filter true,$(call soong_config_get,$(m)_module,source_build)),, \
58 $(eval APEX_BOOT_JARS_EXCLUDED += $(pair))), \
59 $(if $(filter true,$(call soong_config_get,ANDROID,module_build_from_source)),, \
60 $(eval APEX_BOOT_JARS_EXCLUDED += $(pair)))))