blob: c0d473585a0b7b93bad128f43e3da0534bec76ce [file] [log] [blame]
Inseob Kim320628f2024-06-18 11:09:12 +09001#!/usr/bin/env python3
2#
3# Copyright (C) 2024 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17"""A tool for generating {partition}/build.prop"""
18
19import argparse
20import contextlib
21import json
Justin Yune5b73762024-07-03 13:34:29 +090022import os
Inseob Kim320628f2024-06-18 11:09:12 +090023import subprocess
24import sys
25
Justin Yune5b73762024-07-03 13:34:29 +090026TEST_KEY_DIR = "build/make/target/product/security"
27
Inseob Kim320628f2024-06-18 11:09:12 +090028def get_build_variant(product_config):
29 if product_config["Eng"]:
30 return "eng"
31 elif product_config["Debuggable"]:
32 return "userdebug"
33 else:
34 return "user"
35
36def get_build_flavor(product_config):
37 build_flavor = product_config["DeviceProduct"] + "-" + get_build_variant(product_config)
38 if "address" in product_config.get("SanitizeDevice", []) and "_asan" not in build_flavor:
39 build_flavor += "_asan"
40 return build_flavor
41
42def get_build_keys(product_config):
43 default_cert = product_config.get("DefaultAppCertificate", "")
44 if default_cert == "" or default_cert == os.path.join(TEST_KEY_DIR, "testKey"):
45 return "test-keys"
46 return "dev-keys"
47
48def parse_args():
49 """Parse commandline arguments."""
50 parser = argparse.ArgumentParser()
51 parser.add_argument("--build-fingerprint-file", required=True, type=argparse.FileType("r"))
52 parser.add_argument("--build-hostname-file", required=True, type=argparse.FileType("r"))
53 parser.add_argument("--build-number-file", required=True, type=argparse.FileType("r"))
54 parser.add_argument("--build-thumbprint-file", type=argparse.FileType("r"))
55 parser.add_argument("--build-username", required=True)
56 parser.add_argument("--date-file", required=True, type=argparse.FileType("r"))
57 parser.add_argument("--platform-preview-sdk-fingerprint-file", required=True, type=argparse.FileType("r"))
58 parser.add_argument("--prop-files", action="append", type=argparse.FileType("r"), default=[])
59 parser.add_argument("--product-config", required=True, type=argparse.FileType("r"))
60 parser.add_argument("--partition", required=True)
61 parser.add_argument("--build-broken-dup-sysprop", action="store_true", default=False)
62
63 parser.add_argument("--out", required=True, type=argparse.FileType("w"))
64
65 args = parser.parse_args()
66
67 # post process parse_args requiring manual handling
68 args.config = json.load(args.product_config)
69 config = args.config
70
71 config["BuildFlavor"] = get_build_flavor(config)
72 config["BuildKeys"] = get_build_keys(config)
73 config["BuildVariant"] = get_build_variant(config)
74
75 config["BuildFingerprint"] = args.build_fingerprint_file.read().strip()
76 config["BuildHostname"] = args.build_hostname_file.read().strip()
77 config["BuildNumber"] = args.build_number_file.read().strip()
78 config["BuildUsername"] = args.build_username
Inseob Kim66c3cba2024-06-25 19:09:12 +090079
80 build_version_tags_list = config["BuildVersionTags"]
Inseob Kim320628f2024-06-18 11:09:12 +090081 if config["BuildType"] == "debug":
Inseob Kim66c3cba2024-06-25 19:09:12 +090082 build_version_tags_list.append("debug")
83 build_version_tags_list.append(config["BuildKeys"])
84 build_version_tags = ",".join(sorted(set(build_version_tags_list)))
85 config["BuildVersionTags"] = build_version_tags
Inseob Kim320628f2024-06-18 11:09:12 +090086
87 raw_date = args.date_file.read().strip()
88 config["Date"] = subprocess.check_output(["date", "-d", f"@{raw_date}"], text=True).strip()
89 config["DateUtc"] = subprocess.check_output(["date", "-d", f"@{raw_date}", "+%s"], text=True).strip()
90
91 # build_desc is human readable strings that describe this build. This has the same info as the
92 # build fingerprint.
93 # e.g. "aosp_cf_x86_64_phone-userdebug VanillaIceCream MAIN eng.20240319.143939 test-keys"
94 config["BuildDesc"] = f"{config['DeviceProduct']}-{config['BuildVariant']} " \
95 f"{config['Platform_version_name']} {config['BuildId']} " \
96 f"{config['BuildNumber']} {config['BuildVersionTags']}"
97
98 config["PlatformPreviewSdkFingerprint"] = args.platform_preview_sdk_fingerprint_file.read().strip()
99
100 if args.build_thumbprint_file:
101 config["BuildThumbprint"] = args.build_thumbprint_file.read().strip()
102
103 append_additional_system_props(args)
104 append_additional_vendor_props(args)
105 append_additional_product_props(args)
106
107 return args
108
109def generate_common_build_props(args):
110 print("####################################")
111 print("# from generate_common_build_props")
112 print("# These properties identify this partition image.")
113 print("####################################")
114
115 config = args.config
116 partition = args.partition
117
118 if partition == "system":
119 print(f"ro.product.{partition}.brand={config['SystemBrand']}")
120 print(f"ro.product.{partition}.device={config['SystemDevice']}")
121 print(f"ro.product.{partition}.manufacturer={config['SystemManufacturer']}")
122 print(f"ro.product.{partition}.model={config['SystemModel']}")
123 print(f"ro.product.{partition}.name={config['SystemName']}")
124 else:
125 print(f"ro.product.{partition}.brand={config['ProductBrand']}")
126 print(f"ro.product.{partition}.device={config['DeviceName']}")
127 print(f"ro.product.{partition}.manufacturer={config['ProductManufacturer']}")
128 print(f"ro.product.{partition}.model={config['ProductModel']}")
129 print(f"ro.product.{partition}.name={config['DeviceProduct']}")
130
131 if partition != "system":
132 if config["ModelForAttestation"]:
133 print(f"ro.product.model_for_attestation={config['ModelForAttestation']}")
134 if config["BrandForAttestation"]:
135 print(f"ro.product.brand_for_attestation={config['BrandForAttestation']}")
136 if config["NameForAttestation"]:
137 print(f"ro.product.name_for_attestation={config['NameForAttestation']}")
138 if config["DeviceForAttestation"]:
139 print(f"ro.product.device_for_attestation={config['DeviceForAttestation']}")
140 if config["ManufacturerForAttestation"]:
141 print(f"ro.product.manufacturer_for_attestation={config['ManufacturerForAttestation']}")
142
143 if config["ZygoteForce64"]:
144 if partition == "vendor":
145 print(f"ro.{partition}.product.cpu.abilist={config['DeviceAbiList64']}")
146 print(f"ro.{partition}.product.cpu.abilist32=")
147 print(f"ro.{partition}.product.cpu.abilist64={config['DeviceAbiList64']}")
148 else:
149 if partition == "system" or partition == "vendor" or partition == "odm":
150 print(f"ro.{partition}.product.cpu.abilist={config['DeviceAbiList']}")
151 print(f"ro.{partition}.product.cpu.abilist32={config['DeviceAbiList32']}")
152 print(f"ro.{partition}.product.cpu.abilist64={config['DeviceAbiList64']}")
153
154 print(f"ro.{partition}.build.date={config['Date']}")
155 print(f"ro.{partition}.build.date.utc={config['DateUtc']}")
156 # Allow optional assignments for ARC forward-declarations (b/249168657)
157 # TODO: Remove any tag-related inconsistencies once the goals from
158 # go/arc-android-sigprop-changes have been achieved.
159 print(f"ro.{partition}.build.fingerprint?={config['BuildFingerprint']}")
160 print(f"ro.{partition}.build.id?={config['BuildId']}")
161 print(f"ro.{partition}.build.tags?={config['BuildVersionTags']}")
162 print(f"ro.{partition}.build.type={config['BuildVariant']}")
163 print(f"ro.{partition}.build.version.incremental={config['BuildNumber']}")
164 print(f"ro.{partition}.build.version.release={config['Platform_version_last_stable']}")
165 print(f"ro.{partition}.build.version.release_or_codename={config['Platform_version_name']}")
166 print(f"ro.{partition}.build.version.sdk={config['Platform_sdk_version']}")
167
168def generate_build_info(args):
169 print()
170 print("####################################")
171 print("# from gen_build_prop.py:generate_build_info")
172 print("####################################")
173 print("# begin build properties")
174
175 config = args.config
176 build_flags = config["BuildFlags"]
177
178 # The ro.build.id will be set dynamically by init, by appending the unique vbmeta digest.
179 if config["BoardUseVbmetaDigestInFingerprint"]:
180 print(f"ro.build.legacy.id={config['BuildId']}")
181 else:
182 print(f"ro.build.id?={config['BuildId']}")
183
184 # ro.build.display.id is shown under Settings -> About Phone
185 if config["BuildVariant"] == "user":
186 # User builds should show:
187 # release build number or branch.buld_number non-release builds
188
189 # Dev. branches should have DISPLAY_BUILD_NUMBER set
190 if config["DisplayBuildNumber"]:
Inseob Kim5c333a92024-07-19 09:25:38 +0900191 print(f"ro.build.display.id?={config['BuildId']}.{config['BuildNumber']} {config['BuildKeys']}")
Inseob Kim320628f2024-06-18 11:09:12 +0900192 else:
193 print(f"ro.build.display.id?={config['BuildId']} {config['BuildKeys']}")
194 else:
195 # Non-user builds should show detailed build information (See build desc above)
196 print(f"ro.build.display.id?={config['BuildDesc']}")
197 print(f"ro.build.version.incremental={config['BuildNumber']}")
198 print(f"ro.build.version.sdk={config['Platform_sdk_version']}")
199 print(f"ro.build.version.preview_sdk={config['Platform_preview_sdk_version']}")
200 print(f"ro.build.version.preview_sdk_fingerprint={config['PlatformPreviewSdkFingerprint']}")
201 print(f"ro.build.version.codename={config['Platform_sdk_codename']}")
202 print(f"ro.build.version.all_codenames={','.join(config['Platform_version_active_codenames'])}")
203 print(f"ro.build.version.known_codenames={config['Platform_version_known_codenames']}")
204 print(f"ro.build.version.release={config['Platform_version_last_stable']}")
205 print(f"ro.build.version.release_or_codename={config['Platform_version_name']}")
206 print(f"ro.build.version.release_or_preview_display={config['Platform_display_version_name']}")
207 print(f"ro.build.version.security_patch={config['Platform_security_patch']}")
208 print(f"ro.build.version.base_os={config['Platform_base_os']}")
209 print(f"ro.build.version.min_supported_target_sdk={build_flags['RELEASE_PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION']}")
210 print(f"ro.build.date={config['Date']}")
211 print(f"ro.build.date.utc={config['DateUtc']}")
212 print(f"ro.build.type={config['BuildVariant']}")
213 print(f"ro.build.user={config['BuildUsername']}")
214 print(f"ro.build.host={config['BuildHostname']}")
215 # TODO: Remove any tag-related optional property declarations once the goals
216 # from go/arc-android-sigprop-changes have been achieved.
217 print(f"ro.build.tags?={config['BuildVersionTags']}")
218 # ro.build.flavor are used only by the test harness to distinguish builds.
219 # Only add _asan for a sanitized build if it isn't already a part of the
220 # flavor (via a dedicated lunch config for example).
221 print(f"ro.build.flavor={config['BuildFlavor']}")
222
223 # These values are deprecated, use "ro.product.cpu.abilist"
224 # instead (see below).
225 print(f"# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,")
226 print(f"# use ro.product.cpu.abilist instead.")
227 print(f"ro.product.cpu.abi={config['DeviceAbi'][0]}")
228 if len(config["DeviceAbi"]) > 1:
229 print(f"ro.product.cpu.abi2={config['DeviceAbi'][1]}")
230
231 if config["ProductLocales"]:
232 print(f"ro.product.locale={config['ProductLocales'][0]}")
233 print(f"ro.wifi.channels={' '.join(config['ProductDefaultWifiChannels'])}")
234
235 print(f"# ro.build.product is obsolete; use ro.product.device")
236 print(f"ro.build.product={config['DeviceName']}")
237
238 print(f"# Do not try to parse description or thumbprint")
239 print(f"ro.build.description?={config['BuildDesc']}")
Inseob Kim4f5e9372024-07-31 07:58:23 +0900240 if "BuildThumbprint" in config:
Inseob Kim320628f2024-06-18 11:09:12 +0900241 print(f"ro.build.thumbprint={config['BuildThumbprint']}")
242
243 print(f"# end build properties")
244
245def write_properties_from_file(file):
246 print()
247 print("####################################")
248 print(f"# from {file.name}")
249 print("####################################")
250 print(file.read(), end="")
251
252def write_properties_from_variable(name, props, build_broken_dup_sysprop):
253 print()
254 print("####################################")
255 print(f"# from variable {name}")
256 print("####################################")
257
258 # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.
259 # Optional assignments are all converted to normal assignments and
260 # when their duplicates the first one wins.
261 if build_broken_dup_sysprop:
262 processed_props = []
263 seen_props = set()
264 for line in props:
265 line = line.replace("?=", "=")
266 key, value = line.split("=", 1)
267 if key in seen_props:
268 continue
269 seen_props.add(key)
270 processed_props.append(line)
271 props = processed_props
272
273 for line in props:
274 print(line)
275
276def append_additional_system_props(args):
277 props = []
278
279 config = args.config
280
281 # Add the product-defined properties to the build properties.
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000282 if not config["PropertySplitEnabled"] or not config["VendorImageFileSystemType"]:
Inseob Kim320628f2024-06-18 11:09:12 +0900283 if "PRODUCT_PROPERTY_OVERRIDES" in config:
284 props += config["PRODUCT_PROPERTY_OVERRIDES"]
285
286 props.append(f"ro.treble.enabled={'true' if config['FullTreble'] else 'false'}")
287 # Set ro.llndk.api_level to show the maximum vendor API level that the LLNDK
288 # in the system partition supports.
289 if config["VendorApiLevel"]:
290 props.append(f"ro.llndk.api_level={config['VendorApiLevel']}")
291
292 # Sets ro.actionable_compatible_property.enabled to know on runtime whether
293 # the allowed list of actionable compatible properties is enabled or not.
294 props.append("ro.actionable_compatible_property.enabled=true")
295
296 # Enable core platform API violation warnings on userdebug and eng builds.
297 if config["BuildVariant"] != "user":
298 props.append("persist.debug.dalvik.vm.core_platform_api_policy=just-warn")
299
300 # Define ro.sanitize.<name> properties for all global sanitizers.
301 for sanitize_target in config["SanitizeDevice"]:
302 props.append(f"ro.sanitize.{sanitize_target}=true")
303
304 # Sets the default value of ro.postinstall.fstab.prefix to /system.
305 # Device board config should override the value to /product when needed by:
306 #
307 # PRODUCT_PRODUCT_PROPERTIES += ro.postinstall.fstab.prefix=/product
308 #
309 # It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to
310 # mount system_other partition.
311 props.append("ro.postinstall.fstab.prefix=/system")
312
313 enable_target_debugging = True
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000314 enable_dalvik_lock_contention_logging = True
Inseob Kim320628f2024-06-18 11:09:12 +0900315 if config["BuildVariant"] == "user" or config["BuildVariant"] == "userdebug":
316 # Target is secure in user builds.
317 props.append("ro.secure=1")
318 props.append("security.perf_harden=1")
319
320 if config["BuildVariant"] == "user":
321 # Disable debugging in plain user builds.
322 props.append("ro.adb.secure=1")
323 enable_target_debugging = False
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000324 enable_dalvik_lock_contention_logging = False
325 else:
326 # Disable debugging in userdebug builds if PRODUCT_NOT_DEBUGGABLE_IN_USERDEBUG
327 # is set.
328 if config["ProductNotDebuggableInUserdebug"]:
329 enable_target_debugging = False
Inseob Kim320628f2024-06-18 11:09:12 +0900330
331 # Disallow mock locations by default for user builds
332 props.append("ro.allow.mock.location=0")
333 else:
334 # Turn on checkjni for non-user builds.
335 props.append("ro.kernel.android.checkjni=1")
336 # Set device insecure for non-user builds.
337 props.append("ro.secure=0")
338 # Allow mock locations by default for non user builds
339 props.append("ro.allow.mock.location=1")
340
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000341 if enable_dalvik_lock_contention_logging:
Inseob Kim320628f2024-06-18 11:09:12 +0900342 # Enable Dalvik lock contention logging.
343 props.append("dalvik.vm.lockprof.threshold=500")
344
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000345 if enable_target_debugging:
Inseob Kim320628f2024-06-18 11:09:12 +0900346 # Target is more debuggable and adbd is on by default
347 props.append("ro.debuggable=1")
348 else:
349 # Target is less debuggable and adbd is off by default
350 props.append("ro.debuggable=0")
351
352 if config["BuildVariant"] == "eng":
353 if "ro.setupwizard.mode=ENABLED" in props:
354 # Don't require the setup wizard on eng builds
355 props = list(filter(lambda x: not x.startswith("ro.setupwizard.mode="), props))
356 props.append("ro.setupwizard.mode=OPTIONAL")
357
358 if not config["SdkBuild"]:
359 # To speedup startup of non-preopted builds, don't verify or compile the boot image.
360 props.append("dalvik.vm.image-dex2oat-filter=extract")
361 # b/323566535
362 props.append("init.svc_debug.no_fatal.zygote=true")
363
364 if config["SdkBuild"]:
365 props.append("xmpp.auto-presence=true")
366 props.append("ro.config.nocheckin=yes")
367
368 props.append("net.bt.name=Android")
369
370 # This property is set by flashing debug boot image, so default to false.
371 props.append("ro.force.debuggable=0")
372
373 config["ADDITIONAL_SYSTEM_PROPERTIES"] = props
374
375def append_additional_vendor_props(args):
376 props = []
377
378 config = args.config
379 build_flags = config["BuildFlags"]
380
381 # Add cpu properties for bionic and ART.
382 props.append(f"ro.bionic.arch={config['DeviceArch']}")
383 props.append(f"ro.bionic.cpu_variant={config['DeviceCpuVariantRuntime']}")
384 props.append(f"ro.bionic.2nd_arch={config['DeviceSecondaryArch']}")
385 props.append(f"ro.bionic.2nd_cpu_variant={config['DeviceSecondaryCpuVariantRuntime']}")
386
387 props.append(f"persist.sys.dalvik.vm.lib.2=libart.so")
388 props.append(f"dalvik.vm.isa.{config['DeviceArch']}.variant={config['Dex2oatTargetCpuVariantRuntime']}")
389 if config["Dex2oatTargetInstructionSetFeatures"]:
390 props.append(f"dalvik.vm.isa.{config['DeviceArch']}.features={config['Dex2oatTargetInstructionSetFeatures']}")
391
392 if config["DeviceSecondaryArch"]:
393 props.append(f"dalvik.vm.isa.{config['DeviceSecondaryArch']}.variant={config['SecondaryDex2oatCpuVariantRuntime']}")
394 if config["SecondaryDex2oatInstructionSetFeatures"]:
395 props.append(f"dalvik.vm.isa.{config['DeviceSecondaryArch']}.features={config['SecondaryDex2oatInstructionSetFeatures']}")
396
397 # Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
398 # mode (via libminui).
399 if config["RecoveryDefaultRotation"]:
400 props.append(f"ro.minui.default_rotation={config['RecoveryDefaultRotation']}")
401
402 if config["RecoveryOverscanPercent"]:
403 props.append(f"ro.minui.overscan_percent={config['RecoveryOverscanPercent']}")
404
405 if config["RecoveryPixelFormat"]:
406 props.append(f"ro.minui.pixel_format={config['RecoveryPixelFormat']}")
407
408 if "UseDynamicPartitions" in config:
409 props.append(f"ro.boot.dynamic_partitions={'true' if config['UseDynamicPartitions'] else 'false'}")
410
411 if "RetrofitDynamicPartitions" in config:
412 props.append(f"ro.boot.dynamic_partitions_retrofit={'true' if config['RetrofitDynamicPartitions'] else 'false'}")
413
414 if config["ShippingApiLevel"]:
415 props.append(f"ro.product.first_api_level={config['ShippingApiLevel']}")
416
417 if config["ShippingVendorApiLevel"]:
418 props.append(f"ro.vendor.api_level={config['ShippingVendorApiLevel']}")
419
420 if config["BuildVariant"] != "user" and config["BuildDebugfsRestrictionsEnabled"]:
421 props.append(f"ro.product.debugfs_restrictions.enabled=true")
422
423 # Vendors with GRF must define BOARD_SHIPPING_API_LEVEL for the vendor API level.
424 # This must not be defined for the non-GRF devices.
425 # The values of the GRF properties will be verified by post_process_props.py
426 if config["BoardShippingApiLevel"]:
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000427 props.append(f"ro.board.first_api_level={config['BoardShippingApiLevel']}")
Inseob Kim320628f2024-06-18 11:09:12 +0900428
429 # Build system set BOARD_API_LEVEL to show the api level of the vendor API surface.
430 # This must not be altered outside of build system.
431 if config["VendorApiLevel"]:
432 props.append(f"ro.board.api_level={config['VendorApiLevel']}")
433
434 # RELEASE_BOARD_API_LEVEL_FROZEN is true when the vendor API surface is frozen.
435 if build_flags["RELEASE_BOARD_API_LEVEL_FROZEN"]:
436 props.append(f"ro.board.api_frozen=true")
437
438 # Set build prop. This prop is read by ota_from_target_files when generating OTA,
439 # to decide if VABC should be disabled.
440 if config["DontUseVabcOta"]:
441 props.append(f"ro.vendor.build.dont_use_vabc=true")
442
443 # Set the flag in vendor. So VTS would know if the new fingerprint format is in use when
444 # the system images are replaced by GSI.
445 if config["BoardUseVbmetaDigestInFingerprint"]:
446 props.append(f"ro.vendor.build.fingerprint_has_digest=1")
447
448 props.append(f"ro.vendor.build.security_patch={config['VendorSecurityPatch']}")
449 props.append(f"ro.product.board={config['BootloaderBoardName']}")
450 props.append(f"ro.board.platform={config['BoardPlatform']}")
451 props.append(f"ro.hwui.use_vulkan={'true' if config['UsesVulkan'] else 'false'}")
452
453 if config["ScreenDensity"]:
454 props.append(f"ro.sf.lcd_density={config['ScreenDensity']}")
455
456 if "AbOtaUpdater" in config:
457 props.append(f"ro.build.ab_update={'true' if config['AbOtaUpdater'] else 'false'}")
458 if config["AbOtaUpdater"]:
459 props.append(f"ro.vendor.build.ab_ota_partitions={config['AbOtaPartitions']}")
460
461 config["ADDITIONAL_VENDOR_PROPERTIES"] = props
462
463def append_additional_product_props(args):
464 props = []
465
466 config = args.config
467
468 # Add the system server compiler filter if they are specified for the product.
469 if config["SystemServerCompilerFilter"]:
470 props.append(f"dalvik.vm.systemservercompilerfilter={config['SystemServerCompilerFilter']}")
471
472 # Add the 16K developer args if it is defined for the product.
473 props.append(f"ro.product.build.16k_page.enabled={'true' if config['Product16KDeveloperOption'] else 'false'}")
474
475 props.append(f"ro.build.characteristics={config['AAPTCharacteristics']}")
476
477 if "AbOtaUpdater" in config and config["AbOtaUpdater"]:
478 props.append(f"ro.product.ab_ota_partitions={config['AbOtaPartitions']}")
479
480 # Set this property for VTS to skip large page size tests on unsupported devices.
481 props.append(f"ro.product.cpu.pagesize.max={config['DeviceMaxPageSizeSupported']}")
482
483 if config["NoBionicPageSizeMacro"]:
484 props.append(f"ro.product.build.no_bionic_page_size_macro=true")
485
Inseob Kim6d4e02d2024-07-31 02:09:34 +0000486 # This is a temporary system property that controls the ART module. The plan is
487 # to remove it by Aug 2025, at which time Mainline updates of the ART module
488 # will ignore it as well.
Inseob Kim320628f2024-06-18 11:09:12 +0900489 # If the value is "default", it will be mangled by post_process_props.py.
490 props.append(f"ro.dalvik.vm.enable_uffd_gc={config['EnableUffdGc']}")
491
492 config["ADDITIONAL_PRODUCT_PROPERTIES"] = props
493
494def build_system_prop(args):
495 config = args.config
496
497 # Order matters here. When there are duplicates, the last one wins.
498 # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
499 variables = [
500 "ADDITIONAL_SYSTEM_PROPERTIES",
501 "PRODUCT_SYSTEM_PROPERTIES",
502 # TODO(b/117892318): deprecate this
503 "PRODUCT_SYSTEM_DEFAULT_PROPERTIES",
504 ]
505
506 if not config["PropertySplitEnabled"]:
507 variables += [
508 "ADDITIONAL_VENDOR_PROPERTIES",
509 "PRODUCT_VENDOR_PROPERTIES",
510 ]
511
512 build_prop(args, gen_build_info=True, gen_common_build_props=True, variables=variables)
513
514'''
515def build_vendor_prop(args):
516 config = args.config
517
518 # Order matters here. When there are duplicates, the last one wins.
519 # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
520 variables = []
521 if config["PropertySplitEnabled"]:
522 variables += [
523 "ADDITIONAL_VENDOR_PROPERTIES",
524 "PRODUCT_VENDOR_PROPERTIES",
525 # TODO(b/117892318): deprecate this
526 "PRODUCT_DEFAULT_PROPERTY_OVERRIDES",
527 "PRODUCT_PROPERTY_OVERRIDES",
528 ]
529
530 build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
531
532def build_product_prop(args):
533 config = args.config
534
535 # Order matters here. When there are duplicates, the last one wins.
536 # TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
537 variables = [
538 "ADDITIONAL_PRODUCT_PROPERTIES",
539 "PRODUCT_PRODUCT_PROPERTIES",
540 ]
541 build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
542'''
543
544def build_prop(args, gen_build_info, gen_common_build_props, variables):
545 config = args.config
546
547 if gen_common_build_props:
548 generate_common_build_props(args)
549
550 if gen_build_info:
551 generate_build_info(args)
552
553 for prop_file in args.prop_files:
554 write_properties_from_file(prop_file)
555
556 for variable in variables:
557 if variable in config:
558 write_properties_from_variable(variable, config[variable], args.build_broken_dup_sysprop)
559
560def main():
561 args = parse_args()
562
563 with contextlib.redirect_stdout(args.out):
564 if args.partition == "system":
565 build_system_prop(args)
566 '''
567 elif args.partition == "vendor":
568 build_vendor_prop(args)
569 elif args.partition == "product":
570 build_product_prop(args)
571 '''
572 else:
573 sys.exit(f"not supported partition {args.partition}")
574
575if __name__ == "__main__":
576 main()