Merge changes from topics "remove_bootimage_sysprops", "sysprop" am: 6dd5383c37 am: 04799633dd

Change-Id: Iddb4cfd419dc0f68e15cb62f2545d8bc178b42ca
This commit is contained in:
Jiyong Park 2020-05-29 21:52:11 +00:00 committed by Automerger Merge Worker
commit c96b261f59
4 changed files with 235 additions and 223 deletions

View file

@ -113,44 +113,38 @@ SKIP_BOOT_JARS_CHECK := true
endif
endif
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_DEFAULT_PROPERTIES.
ifneq ($(ADDITIONAL_DEFAULT_PROPERTIES),)
$(error ADDITIONAL_DEFAULT_PROPERTIES is deprecated)
endif
# ADDITIONAL_<partition>_PROPERTIES are properties that are determined by the
# build system itself. Don't let it be defined from outside of the core build
# system like Android.mk or <product>.mk files.
_additional_prop_var_names := \
ADDITIONAL_SYSTEM_PROPERTIES \
ADDITIONAL_VENDOR_PROPERTIES \
ADDITIONAL_ODM_PROPERTIES \
ADDITIONAL_PRODUCT_PROPERTIES
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_BUILD_PROPERTIES.
ifneq ($(ADDITIONAL_BUILD_PROPERTIES),)
$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES))
endif
$(foreach name, $(_additional_prop_var_names),\
$(if $($(name)),\
$(error $(name) must not set before here. $($(name)))\
,)\
$(eval $(name) :=)\
)
_additional_prop_var_names :=
ADDITIONAL_BUILD_PROPERTIES :=
#
# -----------------------------------------------------------------
# Validate ADDITIONAL_PRODUCT_PROPERTIES.
ifneq ($(ADDITIONAL_PRODUCT_PROPERTIES),)
$(error ADDITIONAL_PRODUCT_PROPERTIES must not be set before here: $(ADDITIONAL_PRODUCT_PROPERTIES))
endif
ADDITIONAL_PRODUCT_PROPERTIES :=
$(KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES, Please use ADDITIONAL_SYSTEM_PROPERTIES)
#
# -----------------------------------------------------------------
# Add the product-defined properties to the build properties.
ifdef PRODUCT_SHIPPING_API_LEVEL
ADDITIONAL_BUILD_PROPERTIES += \
ADDITIONAL_SYSTEM_PROPERTIES += \
ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
endif
ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
else
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
endif
endif
@ -199,7 +193,7 @@ include build/make/core/pdk_config.mk
# -----------------------------------------------------------------
ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
ADDITIONAL_SYSTEM_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
$(KATI_obsolete_var PRODUCT_FULL_TREBLE,\
Code should be written to work regardless of a device being Treble or \
@ -209,9 +203,9 @@ $(KATI_obsolete_var PRODUCT_FULL_TREBLE,\
# Sets ro.actionable_compatible_property.enabled to know on runtime whether the whitelist
# of actionable compatible properties is enabled or not.
ifeq ($(PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE),true)
ADDITIONAL_BUILD_PROPERTIES += ro.actionable_compatible_property.enabled=false
ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=false
else
ADDITIONAL_BUILD_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
# Add the system server compiler filter if they are specified for the product.
@ -221,7 +215,7 @@ endif
# Enable core platform API violation warnings on userdebug and eng builds.
ifneq ($(TARGET_BUILD_VARIANT),user)
ADDITIONAL_BUILD_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn
ADDITIONAL_SYSTEM_PROPERTIES += persist.debug.dalvik.vm.core_platform_api_policy=just-warn
endif
# Sets the default value of ro.postinstall.fstab.prefix to /system.
@ -231,7 +225,100 @@ endif
#
# It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to
# mount system_other partition.
ADDITIONAL_BUILD_PROPERTIES += ro.postinstall.fstab.prefix=/system
ADDITIONAL_SYSTEM_PROPERTIES += ro.postinstall.fstab.prefix=/system
# -----------------------------------------------------------------
# ADDITIONAL_VENDOR_PROPERTIES will be installed in vendor/build.prop if
# property_overrides_split_enabled is true. Otherwise it will be installed in
# /system/build.prop
ifdef BOARD_VNDK_VERSION
ifeq ($(BOARD_VNDK_VERSION),current)
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
else
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
endif
ifdef BOARD_VNDK_RUNTIME_DISABLE
ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
endif
else
ADDITIONAL_VENDOR_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
ADDITIONAL_VENDOR_PROPERTIES += ro.vndk.lite=true
endif
ADDITIONAL_VENDOR_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
# Add cpu properties for bionic and ART.
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
ADDITIONAL_VENDOR_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
ifdef TARGET_2ND_ARCH
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
ADDITIONAL_VENDOR_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
endif
# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
# mode (via libminui).
ifdef TARGET_RECOVERY_DEFAULT_ROTATION
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
endif
ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
endif
ifdef TARGET_RECOVERY_PIXEL_FORMAT
ADDITIONAL_VENDOR_PROPERTIES += \
ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
endif
ifdef PRODUCT_USE_DYNAMIC_PARTITIONS
ADDITIONAL_VENDOR_PROPERTIES += \
ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS)
endif
ifdef PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
ADDITIONAL_VENDOR_PROPERTIES += \
ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
endif
ifdef PRODUCT_SHIPPING_API_LEVEL
ADDITIONAL_VENDOR_PROPERTIES += \
ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
endif
ADDITIONAL_VENDOR_PROPERTIES += \
ro.vendor.build.security_patch=$(VENDOR_SECURITY_PATCH) \
ro.vendor.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \
ro.vendor.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \
ro.vendor.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT) \
ro.product.board=$(TARGET_BOOTLOADER_BOARD_NAME) \
ro.board.platform=$(TARGET_BOARD_PLATFORM) \
ro.hwui.use_vulkan=$(TARGET_USES_VULKAN)
ifdef TARGET_SCREEN_DENSITY
ADDITIONAL_VENDOR_PROPERTIES += \
ro.sf.lcd_density=$(TARGET_SCREEN_DENSITY)
endif
ifdef AB_OTA_UPDATER
ADDITIONAL_VENDOR_PROPERTIES += \
ro.build.ab_update=$(AB_OTA_UPDATER)
endif
ADDITIONAL_ODM_PROPERTIES += \
ro.odm.product.cpu.abilist=$(TARGET_CPU_ABI_LIST) \
ro.odm.product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT) \
ro.odm.product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)
# Set ro.product.vndk.version to know the VNDK version required by product
# modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value
@ -263,11 +350,11 @@ enable_target_debugging := true
tags_to_install :=
ifneq (,$(user_variant))
# Target is secure in user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.secure=1
ADDITIONAL_BUILD_PROPERTIES += security.perf_harden=1
ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1
ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1
ifeq ($(user_variant),user)
ADDITIONAL_BUILD_PROPERTIES += ro.adb.secure=1
ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1
endif
ifeq ($(user_variant),userdebug)
@ -279,40 +366,40 @@ ifneq (,$(user_variant))
endif
# Disallow mock locations by default for user builds
ADDITIONAL_BUILD_PROPERTIES += ro.allow.mock.location=0
ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=0
else # !user_variant
# Turn on checkjni for non-user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.kernel.android.checkjni=1
ADDITIONAL_SYSTEM_PROPERTIES += ro.kernel.android.checkjni=1
# Set device insecure for non-user builds.
ADDITIONAL_BUILD_PROPERTIES += ro.secure=0
ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=0
# Allow mock locations by default for non user builds
ADDITIONAL_BUILD_PROPERTIES += ro.allow.mock.location=1
ADDITIONAL_SYSTEM_PROPERTIES += ro.allow.mock.location=1
endif # !user_variant
ifeq (true,$(strip $(enable_target_debugging)))
# Target is more debuggable and adbd is on by default
ADDITIONAL_BUILD_PROPERTIES += ro.debuggable=1
ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=1
# Enable Dalvik lock contention logging.
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.lockprof.threshold=500
else # !enable_target_debugging
# Target is less debuggable and adbd is off by default
ADDITIONAL_BUILD_PROPERTIES += ro.debuggable=0
ADDITIONAL_SYSTEM_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
## eng ##
ifeq ($(TARGET_BUILD_VARIANT),eng)
tags_to_install := debug eng
ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))),)
ifneq ($(filter ro.setupwizard.mode=ENABLED, $(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))),)
# Don't require the setup wizard on eng builds
ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \
ADDITIONAL_SYSTEM_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
$(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))) \
ro.setupwizard.mode=OPTIONAL
endif
ifndef is_sdk_build
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract
ADDITIONAL_SYSTEM_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract
endif
endif
@ -349,14 +436,14 @@ endif
# TODO: this should be eng I think. Since the sdk is built from the eng
# variant.
tags_to_install := debug eng
ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence=true
ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin=yes
else # !sdk
endif
BUILD_WITHOUT_PV := true
ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
ADDITIONAL_SYSTEM_PROPERTIES += net.bt.name=Android
# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
@ -390,8 +477,8 @@ endif
# Strip and readonly a few more variables so they won't be modified.
$(readonly-final-product-vars)
ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES))
.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES))
.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES
ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES))
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES

