Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a6bc22b authored by Alexander Mishkovets's avatar Alexander Mishkovets
Browse files

Fix the order of loading OEM properties

Move the OEM property imports so that they take higher precedence over
product and can still be overridden by factory properties.

Bug: 171304788
Test: manual
Change-Id: I0c0be446d5e9af77acfcdeb5145b5776c8d5820f
parent 6f83343e
Loading
Loading
Loading
Loading
+52 −24
Original line number Diff line number Diff line
@@ -68,7 +68,9 @@ endef
#       emitted to the output
# $(4): list of variable names each of which contains name=value pairs
# $(5): optional list of prop names to force remove from the output. Properties from both
#       $(3) and (4) are affected.
#       $(3) and (4) are affected
# $(6): optional list of files to append at the end. The content of each file is emitted
#       to the output
define build-properties
ALL_DEFAULT_INSTALLED_MODULES += $(2)

@@ -90,7 +92,7 @@ $(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
    $(eval _option := --allow-dup)\
)

$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3)
$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3) $(6)
	$(hide) echo Building $$@
	$(hide) mkdir -p $$(dir $$@)
	$(hide) rm -f $$@ && touch $$@
@@ -113,6 +115,10 @@ $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3
	    )\
	)
	$(hide) $(POST_PROCESS_PROPS) $$(_option) $$@ $(5)
	$(hide) $(foreach file,$(strip $(6)),\
	    if [ -f "$(file)" ]; then\
	        cat $(file) >> $$@;\
	    fi;)
	$(hide) echo "# end of file" >> $$@
endef

@@ -265,19 +271,6 @@ $(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT)
	        TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
	        bash $(BUILDINFO_SH) > $@

ifneq ($(PRODUCT_OEM_PROPERTIES),)
import_oem_prop := $(call intermediates-dir-for,ETC,system_build_prop)/oem.prop

$(import_oem_prop):
	$(hide) echo "#" >> $@; \
	        echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
	        echo "#" >> $@;
	$(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
	    echo "import /oem/oem.prop $(prop)" >> $@;)
else
import_oem_prop :=
endif

ifdef TARGET_SYSTEM_PROP
system_prop_file := $(TARGET_SYSTEM_PROP)
else
@@ -285,7 +278,6 @@ system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
endif

_prop_files_ := \
  $(import_oem_prop) \
  $(gen_from_buildinfo_sh) \
  $(system_prop_file)

@@ -311,9 +303,13 @@ _blacklist_names_ := \

INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop

$(eval $(call build-properties,system,$(INSTALLED_BUILD_PROP_TARGET),\
$(_prop_files_),$(_prop_vars_),\
$(_blacklist_names_)))
$(eval $(call build-properties,\
    system,\
    $(INSTALLED_BUILD_PROP_TARGET),\
    $(_prop_files_),\
    $(_prop_vars_),\
    $(_blacklist_names_),\
    $(empty)))

# -----------------------------------------------------------------
# vendor/build.prop
@@ -349,7 +345,8 @@ $(eval $(call build-properties,\
    $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
    $(_prop_files_),\
    $(_prop_vars_),\
    $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)))
    $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
    $(empty)))

# -----------------------------------------------------------------
# product/etc/build.prop
@@ -366,12 +363,29 @@ _prop_vars_ := \
    PRODUCT_PRODUCT_PROPERTIES

INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop

ifdef PRODUCT_OEM_PROPERTIES
import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop

$(import_oem_prop):
	$(hide) echo "####################################" >> $@; \
	        echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
	        echo "####################################" >> $@;
	$(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
	    echo "import /oem/oem.prop $(prop)" >> $@;)

_footers_ := $(import_oem_prop)
else
_footers_ :=
endif

$(eval $(call build-properties,\
    product,\
    $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
    $(_prop_files_),\
    $(_prop_vars_),\
    $(empty)))
    $(empty),\
    $(_footers_)))

# ----------------------------------------------------------------
# odm/etc/build.prop
@@ -392,6 +406,7 @@ $(eval $(call build-properties,\
    $(INSTALLED_ODM_BUILD_PROP_TARGET),\
    $(_prop_files),\
    $(_prop_vars_),\
    $(empty),\
    $(empty)))

# ----------------------------------------------------------------
@@ -401,7 +416,11 @@ $(eval $(call build-properties,\
INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
$(eval $(call build-properties,\
    vendor_dlkm,\
    $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
    $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
    $(empty),\
    $(empty),\
    $(empty),\
    $(empty)))

# ----------------------------------------------------------------
# odm_dlkm/etc/build.prop
@@ -410,7 +429,11 @@ $(eval $(call build-properties,\
INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
$(eval $(call build-properties,\
    odm_dlkm,\
    $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
    $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
    $(empty),\
    $(empty),\
    $(empty),\
    $(empty)))

# -----------------------------------------------------------------
# system_ext/etc/build.prop
@@ -429,6 +452,7 @@ $(eval $(call build-properties,\
    $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
    $(_prop_files_),\
    $(_prop_vars_),\
    $(empty),\
    $(empty)))

# ----------------------------------------------------------------
@@ -439,4 +463,8 @@ RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
$(eval $(call build-properties,\
    bootimage,\
    $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
    $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
    $(empty),\
    $(empty),\
    $(empty),\
    $(empty)))