1#
2# Copyright (C) 2007 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# Variables that are meant to hold only a single value.
18# - The value set in the current makefile takes precedence over inherited values
19# - If multiple inherited makefiles set the var, the first-inherited value wins
20_product_single_value_vars :=
21
22# Variables that are lists of values.
23_product_list_vars :=
24
25_product_single_value_vars += PRODUCT_NAME
26_product_single_value_vars += PRODUCT_MODEL
27_product_single_value_vars += PRODUCT_NAME_FOR_ATTESTATION
28_product_single_value_vars += PRODUCT_MODEL_FOR_ATTESTATION
29
30# Defines the ELF segment alignment for binaries (executables and shared libraries).
31# The ELF segment alignment has to be a PAGE_SIZE multiple. For example, if
32# PRODUCT_MAX_PAGE_SIZE_SUPPORTED=65536, the possible values for PAGE_SIZE could be
33# 4096, 16384 and 65536.
34_product_single_value_vars += PRODUCT_MAX_PAGE_SIZE_SUPPORTED
35_product_single_value_vars += PRODUCT_CHECK_PREBUILT_MAX_PAGE_SIZE
36
37# Boolean variable determining if AOSP relies on bionic's PAGE_SIZE macro.
38_product_single_value_vars += PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO
39
40# The resource configuration options to use for this product.
41_product_list_vars += PRODUCT_LOCALES
42_product_list_vars += PRODUCT_AAPT_CONFIG
43_product_single_value_vars += PRODUCT_AAPT_PREF_CONFIG
44_product_list_vars += PRODUCT_AAPT_PREBUILT_DPI
45_product_list_vars += PRODUCT_HOST_PACKAGES
46_product_list_vars += PRODUCT_PACKAGES
47_product_list_vars += PRODUCT_PACKAGES_DEBUG
48_product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN
49_product_list_vars += PRODUCT_PACKAGES_ARM64
50
51# packages that are added to PRODUCT_PACKAGES based on the PRODUCT_SHIPPING_API_LEVEL
52# These are only added if the shipping API level is that level or lower
53_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_29
54_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_33
55_product_list_vars += PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34
56
57# Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true
58_product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE
59_product_list_vars += PRODUCT_PACKAGES_ENG
60_product_list_vars += PRODUCT_PACKAGES_TESTS
61
62# The device that this product maps to.
63_product_single_value_vars += PRODUCT_DEVICE
64_product_single_value_vars += PRODUCT_MANUFACTURER
65_product_single_value_vars += PRODUCT_BRAND
66_product_single_value_vars += PRODUCT_BRAND_FOR_ATTESTATION
67
68# These PRODUCT_SYSTEM_* flags, if defined, are used in place of the
69# corresponding PRODUCT_* flags for the sysprops on /system.
70_product_single_value_vars += \
71    PRODUCT_SYSTEM_NAME \
72    PRODUCT_SYSTEM_MODEL \
73    PRODUCT_SYSTEM_DEVICE \
74    PRODUCT_SYSTEM_BRAND \
75    PRODUCT_SYSTEM_MANUFACTURER \
76
77# PRODUCT_<PARTITION>_PROPERTIES are lists of property assignments
78# that go to <partition>/build.prop. Each property assignment is
79# "key = value" with zero or more whitespace characters on either
80# side of the '='.
81_product_list_vars += \
82    PRODUCT_SYSTEM_PROPERTIES \
83    PRODUCT_SYSTEM_EXT_PROPERTIES \
84    PRODUCT_VENDOR_PROPERTIES \
85    PRODUCT_ODM_PROPERTIES \
86    PRODUCT_PRODUCT_PROPERTIES
87
88# TODO(b/117892318) deprecate these:
89# ... in favor or PRODUCT_SYSTEM_PROPERTIES
90_product_list_vars += PRODUCT_SYSTEM_DEFAULT_PROPERTIES
91# ... in favor of PRODUCT_VENDOR_PROPERTIES
92_product_list_vars += PRODUCT_PROPERTY_OVERRIDES
93_product_list_vars += PRODUCT_DEFAULT_PROPERTY_OVERRIDES
94
95# TODO(b/117892318) consider deprecating these too
96_product_list_vars += PRODUCT_SYSTEM_PROPERTY_BLACKLIST
97_product_list_vars += PRODUCT_VENDOR_PROPERTY_BLACKLIST
98
99# The characteristics of the product, which among other things is passed to aapt
100_product_single_value_vars += PRODUCT_CHARACTERISTICS
101
102# A list of words like <source path>:<destination path>[:<owner>].
103# The file at the source path should be copied to the destination path
104# when building  this product.  <destination path> is relative to
105# $(PRODUCT_OUT), so it should look like, e.g., "system/etc/file.xml".
106# The rules for these copy steps are defined in build/make/core/Makefile.
107# The optional :<owner> is used to indicate the owner of a vendor file.
108_product_list_vars += PRODUCT_COPY_FILES
109
110# The OTA key(s) specified by the product config, if any.  The names
111# of these keys are stored in the target-files zip so that post-build
112# signing tools can substitute them for the test key embedded by
113# default.
114_product_list_vars += PRODUCT_OTA_PUBLIC_KEYS
115_product_list_vars += PRODUCT_EXTRA_OTA_KEYS
116_product_list_vars += PRODUCT_EXTRA_RECOVERY_KEYS
117
118# Should we use the default resources or add any product specific overlays
119_product_list_vars += PRODUCT_PACKAGE_OVERLAYS
120_product_list_vars += DEVICE_PACKAGE_OVERLAYS
121
122# Resource overlay list which must be excluded from enforcing RRO.
123_product_list_vars += PRODUCT_ENFORCE_RRO_EXCLUDED_OVERLAYS
124
125# Package list to apply enforcing RRO.
126_product_list_vars += PRODUCT_ENFORCE_RRO_TARGETS
127
128_product_list_vars += PRODUCT_SDK_ATREE_FILES
129_product_list_vars += PRODUCT_SDK_ADDON_NAME
130_product_list_vars += PRODUCT_SDK_ADDON_COPY_FILES
131_product_list_vars += PRODUCT_SDK_ADDON_COPY_MODULES
132_product_list_vars += PRODUCT_SDK_ADDON_DOC_MODULES
133_product_list_vars += PRODUCT_SDK_ADDON_SYS_IMG_SOURCE_PROP
134
135# which Soong namespaces to export to Make
136_product_list_vars += PRODUCT_SOONG_NAMESPACES
137
138_product_list_vars += PRODUCT_DEFAULT_WIFI_CHANNELS
139_product_single_value_vars += PRODUCT_DEFAULT_DEV_CERTIFICATE
140_product_list_vars += PRODUCT_MAINLINE_SEPOLICY_DEV_CERTIFICATES
141_product_list_vars += PRODUCT_RESTRICT_VENDOR_FILES
142
143# The list of product-specific kernel header dirs
144_product_list_vars += PRODUCT_VENDOR_KERNEL_HEADERS
145
146# A list of module names in BOOTCLASSPATH (jar files). Each module may be
147# prefixed with "<apex>:", which identifies the APEX that provides it. APEXes
148# are identified by their "variant" names, i.e. their `apex_name` values in
149# Soong, which default to the `name` values. The prefix can also be "platform:"
150# or "system_ext:", and defaults to "platform:" if left out. See the long
151# comment in build/soong/java/dexprepopt_bootjars.go for details.
152_product_list_vars += PRODUCT_BOOT_JARS
153
154# A list of extra BOOTCLASSPATH jars (to be appended after common jars),
155# following the same format as PRODUCT_BOOT_JARS. Products that include
156# device-specific makefiles before AOSP makefiles should use this instead of
157# PRODUCT_BOOT_JARS, so that device-specific jars go after common jars.
158_product_list_vars += PRODUCT_BOOT_JARS_EXTRA
159
160# List of jars to be included in the ART boot image for testing.
161_product_list_vars += PRODUCT_TEST_ONLY_ART_BOOT_IMAGE_JARS
162
163_product_single_value_vars += PRODUCT_SUPPORTS_VBOOT
164_product_list_vars += PRODUCT_SYSTEM_SERVER_APPS
165# List of system_server classpath jars on the platform.
166_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS
167# List of system_server classpath jars delivered via apex. Format = <apex name>:<jar name>.
168_product_list_vars += PRODUCT_APEX_SYSTEM_SERVER_JARS
169# List of jars on the platform that system_server loads dynamically using separate classloaders.
170_product_list_vars += PRODUCT_STANDALONE_SYSTEM_SERVER_JARS
171# List of jars delivered via apex that system_server loads dynamically using separate classloaders.
172# Format = <apex name>:<jar name>
173_product_list_vars += PRODUCT_APEX_STANDALONE_SYSTEM_SERVER_JARS
174# If true, then suboptimal order of system server jars does not cause an error.
175_product_single_value_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS
176# If true, then system server jars defined in Android.mk are supported.
177_product_single_value_vars += PRODUCT_BROKEN_DEPRECATED_MK_SYSTEM_SERVER_JARS
178
179# Additional system server jars to be appended at the end of the common list.
180# This is necessary to avoid jars reordering due to makefile inheritance order.
181_product_list_vars += PRODUCT_SYSTEM_SERVER_JARS_EXTRA
182
183# Set to true to disable <uses-library> checks for a product.
184_product_list_vars += PRODUCT_BROKEN_VERIFY_USES_LIBRARIES
185
186_product_list_vars += PRODUCT_DEXPREOPT_SPEED_APPS
187_product_list_vars += PRODUCT_LOADED_BY_PRIVILEGED_MODULES
188_product_single_value_vars += PRODUCT_VBOOT_SIGNING_KEY
189_product_single_value_vars += PRODUCT_VBOOT_SIGNING_SUBKEY
190_product_single_value_vars += PRODUCT_SYSTEM_VERITY_PARTITION
191_product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION
192_product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION
193_product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION
194_product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION
195_product_single_value_vars += PRODUCT_VENDOR_DLKM_VERITY_PARTITION
196_product_single_value_vars += PRODUCT_ODM_DLKM_VERITY_PARTITION
197_product_single_value_vars += PRODUCT_SYSTEM_DLKM_VERITY_PARTITION
198_product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO
199_product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO
200
201# Per-module dex-preopt configs.
202_product_list_vars += PRODUCT_DEX_PREOPT_MODULE_CONFIGS
203_product_single_value_vars += PRODUCT_DEX_PREOPT_DEFAULT_COMPILER_FILTER
204_product_list_vars += PRODUCT_DEX_PREOPT_DEFAULT_FLAGS
205_product_single_value_vars += PRODUCT_DEX_PREOPT_BOOT_FLAGS
206_product_single_value_vars += PRODUCT_DEX_PREOPT_PROFILE_DIR
207_product_single_value_vars += PRODUCT_DEX_PREOPT_GENERATE_DM_FILES
208_product_single_value_vars += PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING
209_product_single_value_vars += PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS
210
211# Boot image options.
212_product_list_vars += PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION
213_product_single_value_vars += \
214    PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST \
215    PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
216    PRODUCT_USES_DEFAULT_ART_CONFIG \
217
218_product_single_value_vars += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER
219# Per-module sanitizer configs
220_product_list_vars += PRODUCT_SANITIZER_MODULE_CONFIGS
221_product_single_value_vars += PRODUCT_SYSTEM_BASE_FS_PATH
222_product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH
223_product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH
224_product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH
225_product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
226_product_single_value_vars += PRODUCT_VENDOR_DLKM_BASE_FS_PATH
227_product_single_value_vars += PRODUCT_ODM_DLKM_BASE_FS_PATH
228_product_single_value_vars += PRODUCT_SYSTEM_DLKM_BASE_FS_PATH
229
230# The first API level this product shipped with
231_product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL
232
233# The first vendor API level this product shipped with
234_product_single_value_vars += PRODUCT_SHIPPING_VENDOR_API_LEVEL
235
236_product_list_vars += VENDOR_PRODUCT_RESTRICT_VENDOR_FILES
237_product_list_vars += VENDOR_EXCEPTION_MODULES
238_product_list_vars += VENDOR_EXCEPTION_PATHS
239# Whether the product wants to ship libartd. For rules and meaning, see art/Android.mk.
240_product_single_value_vars += PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD
241
242# Make this art variable visible to soong_config.mk.
243_product_single_value_vars += PRODUCT_ART_USE_READ_BARRIER
244
245# Add reserved headroom to a system image.
246_product_single_value_vars += PRODUCT_SYSTEM_HEADROOM
247
248# Whether to save disk space by minimizing java debug info
249_product_single_value_vars += PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
250
251# Whether any paths are excluded from sanitization when SANITIZE_TARGET=integer_overflow
252_product_list_vars += PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS
253
254_product_single_value_vars += PRODUCT_ADB_KEYS
255
256# Whether any paths should have CFI enabled for components
257_product_list_vars += PRODUCT_CFI_INCLUDE_PATHS
258
259# Whether any paths are excluded from sanitization when SANITIZE_TARGET=cfi
260_product_list_vars += PRODUCT_CFI_EXCLUDE_PATHS
261
262# Whether any paths should have HWASan enabled for components
263_product_list_vars += PRODUCT_HWASAN_INCLUDE_PATHS
264
265# Whether any paths are excluded from sanitization when SANITIZE_TARGET=hwaddress
266_product_list_vars += PRODUCT_HWASAN_EXCLUDE_PATHS
267
268# Whether any paths should have Memtag_heap enabled for components
269_product_list_vars += PRODUCT_MEMTAG_HEAP_ASYNC_INCLUDE_PATHS
270_product_list_vars += PRODUCT_MEMTAG_HEAP_ASYNC_DEFAULT_INCLUDE_PATHS
271_product_list_vars += PRODUCT_MEMTAG_HEAP_SYNC_INCLUDE_PATHS
272_product_list_vars += PRODUCT_MEMTAG_HEAP_SYNC_DEFAULT_INCLUDE_PATHS
273_product_list_vars += PRODUCT_MEMTAG_HEAP_EXCLUDE_PATHS
274
275# Whether this product wants to start with an empty list of default memtag_heap include paths
276_product_single_value_vars += PRODUCT_MEMTAG_HEAP_SKIP_DEFAULT_PATHS
277
278# Whether the Scudo hardened allocator is disabled platform-wide
279_product_single_value_vars += PRODUCT_DISABLE_SCUDO
280
281# List of extra VNDK versions to be included
282_product_list_vars += PRODUCT_EXTRA_VNDK_VERSIONS
283
284# Whether APEX should be compressed or not
285_product_single_value_vars += PRODUCT_COMPRESSED_APEX
286
287# VNDK version of product partition. It can be 'current' if the product
288# partitions uses PLATFORM_VNDK_VERSION.
289_product_single_value_vars += PRODUCT_PRODUCT_VNDK_VERSION
290
291_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS
292_product_single_value_vars += PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT
293_product_list_vars += PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST
294_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT
295_product_list_vars += PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST
296
297# List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence
298# installed on /system directory by default.
299_product_list_vars += PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION
300
301# When this is true, dynamic partitions is retrofitted on a device that has
302# already been launched without dynamic partitions. Otherwise, the device
303# is launched with dynamic partitions.
304# This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS.
305_product_single_value_vars += PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
306
307# List of directories that will be used to gate blueprint modules from the build graph
308_product_list_vars += PRODUCT_SOURCE_ROOT_DIRS
309
310# When this is true, various build time as well as runtime debugfs restrictions are enabled.
311_product_single_value_vars += PRODUCT_SET_DEBUGFS_RESTRICTIONS
312
313# Other dynamic partition feature flags.PRODUCT_USE_DYNAMIC_PARTITION_SIZE and
314# PRODUCT_BUILD_SUPER_PARTITION default to the value of PRODUCT_USE_DYNAMIC_PARTITIONS.
315_product_single_value_vars += \
316    PRODUCT_USE_DYNAMIC_PARTITIONS \
317    PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
318    PRODUCT_BUILD_SUPER_PARTITION \
319
320# If set, kernel configuration requirements are present in OTA package (and will be enforced
321# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
322# Devices that checks the running kernel (instead of the kernel in OTA package) should not
323# set this variable to prevent OTA failures.
324_product_list_vars += PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
325
326# If set to true, this product forces HIDL to be enabled by declaring android.hidl.manager
327# and android.hidl.token in the framework manifest. The product will also need to add the
328# 'hwservicemanager' service to PRODUCT_PACKAGES if its SHIPPING_API_LEVEL is greater than 34.
329# This should only be used during bringup for devices that are targeting FCM 202404 and still
330# have partner-owned HIDL interfaces that are being converted to AIDL.
331_product_single_value_vars += PRODUCT_HIDL_ENABLED
332
333# If set to true, this product builds a generic OTA package, which installs generic system images
334# onto matching devices. The product may only build a subset of system images (e.g. only
335# system.img), so devices need to install the package in a system-only OTA manner.
336_product_single_value_vars += PRODUCT_BUILD_GENERIC_OTA_PACKAGE
337
338_product_list_vars += PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
339_product_list_vars += PRODUCT_PACKAGE_NAME_OVERRIDES
340_product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES
341
342# Overrides the (apex, jar) pairs above when determining the on-device location. The format is:
343# <old_apex>:<old_jar>:<new_apex>:<new_jar>
344_product_list_vars += PRODUCT_CONFIGURED_JAR_LOCATION_OVERRIDES
345
346# Controls for whether different partitions are built for the current product.
347_product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE
348_product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE
349_product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE
350_product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE
351_product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE
352_product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE
353_product_single_value_vars += PRODUCT_BUILD_VENDOR_DLKM_IMAGE
354_product_single_value_vars += PRODUCT_BUILD_ODM_DLKM_IMAGE
355_product_single_value_vars += PRODUCT_BUILD_SYSTEM_DLKM_IMAGE
356_product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE
357_product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
358_product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE
359_product_single_value_vars += PRODUCT_BUILD_RECOVERY_IMAGE
360_product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE
361_product_single_value_vars += PRODUCT_BUILD_INIT_BOOT_IMAGE
362_product_single_value_vars += PRODUCT_BUILD_DEBUG_BOOT_IMAGE
363_product_single_value_vars += PRODUCT_BUILD_VENDOR_BOOT_IMAGE
364_product_single_value_vars += PRODUCT_BUILD_VENDOR_KERNEL_BOOT_IMAGE
365_product_single_value_vars += PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE
366_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
367_product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE
368_product_single_value_vars += PRODUCT_BUILD_PVMFW_IMAGE
369
370# List of boot jars delivered via updatable APEXes, following the same format as
371# PRODUCT_BOOT_JARS.
372_product_list_vars += PRODUCT_APEX_BOOT_JARS
373
374# If set, device uses virtual A/B.
375_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA
376
377# If set, device uses virtual A/B Compression.
378_product_single_value_vars += PRODUCT_VIRTUAL_AB_COMPRESSION
379
380# If set, device retrofits virtual A/B.
381_product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA_RETROFIT
382
383# If set, forcefully generate a non-A/B update package.
384# Note: A device configuration should inherit from virtual_ab_ota_plus_non_ab.mk
385# instead of setting this variable directly.
386# Note: Use TARGET_OTA_ALLOW_NON_AB in the build system because
387# TARGET_OTA_ALLOW_NON_AB takes the value of AB_OTA_UPDATER into account.
388_product_single_value_vars += PRODUCT_OTA_FORCE_NON_AB_PACKAGE
389
390# If set, Java module in product partition cannot use hidden APIs.
391_product_single_value_vars += PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE
392
393# If set, only java_sdk_library can be used at inter-partition dependency.
394# Note: Build error if BOARD_VNDK_VERSION is not set while
395#       PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY is true, because
396#       PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY has no meaning if
397#       BOARD_VNDK_VERSION is not set.
398# Note: When PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is not set, there are
399#       no restrictions at dependency between system and product partition.
400_product_single_value_vars += PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY
401
402# Allowlist for PRODUCT_ENFORCE_INTER_PARTITION_JAVA_SDK_LIBRARY option.
403# Listed modules are allowed at inter-partition dependency even if it isn't
404# a java_sdk_library module.
405_product_list_vars += PRODUCT_INTER_PARTITION_JAVA_LIBRARY_ALLOWLIST
406
407# Install a copy of the debug policy to the system_ext partition, and allow
408# init-second-stage to load debug policy from system_ext.
409# This option is only meant to be set by compliance GSI targets.
410_product_single_value_vars += PRODUCT_INSTALL_DEBUG_POLICY_TO_SYSTEM_EXT
411
412# If set, fsverity metadata files will be generated for each files in the
413# allowlist, plus an manifest APK per partition. For example,
414# /system/framework/service.jar will come with service.jar.fsv_meta in the same
415# directory; the file information will also be included in
416# /system/etc/security/fsverity/BuildManifest.apk
417_product_single_value_vars += PRODUCT_FSVERITY_GENERATE_METADATA
418
419# If true, this builds the mainline modules from source. This overrides any
420# prebuilts selected via RELEASE_APEX_CONTRIBUTIONS_* build flags for the
421# current release config.
422_product_single_value_vars += PRODUCT_MODULE_BUILD_FROM_SOURCE
423
424# If true, installs a full version of com.android.virt APEX.
425_product_single_value_vars += PRODUCT_AVF_ENABLED
426
427# If false, disable the AVF remote attestaton feature.
428_product_single_value_vars += PRODUCT_AVF_REMOTE_ATTESTATION_DISABLED
429
430# If true, kernel with modules will be used for Microdroid VMs.
431_product_single_value_vars += PRODUCT_AVF_KERNEL_MODULES_ENABLED
432
433# If true, the memory controller will be force-enabled in the cgroup v2 hierarchy
434_product_single_value_vars += PRODUCT_MEMCG_V2_FORCE_ENABLED
435
436# If true, the cgroup v2 hierarchy will be split into apps/system subtrees
437_product_single_value_vars += PRODUCT_CGROUP_V2_SYS_APP_ISOLATION_ENABLED
438
439# List of .json files to be merged/compiled into vendor/etc/linker.config.pb
440_product_list_vars += PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS
441
442# Whether to use userfaultfd GC.
443# Possible values are:
444# - "default" or empty: both the build system and the runtime determine whether to use userfaultfd
445#   GC based on the vendor API level
446# - "true": forces the build system to use userfaultfd GC regardless of the vendor API level; the
447#   runtime determines whether to use userfaultfd GC based on the kernel support. Note that the
448#   device may have to re-compile everything on the first boot if the kernel doesn't support
449#   userfaultfd
450# - "false": disallows the build system and the runtime to use userfaultfd GC even if the device
451#   supports it. This option is temporary - the plan is to remove it by Aug 2025, at which time
452#   Mainline updates of the ART module will ignore it as well.
453_product_single_value_vars += PRODUCT_ENABLE_UFFD_GC
454
455# Specifies COW version to be used by update_engine and libsnapshot. If this value is not
456# specified we default to COW version 2 in update_engine for backwards compatibility
457_product_single_value_vars += PRODUCT_VIRTUAL_AB_COW_VERSION
458
459# Specifies maximum bytes to be compressed at once during ota. Options: 4096, 8192, 16384, 32768, 65536, 131072, 262144.
460_product_single_value_vars += PRODUCT_VIRTUAL_AB_COMPRESSION_FACTOR
461
462# If set, determines whether the build system checks vendor seapp contexts violations.
463_product_single_value_vars += PRODUCT_CHECK_VENDOR_SEAPP_VIOLATIONS
464
465# If set, determines whether the build system checks dev type violations.
466_product_single_value_vars += PRODUCT_CHECK_DEV_TYPE_VIOLATIONS
467
468_product_list_vars += PRODUCT_AFDO_PROFILES
469
470_product_single_value_vars += PRODUCT_SCUDO_ALLOCATION_RING_BUFFER_SIZE
471
472_product_list_vars += PRODUCT_RELEASE_CONFIG_MAPS
473
474_product_list_vars += PRODUCT_VALIDATION_CHECKS
475
476_product_single_value_vars += PRODUCT_BUILD_FROM_SOURCE_STUB
477
478_product_single_value_vars += PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS
479
480_product_single_value_vars += PRODUCT_HIDDEN_API_EXPORTABLE_STUBS
481
482_product_single_value_vars += PRODUCT_EXPORT_RUNTIME_APIS
483
484# If set, determines which version of the GKI is used as guest kernel for Microdroid VMs.
485# TODO(b/325991735): link to documentation once it is done.
486_product_single_value_vars += PRODUCT_AVF_MICRODROID_GUEST_GKI_VERSION
487
488# Enables 16KB developer option for device if set.
489_product_single_value_vars += PRODUCT_16K_DEVELOPER_OPTION
490
491# If set, adb root will be disabled (really ro.debuggable=0) in userdebug
492# builds. It's already off disabled in user builds. Eng builds are unaffected
493# by this flag.
494_product_single_value_vars += PRODUCT_NOT_DEBUGGABLE_IN_USERDEBUG
495
496# If set, the default value of the versionName of apps will include the build number.
497_product_single_value_vars += PRODUCT_BUILD_APPS_WITH_BUILD_NUMBER
498
499.KATI_READONLY := _product_single_value_vars _product_list_vars
500_product_var_list :=$= $(_product_single_value_vars) $(_product_list_vars)
501
502#
503# Functions for including product makefiles
504#
505
506#
507# $(1): product to inherit
508#
509# To be called from product makefiles, and is later evaluated during the import-nodes
510# call below. It does the following:
511#  1. Inherits all of the variables from $1.
512#  2. Records the inheritance in the .INHERITS_FROM variable
513#
514# (2) and the PRODUCTS variable can be used together to reconstruct the include hierarchy
515# See e.g. product-graph.mk for an example of this.
516#
517define inherit-product
518  $(eval _inherit_product_wildcard := $(wildcard $(1)))\
519  $(if $(_inherit_product_wildcard),,$(error $(1) does not exist.))\
520  $(foreach part,$(_inherit_product_wildcard),\
521    $(if $(findstring ../,$(part)),\
522      $(eval np := $(call normalize-paths,$(part))),\
523      $(eval np := $(strip $(part))))\
524    $(foreach v,$(_product_var_list), \
525        $(eval $(v) := $($(v)) $(INHERIT_TAG)$(np))) \
526    $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
527    $(eval inherit_var := PRODUCTS.$(current_mk).INHERITS_FROM) \
528    $(eval $(inherit_var) := $(sort $($(inherit_var)) $(np))) \
529    $(call dump-inherit,$(current_mk),$(1)) \
530    $(call dump-config-vals,$(current_mk),inherit))
531endef
532
533# Specifies a number of path prefixes, relative to PRODUCT_OUT, where the
534# product makefile hierarchy rooted in the current node places its artifacts.
535# Creating artifacts outside the specified paths will cause a build-time error.
536define require-artifacts-in-path
537  $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
538  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENTS := $(strip $(1))) \
539  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_ALLOWED_LIST := $(strip $(2))) \
540  $(eval ARTIFACT_PATH_REQUIREMENT_PRODUCTS := \
541    $(sort $(ARTIFACT_PATH_REQUIREMENT_PRODUCTS) $(current_mk)))
542endef
543
544# Like require-artifacts-in-path, but does not require all allow-list entries to
545# have an effect.
546define require-artifacts-in-path-relaxed
547  $(require-artifacts-in-path) \
548  $(eval PRODUCTS.$(current_mk).ARTIFACT_PATH_REQUIREMENT_IS_RELAXED := true)
549endef
550
551# Makes including non-existent modules in PRODUCT_PACKAGES an error.
552# $(1): list of non-existent modules to allow.
553define enforce-product-packages-exist
554  $(eval current_mk := $(strip $(word 1,$(_include_stack)))) \
555  $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST := true) \
556  $(eval PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST := $(1)) \
557  $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST) \
558  $(eval .KATI_READONLY := PRODUCTS.$(current_mk).PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST)
559endef
560
561#
562# Do inherit-product only if $(1) exists
563#
564define inherit-product-if-exists
565  $(if $(wildcard $(1)),$(call inherit-product,$(1)),)
566endef
567
568#
569# $(1): product makefile list
570#
571#TODO: check to make sure that products have all the necessary vars defined
572define import-products
573$(call import-nodes,PRODUCTS,$(1),$(_product_var_list),$(_product_single_value_vars))
574endef
575
576
577#
578# Does various consistency checks on the current product.
579# Takes no parameters, so $(call ) is not necessary.
580#
581define check-current-product
582$(if ,, \
583  $(if $(call is-c-identifier,$(PRODUCT_NAME)),, \
584    $(error $(INTERNAL_PRODUCT): PRODUCT_NAME must be a valid C identifier, not "$(pn)")) \
585  $(if $(PRODUCT_BRAND),, \
586    $(error $(INTERNAL_PRODUCT): PRODUCT_BRAND must be defined.)) \
587  $(foreach cf,$(strip $(PRODUCT_COPY_FILES)), \
588    $(if $(filter 2 3,$(words $(subst :,$(space),$(cf)))),, \
589      $(error $(p): malformed COPY_FILE "$(cf)"))))
590endef
591
592# BoardConfig variables that are also inherited in product mks. Should ideally
593# be cleaned up to not be product variables.
594_readonly_late_variables := \
595  DEVICE_PACKAGE_OVERLAYS \
596  WITH_DEXPREOPT_ART_BOOT_IMG_ONLY \
597
598# Modified internally in the build system
599_readonly_late_variables += \
600  PRODUCT_COPY_FILES \
601  PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING \
602  PRODUCT_DEX_PREOPT_BOOT_FLAGS \
603
604_readonly_early_variables := $(filter-out $(_readonly_late_variables),$(_product_var_list))
605
606#
607# Mark the variables in _product_stash_var_list as readonly
608#
609define readonly-variables
610$(foreach v,$(1), \
611  $(eval $(v) ?=) \
612  $(eval .KATI_READONLY := $(v)) \
613 )
614endef
615define readonly-product-vars
616$(call readonly-variables,$(_readonly_early_variables))
617endef
618
619define readonly-final-product-vars
620$(call readonly-variables,$(_readonly_late_variables))
621endef
622
623# Macro re-defined inside strip-product-vars.
624get-product-var = $(PRODUCTS.$(strip $(1)).$(2))
625#
626# Strip the variables in _product_var_list and a few build-system
627# internal variables, and assign the ones for the current product
628# to a shorthand that is more convenient to read from elsewhere.
629#
630define strip-product-vars
631$(call dump-phase-start,PRODUCT-EXPAND,,$(_product_var_list),$(_product_single_value_vars), \
632		build/make/core/product.mk) \
633$(foreach v,\
634  $(_product_var_list) \
635    PRODUCT_ENFORCE_PACKAGES_EXIST \
636    PRODUCT_ENFORCE_PACKAGES_EXIST_ALLOW_LIST, \
637  $(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
638  $(eval get-product-var = $$(if $$(filter $$(1),$$(INTERNAL_PRODUCT)),$$($$(2)),$$(PRODUCTS.$$(strip $$(1)).$$(2)))) \
639  $(KATI_obsolete_var PRODUCTS.$(INTERNAL_PRODUCT).$(v),Use $(v) instead) \
640) \
641$(call dump-phase-end,build/make/core/product.mk)
642endef
643
644define add-to-product-copy-files-if-exists
645$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
646endef
647
648# whitespace placeholder when we record module's dex-preopt config.
649_PDPMC_SP_PLACE_HOLDER := |@SP@|
650# Set up dex-preopt config for a module.
651# $(1) list of module names
652# $(2) the modules' dex-preopt config
653define add-product-dex-preopt-module-config
654$(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\
655$(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \
656  $(foreach m,$(1),$(m)=$(_c)))
657endef
658
659# whitespace placeholder when we record module's sanitizer config.
660_PSMC_SP_PLACE_HOLDER := |@SP@|
661# Set up sanitizer config for a module.
662# $(1) list of module names
663# $(2) the modules' sanitizer config
664define add-product-sanitizer-module-config
665$(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\
666$(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \
667  $(foreach m,$(1),$(m)=$(_c)))
668endef
669