View file

@ -23,65 +23,9 @@ ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
property_overrides_split_enabled := true
endif
# -----------------------------------------------------------------
# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/build.prop if
# property_overrides_split_enabled is true. Otherwise it will be installed in
# /system/build.prop
ifdef BOARD_VNDK_VERSION
ifeq ($(BOARD_VNDK_VERSION),current)
FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
else
FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
endif
ifdef BOARD_VNDK_RUNTIME_DISABLE
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
endif
else
FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
endif
FINAL_VENDOR_DEFAULT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
# Add cpu properties for bionic and ART.
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
ifdef TARGET_2ND_ARCH
FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
endif
endif
# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
# mode (via libminui).
ifdef TARGET_RECOVERY_DEFAULT_ROTATION
FINAL_VENDOR_DEFAULT_PROPERTIES += \
ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
endif
ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
FINAL_VENDOR_DEFAULT_PROPERTIES += \
ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
endif
ifdef TARGET_RECOVERY_PIXEL_FORMAT
FINAL_VENDOR_DEFAULT_PROPERTIES += \
ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
endif
FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
BUILDINFO_SH := build/make/tools/buildinfo.sh
BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
POST_PROCESS_PROPS :=$= build/make/tools/post_process_props.py
POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX)
# Generates a set of sysprops common to all partitions to a file.
# $(1): Partition name
@ -123,7 +67,14 @@ FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_DEFAULT_PROPERTIES),=)
FINAL_BUILD_PROPERTIES := \
$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
$(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))
# For non-Treble devices, consider vendor properties as system properties
ifndef property_overrides_split_enabled
FINAL_BUILD_PROPERTIES += \
$(call collapse-pairs, $(ADDITIONAL_VENDOR_PROPERTIES))
endif
FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_BUILD_PROPERTIES),=)
@ -237,10 +188,6 @@ $(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTE
$(hide) rm -f $@ && touch $@
$(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
ifndef property_overrides_split_enabled
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
endif
ifneq ($(PRODUCT_OEM_PROPERTIES),)
$(hide) echo "#" >> $@; \
echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
@ -298,7 +245,7 @@ endif
$(if $(FINAL_BUILD_PROPERTIES), \
$(hide) echo >> $@; \
echo "#" >> $@; \
echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
echo "# ADDITIONAL_SYSTEM_PROPERTIES" >> $@; \
echo "#" >> $@; )
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
@ -323,52 +270,27 @@ else
vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)
endif
android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
vendor_prop_files += $(android_info_prop)
ifdef property_overrides_split_enabled
FINAL_VENDOR_BUILD_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
$(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES) $(ADDITIONAL_VENDOR_PROPERTIES))
FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
endif # property_overrides_split_enabled
$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) $(vendor_prop_files)
$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(vendor_prop_files)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@ && touch $@
ifdef property_overrides_split_enabled
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
endif
ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
$(hide) echo ro.boot.dynamic_partitions=true >> $@
endif
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
$(hide) echo ro.boot.dynamic_partitions_retrofit=true >> $@
endif
$(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
$(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
$(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
$(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
$(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
$(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
$(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
$(hide) echo ro.hwui.use_vulkan="$(TARGET_USES_VULKAN)">>$@
ifdef TARGET_SCREEN_DENSITY
$(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@
endif
ifeq ($(AB_OTA_UPDATER),true)
$(hide) echo ro.build.ab_update=true >> $@
endif
$(hide) $(call generate-common-build-props,vendor,$@)
$(hide) echo "#" >> $@; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
$(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
$(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
ifdef property_overrides_split_enabled
$(hide) $(foreach file,$(vendor_prop_files), \
if [ -f "$(file)" ]; then \
@ -437,7 +359,7 @@ odm_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/odm.prop)
endif
FINAL_ODM_BUILD_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
$(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES) $(ADDITIONAL_ODM_PROPERTIES))
FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_ODM_BUILD_PROPERTIES),=)
@ -445,9 +367,6 @@ $(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS)
@echo Target odm buildinfo: $@
@mkdir -p $(dir $@)
$(hide) rm -f $@ && touch $@
$(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
$(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
$(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
$(hide) $(call generate-common-build-props,odm,$@)
$(hide) $(foreach file,$(odm_prop_files), \
if [ -f "$(file)" ]; then \

View file

@ -24,3 +24,16 @@ python_binary_host {
},
},
}
python_binary_host {
name: "post_process_props",
srcs: ["post_process_props.py"],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
},
},
}

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2009 The Android Open Source Project
#
@ -24,121 +24,114 @@ import sys
# so we decrease the value by 1 here.
PROP_VALUE_MAX = 91
# Put the modifications that you need to make into the /system/build.prop into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_build_prop(prop):
pass
# Put the modifications that you need to make into /vendor/default.prop and
# /odm/default.prop into this function. The prop object has get(name) and
# put(name,value) methods.
def mangle_default_prop_override(prop):
pass
# Put the modifications that you need to make into the /system/etc/prop.default into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_default_prop(prop):
# Put the modifications that you need to make into the */build.prop into this
# function.
def mangle_build_prop(prop_list):
# If ro.debuggable is 1, then enable adb on USB by default
# (this is for userdebug builds)
if prop.get("ro.debuggable") == "1":
val = prop.get("persist.sys.usb.config")
if prop_list.get("ro.debuggable") == "1":
val = prop_list.get("persist.sys.usb.config")
if "adb" not in val:
if val == "":
val = "adb"
else:
val = val + ",adb"
prop.put("persist.sys.usb.config", val)
prop_list.put("persist.sys.usb.config", val)
# UsbDeviceManager expects a value here. If it doesn't get it, it will
# default to "adb". That might not the right policy there, but it's better
# to be explicit.
if not prop.get("persist.sys.usb.config"):
prop.put("persist.sys.usb.config", "none");
if not prop_list.get("persist.sys.usb.config"):
prop_list.put("persist.sys.usb.config", "none");
def validate(prop):
def validate(prop_list):
"""Validate the properties.
Returns:
True if nothing is wrong.
"""
check_pass = True
buildprops = prop.to_dict()
for key, value in buildprops.iteritems():
# Check build properties' length.
if len(value) > PROP_VALUE_MAX and not key.startswith("ro."):
for p in prop_list.get_all():
if len(p.value) > PROP_VALUE_MAX and not p.name.startswith("ro."):
check_pass = False
sys.stderr.write("error: %s cannot exceed %d bytes: " %
(key, PROP_VALUE_MAX))
sys.stderr.write("%s (%d)\n" % (value, len(value)))
(p.name, PROP_VALUE_MAX))
sys.stderr.write("%s (%d)\n" % (p.value, len(p.value)))
return check_pass
class PropFile:
class Prop:
def __init__(self, lines):
self.lines = [s.strip() for s in lines]
def __init__(self, name, value, comment=None):
self.name = name.strip()
self.value = value.strip()
self.comment = comment
def to_dict(self):
props = {}
for line in self.lines:
if not line or line.startswith("#"):
continue
if "=" in line:
key, value = line.split("=", 1)
props[key] = value
return props
@staticmethod
def from_line(line):
line = line.rstrip('\n')
if line.startswith("#"):
return Prop("", "", line)
elif "=" in line:
name, value = line.split("=", 1)
return Prop(name, value)
else:
# don't fail on invalid line
# TODO(jiyong) make this a hard error
return Prop("", "", line)
def is_comment(self):
return self.comment != None
def __str__(self):
if self.is_comment():
return self.comment
else:
return self.name + "=" + self.value
class PropList:
def __init__(self, filename):
with open(filename) as f:
self.props = [Prop.from_line(l)
for l in f.readlines() if l.strip() != ""]
def get_all(self):
return [p for p in self.props if not p.is_comment()]
def get(self, name):
key = name + "="
for line in self.lines:
if line.startswith(key):
return line[len(key):]
return ""
return next((p.value for p in self.props if p.name == name), "")
def put(self, name, value):
key = name + "="
for i in range(0,len(self.lines)):
if self.lines[i].startswith(key):
self.lines[i] = key + value
return
self.lines.append(key + value)
index = next((i for i,p in enumerate(self.props) if p.name == name), -1)
if index == -1:
self.props.append(Prop(name, value))
else:
self.props[index].value = value
def delete(self, name):
key = name + "="
self.lines = [ line for line in self.lines if not line.startswith(key) ]
self.props = [p for p in self.props if p.name != name]
def write(self, f):
f.write("\n".join(self.lines))
f.write("\n")
def write(self, filename):
with open(filename, 'w+') as f:
for p in self.props:
f.write(str(p) + "\n")
def main(argv):
filename = argv[1]
f = open(filename)
lines = f.readlines()
f.close()
properties = PropFile(lines)
if filename.endswith("/build.prop"):
mangle_build_prop(properties)
elif (filename.endswith("/vendor/default.prop") or
filename.endswith("/odm/default.prop")):
mangle_default_prop_override(properties)
elif (filename.endswith("/default.prop") or # legacy
filename.endswith("/prop.default")):
mangle_default_prop(properties)
else:
if not filename.endswith("/build.prop"):
sys.stderr.write("bad command line: " + str(argv) + "\n")
sys.exit(1)
if not validate(properties):
props = PropList(filename)
mangle_build_prop(props)
if not validate(props):
sys.exit(1)
# Drop any blacklisted keys
for key in argv[2:]:
properties.delete(key)
props.delete(key)
f = open(filename, 'w+')
properties.write(f)
f.close()
props.write(filename)
if __name__ == "__main__":
main(sys.argv)