• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2020 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# sysprop.mk defines rules for generating <partition>/[etc/]build.prop files
18
19# -----------------------------------------------------------------
20# property_overrides_split_enabled
21property_overrides_split_enabled :=
22ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
23  property_overrides_split_enabled := true
24endif
25
26BUILDINFO_SH := build/make/tools/buildinfo.sh
27POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX)
28
29# Emits a set of sysprops common to all partitions to a file.
30# $(1): Partition name
31# $(2): Output file name
32define generate-common-build-props
33    echo "####################################" >> $(2);\
34    echo "# from generate-common-build-props" >> $(2);\
35    echo "# These properties identify this partition image." >> $(2);\
36    echo "####################################" >> $(2);\
37    $(if $(filter system,$(1)),\
38        echo "ro.product.$(1).brand=$(PRODUCT_SYSTEM_BRAND)" >> $(2);\
39        echo "ro.product.$(1).device=$(PRODUCT_SYSTEM_DEVICE)" >> $(2);\
40        echo "ro.product.$(1).manufacturer=$(PRODUCT_SYSTEM_MANUFACTURER)" >> $(2);\
41        echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\
42        echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\
43      ,\
44        echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\
45        echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\
46        echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\
47        echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\
48        echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\
49        # Attestation specific properties for AOSP/GSI build running on device.
50        if [ -n "$(strip $(PRODUCT_MODEL_FOR_ATTESTATION))" ]; then \
51            echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\
52        fi; \
53        if [ -n "$(strip $(PRODUCT_BRAND_FOR_ATTESTATION))" ]; then \
54            echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\
55        fi; \
56        if [ -n "$(strip $(PRODUCT_NAME_FOR_ATTESTATION))" ]; then \
57            echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\
58        fi; \
59        if [ -n "$(strip $(PRODUCT_DEVICE_FOR_ATTESTATION))" ]; then \
60            echo "ro.product.device_for_attestation=$(PRODUCT_DEVICE_FOR_ATTESTATION)" >> $(2);\
61        fi; \
62        if [ -n "$(strip $(PRODUCT_MANUFACTURER_FOR_ATTESTATION))" ]; then \
63            echo "ro.product.manufacturer_for_attestation=$(PRODUCT_MANUFACTURER_FOR_ATTESTATION)" >> $(2);\
64        fi; \
65    )\
66    $(if $(filter true,$(ZYGOTE_FORCE_64)),\
67        $(if $(filter vendor,$(1)),\
68            echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
69            echo "ro.$(1).product.cpu.abilist32=" >> $(2);\
70            echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
71        )\
72    ,\
73        $(if $(filter system vendor odm,$(1)),\
74            echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST)" >> $(2);\
75            echo "ro.$(1).product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT)" >> $(2);\
76            echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
77        )\
78    )\
79    echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
80    echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
81    echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
82    echo "ro.$(1).build.id=$(BUILD_ID)" >> $(2);\
83    echo "ro.$(1).build.tags=$(BUILD_VERSION_TAGS)" >> $(2);\
84    echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
85    echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
86    echo "ro.$(1).build.version.release=$(PLATFORM_VERSION_LAST_STABLE)" >> $(2);\
87    echo "ro.$(1).build.version.release_or_codename=$(PLATFORM_VERSION)" >> $(2);\
88    echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
89
90endef
91
92# Rule for generating <partition>/[etc/]build.prop file
93#
94# $(1): partition name
95# $(2): path to the output
96# $(3): path to the input *.prop files. The contents of the files are directly
97#       emitted to the output
98# $(4): list of variable names each of which contains name=value pairs
99# $(5): optional list of prop names to force remove from the output. Properties from both
100#       $(3) and (4) are affected
101# $(6): optional list of files to append at the end. The content of each file is emitted
102#       to the output
103# $(7): optional flag to skip common properties generation
104define build-properties
105ALL_DEFAULT_INSTALLED_MODULES += $(2)
106
107$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
108$(eval # Eliminate spaces around the ?= and = separators.)
109$(foreach name,$(strip $(4)),\
110    $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
111    $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
112)
113
114$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
115$(eval # Optional assignments are all converted to normal assignments and)
116$(eval # when their duplicates the first one wins)
117$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
118    $(foreach name,$(strip $(4)),\
119        $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
120        $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
121    )\
122    $(eval _option := --allow-dup)\
123)
124
125$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6)
126	$(hide) echo Building $$@
127	$(hide) mkdir -p $$(dir $$@)
128	$(hide) rm -f $$@ && touch $$@
129ifneq ($(strip $(7)), true)
130	$(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
131endif
132	$(hide) $(foreach file,$(strip $(3)),\
133	    if [ -f "$(file)" ]; then\
134	        echo "" >> $$@;\
135	        echo "####################################" >> $$@;\
136	        echo "# from $(file)" >> $$@;\
137	        echo "####################################" >> $$@;\
138	        cat $(file) >> $$@;\
139	    fi;)
140	$(hide) $(foreach name,$(strip $(4)),\
141	    echo "" >> $$@;\
142	    echo "####################################" >> $$@;\
143	    echo "# from variable $(name)" >> $$@;\
144	    echo "####################################" >> $$@;\
145	    $$(foreach line,$$(_resolved_$(name)),\
146	        echo "$$(line)" >> $$@;\
147	    )\
148	)
149	$(hide) $(POST_PROCESS_PROPS) $$(_option) --sdk-version $(PLATFORM_SDK_VERSION) $$@ $(5)
150	$(hide) $(foreach file,$(strip $(6)),\
151	    if [ -f "$(file)" ]; then\
152	        cat $(file) >> $$@;\
153	    fi;)
154	$(hide) echo "# end of file" >> $$@
155
156$(call declare-1p-target,$(2))
157endef
158
159# -----------------------------------------------------------------
160# Define fingerprint, thumbprint, and version tags for the current build
161#
162# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
163# implementer that further distinguishes the build. It's basically defined
164# by the device implementer. Here, we are adding a mandatory tag that
165# identifies the signing config of the build.
166BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
167ifeq ($(TARGET_BUILD_TYPE),debug)
168  BUILD_VERSION_TAGS += debug
169endif
170# The "test-keys" tag marks builds signed with the old test keys,
171# which are available in the SDK.  "dev-keys" marks builds signed with
172# non-default dev keys (usually private keys from a vendor directory).
173# Both of these tags will be removed and replaced with "release-keys"
174# when the target-files is signed in a post-build step.
175ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
176BUILD_KEYS := test-keys
177else
178BUILD_KEYS := dev-keys
179endif
180BUILD_VERSION_TAGS += $(BUILD_KEYS)
181BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
182
183# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
184# product; used by the OTA server.
185ifeq (,$(strip $(BUILD_FINGERPRINT)))
186  ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
187    BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
188  else
189    BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
190  endif
191  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
192endif
193# unset it for safety.
194BF_BUILD_NUMBER :=
195
196BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
197ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
198  $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
199endif
200BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
201# unset it for safety.
202BUILD_FINGERPRINT :=
203
204# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
205# OTA server. This purposefully excludes any product-specific variables.
206ifeq (,$(strip $(BUILD_THUMBPRINT)))
207  BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
208endif
209
210BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
211ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
212  $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
213endif
214BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
215# unset it for safety.
216BUILD_THUMBPRINT :=
217
218# -----------------------------------------------------------------
219# Define human readable strings that describe this build
220#
221
222# BUILD_ID: detail info; has the same info as the build fingerprint
223BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
224
225# BUILD_DISPLAY_ID is shown under Settings -> About Phone
226ifeq ($(TARGET_BUILD_VARIANT),user)
227  # User builds should show:
228  # release build number or branch.buld_number non-release builds
229
230  # Dev. branches should have DISPLAY_BUILD_NUMBER set
231  ifeq (true,$(DISPLAY_BUILD_NUMBER))
232    BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
233  else
234    BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
235  endif
236else
237  # Non-user builds should show detailed build information
238  BUILD_DISPLAY_ID := $(BUILD_DESC)
239endif
240
241# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
242# harness to distinguish builds. Only add _asan for a sanitized build
243# if it isn't already a part of the flavor (via a dedicated lunch
244# config for example).
245TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
246ifneq (, $(filter address, $(SANITIZE_TARGET)))
247ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
248TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
249endif
250endif
251
252KNOWN_OEM_THUMBPRINT_PROPERTIES := \
253    ro.product.brand \
254    ro.product.name \
255    ro.product.device
256OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
257    $(PRODUCT_OEM_PROPERTIES))
258KNOWN_OEM_THUMBPRINT_PROPERTIES:=
259
260# -----------------------------------------------------------------
261# system/build.prop
262#
263# Note: parts of this file that can't be generated by the build-properties
264# macro are manually created as separate files and then fed into the macro
265
266# Accepts a whitespace separated list of product locales such as
267# (en_US en_AU en_GB...) and returns the first locale in the list with
268# underscores replaced with hyphens. In the example above, this will
269# return "en-US".
270define get-default-product-locale
271$(strip $(subst _,-, $(firstword $(1))))
272endef
273
274gen_from_buildinfo_sh := $(call intermediates-dir-for,PACKAGING,system_build_prop)/buildinfo.prop
275$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) | $(BUILD_DATETIME_FILE) $(BUILD_NUMBER_FILE)
276	$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
277	        TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
278	        TARGET_DEVICE="$(TARGET_DEVICE)" \
279	        PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
280	        PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
281	        PRIVATE_BUILD_DESC="$(BUILD_DESC)" \
282	        BUILD_ID="$(BUILD_ID)" \
283	        BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
284	        DATE="$(DATE_FROM_FILE)" \
285	        BUILD_USERNAME="$(BUILD_USERNAME)" \
286	        BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
287	        BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
288	        BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT="$(BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT)" \
289	        PLATFORM_VERSION="$(PLATFORM_VERSION)" \
290	        PLATFORM_DISPLAY_VERSION="$(PLATFORM_DISPLAY_VERSION)" \
291	        PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
292	        PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
293	        PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
294	        PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
295	        PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
296	        PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
297	        PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
298	        PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
299	        PLATFORM_VERSION_KNOWN_CODENAMES="$(PLATFORM_VERSION_KNOWN_CODENAMES)" \
300	        PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
301	        BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
302	        $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
303	        TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
304	        TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
305	        TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
306	        TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
307	        TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
308	        ZYGOTE_FORCE_64_BIT="$(ZYGOTE_FORCE_64_BIT)" \
309	        bash $(BUILDINFO_SH) > $@
310
311ifdef TARGET_SYSTEM_PROP
312system_prop_file := $(TARGET_SYSTEM_PROP)
313else
314system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
315endif
316
317_prop_files_ := \
318  $(gen_from_buildinfo_sh) \
319  $(system_prop_file)
320
321# Order matters here. When there are duplicates, the last one wins.
322# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
323_prop_vars_ := \
324    ADDITIONAL_SYSTEM_PROPERTIES \
325    PRODUCT_SYSTEM_PROPERTIES
326
327# TODO(b/117892318): deprecate this
328_prop_vars_ += \
329    PRODUCT_SYSTEM_DEFAULT_PROPERTIES
330
331ifndef property_overrides_split_enabled
332_prop_vars_ += \
333    ADDITIONAL_VENDOR_PROPERTIES \
334    PRODUCT_VENDOR_PROPERTIES
335endif
336
337INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
338
339$(eval $(call build-properties,\
340    system,\
341    $(INSTALLED_BUILD_PROP_TARGET),\
342    $(_prop_files_),\
343    $(_prop_vars_),\
344    $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST),\
345    $(empty),\
346    $(empty)))
347
348$(eval $(call declare-1p-target,$(INSTALLED_BUILD_PROP_TARGET)))
349
350# -----------------------------------------------------------------
351# vendor/build.prop
352#
353_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
354    $(TARGET_VENDOR_PROP),\
355    $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
356
357android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
358$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
359	cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
360
361_prop_files_ += $(android_info_prop)
362
363ifdef property_overrides_split_enabled
364# Order matters here. When there are duplicates, the last one wins.
365# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
366_prop_vars_ := \
367    ADDITIONAL_VENDOR_PROPERTIES \
368    PRODUCT_VENDOR_PROPERTIES
369
370# TODO(b/117892318): deprecate this
371_prop_vars_ += \
372    PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
373    PRODUCT_PROPERTY_OVERRIDES
374else
375_prop_vars_ :=
376endif
377
378INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
379$(eval $(call build-properties,\
380    vendor,\
381    $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
382    $(_prop_files_),\
383    $(_prop_vars_),\
384    $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
385    $(empty),\
386    $(empty)))
387
388$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_BUILD_PROP_TARGET)))
389
390# -----------------------------------------------------------------
391# product/etc/build.prop
392#
393
394_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
395    $(TARGET_PRODUCT_PROP),\
396    $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
397
398# Order matters here. When there are duplicates, the last one wins.
399# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
400_prop_vars_ := \
401    ADDITIONAL_PRODUCT_PROPERTIES \
402    PRODUCT_PRODUCT_PROPERTIES
403
404INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop
405
406ifdef PRODUCT_OEM_PROPERTIES
407import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop
408
409$(import_oem_prop):
410	$(hide) echo "####################################" >> $@; \
411	        echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
412	        echo "####################################" >> $@;
413	$(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
414	    echo "import /oem/oem.prop $(prop)" >> $@;)
415
416_footers_ := $(import_oem_prop)
417else
418_footers_ :=
419endif
420
421# Skip common /product properties generation if device released before R and
422# has no product partition. This is the first part of the check.
423ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
424  _skip_common_properties := true
425endif
426
427# The second part of the check - always generate common properties for the
428# devices with product partition regardless of shipping level.
429ifneq ($(BOARD_USES_PRODUCTIMAGE),)
430  _skip_common_properties :=
431endif
432
433$(eval $(call build-properties,\
434    product,\
435    $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
436    $(_prop_files_),\
437    $(_prop_vars_),\
438    $(empty),\
439    $(_footers_),\
440    $(_skip_common_properties)))
441
442$(eval $(call declare-1p-target,$(INSTALLED_PRODUCT_BUILD_PROP_TARGET)))
443
444_skip_common_properties :=
445
446# ----------------------------------------------------------------
447# odm/etc/build.prop
448#
449_prop_files_ := $(if $(TARGET_ODM_PROP),\
450    $(TARGET_ODM_PROP),\
451    $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
452
453# Order matters here. When there are duplicates, the last one wins.
454# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
455_prop_vars_ := \
456    ADDITIONAL_ODM_PROPERTIES \
457    PRODUCT_ODM_PROPERTIES
458
459INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
460$(eval $(call build-properties,\
461    odm,\
462    $(INSTALLED_ODM_BUILD_PROP_TARGET),\
463    $(_prop_files_),\
464    $(_prop_vars_),\
465    $(empty),\
466    $(empty),\
467    $(empty)))
468
469$(eval $(call declare-1p-target,$(INSTALLED_ODM_BUILD_PROP_TARGET)))
470
471# ----------------------------------------------------------------
472# vendor_dlkm/etc/build.prop
473#
474
475INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
476$(eval $(call build-properties,\
477    vendor_dlkm,\
478    $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
479    $(empty),\
480    $(empty),\
481    $(empty),\
482    $(empty),\
483    $(empty)))
484
485$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
486
487# ----------------------------------------------------------------
488# odm_dlkm/etc/build.prop
489#
490
491INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
492$(eval $(call build-properties,\
493    odm_dlkm,\
494    $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
495    $(empty),\
496    $(empty),\
497    $(empty),\
498    $(empty),\
499    $(empty)))
500
501$(eval $(call declare-1p-target,$(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
502
503# ----------------------------------------------------------------
504# system_dlkm/build.prop
505#
506
507INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_DLKM)/etc/build.prop
508$(eval $(call build-properties,\
509    system_dlkm,\
510    $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET),\
511    $(empty),\
512    $(empty),\
513    $(empty),\
514    $(empty),\
515    $(empty)))
516
517$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET)))
518
519# -----------------------------------------------------------------
520# system_ext/etc/build.prop
521#
522_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
523    $(TARGET_SYSTEM_EXT_PROP),\
524    $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
525
526# Order matters here. When there are duplicates, the last one wins.
527# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
528_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
529
530INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
531$(eval $(call build-properties,\
532    system_ext,\
533    $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
534    $(_prop_files_),\
535    $(_prop_vars_),\
536    $(empty),\
537    $(empty),\
538    $(empty)))
539
540$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)))
541
542# ----------------------------------------------------------------
543# ramdisk/boot/etc/build.prop
544#
545
546RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
547INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
548$(eval $(call build-properties,\
549    bootimage,\
550    $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
551    $(empty),\
552    $(empty),\
553    $(empty),\
554    $(empty),\
555    $(empty)))
556
557$(eval $(call declare-1p-target,$(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
558
559ALL_INSTALLED_BUILD_PROP_FILES := \
560  $(INSTALLED_BUILD_PROP_TARGET) \
561  $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
562  $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
563  $(INSTALLED_ODM_BUILD_PROP_TARGET) \
564  $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET) \
565  $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET) \
566  $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET) \
567  $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) \
568  $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)
569
570# $1 installed file path, e.g. out/target/product/vsoc_x86_64/system/build.prop
571define is-build-prop
572$(if $(findstring $1,$(ALL_INSTALLED_BUILD_PROP_FILES)),Y)
573endef