Merge changes from topics "remove_bootimage_sysprops", "sysprop" am: 6dd5383c37
am: 04799633dd
Change-Id: Iddb4cfd419dc0f68e15cb62f2545d8bc178b42ca
This commit is contained in:
commit
c96b261f59
4 changed files with 235 additions and 223 deletions
185
core/main.mk
185
core/main.mk
|
@ -113,44 +113,38 @@ SKIP_BOOT_JARS_CHECK := true
|
||||||
endif
|
endif
|
||||||
endif
|
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
|
||||||
# Validate ADDITIONAL_DEFAULT_PROPERTIES.
|
# system like Android.mk or <product>.mk files.
|
||||||
ifneq ($(ADDITIONAL_DEFAULT_PROPERTIES),)
|
_additional_prop_var_names := \
|
||||||
$(error ADDITIONAL_DEFAULT_PROPERTIES is deprecated)
|
ADDITIONAL_SYSTEM_PROPERTIES \
|
||||||
endif
|
ADDITIONAL_VENDOR_PROPERTIES \
|
||||||
|
ADDITIONAL_ODM_PROPERTIES \
|
||||||
|
ADDITIONAL_PRODUCT_PROPERTIES
|
||||||
|
|
||||||
#
|
$(foreach name, $(_additional_prop_var_names),\
|
||||||
# -----------------------------------------------------------------
|
$(if $($(name)),\
|
||||||
# Validate ADDITIONAL_BUILD_PROPERTIES.
|
$(error $(name) must not set before here. $($(name)))\
|
||||||
ifneq ($(ADDITIONAL_BUILD_PROPERTIES),)
|
,)\
|
||||||
$(error ADDITIONAL_BUILD_PROPERTIES must not be set before here: $(ADDITIONAL_BUILD_PROPERTIES))
|
$(eval $(name) :=)\
|
||||||
endif
|
)
|
||||||
|
_additional_prop_var_names :=
|
||||||
|
|
||||||
ADDITIONAL_BUILD_PROPERTIES :=
|
$(KATI_obsolete_var ADDITIONAL_BUILD_PROPERTIES, Please use ADDITIONAL_SYSTEM_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 :=
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Add the product-defined properties to the build properties.
|
# Add the product-defined properties to the build properties.
|
||||||
ifdef PRODUCT_SHIPPING_API_LEVEL
|
ifdef PRODUCT_SHIPPING_API_LEVEL
|
||||||
ADDITIONAL_BUILD_PROPERTIES += \
|
ADDITIONAL_SYSTEM_PROPERTIES += \
|
||||||
ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
|
ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
|
ifneq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
|
||||||
ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
|
ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
|
||||||
else
|
else
|
||||||
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
|
ifndef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
|
||||||
ADDITIONAL_BUILD_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
|
ADDITIONAL_SYSTEM_PROPERTIES += $(PRODUCT_PROPERTY_OVERRIDES)
|
||||||
endif
|
endif
|
||||||
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,\
|
$(KATI_obsolete_var PRODUCT_FULL_TREBLE,\
|
||||||
Code should be written to work regardless of a device being Treble or \
|
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
|
# Sets ro.actionable_compatible_property.enabled to know on runtime whether the whitelist
|
||||||
# of actionable compatible properties is enabled or not.
|
# of actionable compatible properties is enabled or not.
|
||||||
ifeq ($(PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE),true)
|
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
|
else
|
||||||
ADDITIONAL_BUILD_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
|
ADDITIONAL_SYSTEM_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Add the system server compiler filter if they are specified for the product.
|
# 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.
|
# Enable core platform API violation warnings on userdebug and eng builds.
|
||||||
ifneq ($(TARGET_BUILD_VARIANT),user)
|
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
|
endif
|
||||||
|
|
||||||
# Sets the default value of ro.postinstall.fstab.prefix to /system.
|
# 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
|
# It then uses ${ro.postinstall.fstab.prefix}/etc/fstab.postinstall to
|
||||||
# mount system_other partition.
|
# 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
|
# 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
|
# modules. It uses the version in PRODUCT_PRODUCT_VNDK_VERSION. If the value
|
||||||
|
@ -263,11 +350,11 @@ enable_target_debugging := true
|
||||||
tags_to_install :=
|
tags_to_install :=
|
||||||
ifneq (,$(user_variant))
|
ifneq (,$(user_variant))
|
||||||
# Target is secure in user builds.
|
# Target is secure in user builds.
|
||||||
ADDITIONAL_BUILD_PROPERTIES += ro.secure=1
|
ADDITIONAL_SYSTEM_PROPERTIES += ro.secure=1
|
||||||
ADDITIONAL_BUILD_PROPERTIES += security.perf_harden=1
|
ADDITIONAL_SYSTEM_PROPERTIES += security.perf_harden=1
|
||||||
|
|
||||||
ifeq ($(user_variant),user)
|
ifeq ($(user_variant),user)
|
||||||
ADDITIONAL_BUILD_PROPERTIES += ro.adb.secure=1
|
ADDITIONAL_SYSTEM_PROPERTIES += ro.adb.secure=1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(user_variant),userdebug)
|
ifeq ($(user_variant),userdebug)
|
||||||
|
@ -279,40 +366,40 @@ ifneq (,$(user_variant))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Disallow mock locations by default for user builds
|
# 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
|
else # !user_variant
|
||||||
# Turn on checkjni for non-user builds.
|
# 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.
|
# 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
|
# 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
|
endif # !user_variant
|
||||||
|
|
||||||
ifeq (true,$(strip $(enable_target_debugging)))
|
ifeq (true,$(strip $(enable_target_debugging)))
|
||||||
# Target is more debuggable and adbd is on by default
|
# 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.
|
# 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
|
else # !enable_target_debugging
|
||||||
# Target is less debuggable and adbd is off by default
|
# 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
|
endif # !enable_target_debugging
|
||||||
|
|
||||||
## eng ##
|
## eng ##
|
||||||
|
|
||||||
ifeq ($(TARGET_BUILD_VARIANT),eng)
|
ifeq ($(TARGET_BUILD_VARIANT),eng)
|
||||||
tags_to_install := debug 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
|
# Don't require the setup wizard on eng builds
|
||||||
ADDITIONAL_BUILD_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
|
ADDITIONAL_SYSTEM_PROPERTIES := $(filter-out ro.setupwizard.mode=%,\
|
||||||
$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))) \
|
$(call collapse-pairs, $(ADDITIONAL_SYSTEM_PROPERTIES))) \
|
||||||
ro.setupwizard.mode=OPTIONAL
|
ro.setupwizard.mode=OPTIONAL
|
||||||
endif
|
endif
|
||||||
ifndef is_sdk_build
|
ifndef is_sdk_build
|
||||||
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
|
# 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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -349,14 +436,14 @@ endif
|
||||||
# TODO: this should be eng I think. Since the sdk is built from the eng
|
# TODO: this should be eng I think. Since the sdk is built from the eng
|
||||||
# variant.
|
# variant.
|
||||||
tags_to_install := debug eng
|
tags_to_install := debug eng
|
||||||
ADDITIONAL_BUILD_PROPERTIES += xmpp.auto-presence=true
|
ADDITIONAL_SYSTEM_PROPERTIES += xmpp.auto-presence=true
|
||||||
ADDITIONAL_BUILD_PROPERTIES += ro.config.nocheckin=yes
|
ADDITIONAL_SYSTEM_PROPERTIES += ro.config.nocheckin=yes
|
||||||
else # !sdk
|
else # !sdk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_WITHOUT_PV := true
|
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
|
# 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.
|
# Strip and readonly a few more variables so they won't be modified.
|
||||||
$(readonly-final-product-vars)
|
$(readonly-final-product-vars)
|
||||||
ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES))
|
ADDITIONAL_SYSTEM_PROPERTIES := $(strip $(ADDITIONAL_SYSTEM_PROPERTIES))
|
||||||
.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
|
.KATI_READONLY := ADDITIONAL_SYSTEM_PROPERTIES
|
||||||
ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES))
|
ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES))
|
||||||
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
|
.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
|
||||||
|
|
||||||
|
|
119
core/sysprop.mk
119
core/sysprop.mk
|
@ -23,65 +23,9 @@ ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
|
||||||
property_overrides_split_enabled := true
|
property_overrides_split_enabled := true
|
||||||
endif
|
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_SH := build/make/tools/buildinfo.sh
|
||||||
BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.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.
|
# Generates a set of sysprops common to all partitions to a file.
|
||||||
# $(1): Partition name
|
# $(1): Partition name
|
||||||
|
@ -123,7 +67,14 @@ FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
|
||||||
$(FINAL_DEFAULT_PROPERTIES),=)
|
$(FINAL_DEFAULT_PROPERTIES),=)
|
||||||
|
|
||||||
FINAL_BUILD_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 := $(call uniq-pairs-by-first-component, \
|
||||||
$(FINAL_BUILD_PROPERTIES),=)
|
$(FINAL_BUILD_PROPERTIES),=)
|
||||||
|
|
||||||
|
@ -237,10 +188,6 @@ $(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTE
|
||||||
$(hide) rm -f $@ && touch $@
|
$(hide) rm -f $@ && touch $@
|
||||||
$(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
|
$(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
|
||||||
echo "$(line)" >> $@;)
|
echo "$(line)" >> $@;)
|
||||||
ifndef property_overrides_split_enabled
|
|
||||||
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
|
|
||||||
echo "$(line)" >> $@;)
|
|
||||||
endif
|
|
||||||
ifneq ($(PRODUCT_OEM_PROPERTIES),)
|
ifneq ($(PRODUCT_OEM_PROPERTIES),)
|
||||||
$(hide) echo "#" >> $@; \
|
$(hide) echo "#" >> $@; \
|
||||||
echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
|
echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
|
||||||
|
@ -298,7 +245,7 @@ endif
|
||||||
$(if $(FINAL_BUILD_PROPERTIES), \
|
$(if $(FINAL_BUILD_PROPERTIES), \
|
||||||
$(hide) echo >> $@; \
|
$(hide) echo >> $@; \
|
||||||
echo "#" >> $@; \
|
echo "#" >> $@; \
|
||||||
echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
|
echo "# ADDITIONAL_SYSTEM_PROPERTIES" >> $@; \
|
||||||
echo "#" >> $@; )
|
echo "#" >> $@; )
|
||||||
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
|
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
|
||||||
echo "$(line)" >> $@;)
|
echo "$(line)" >> $@;)
|
||||||
|
@ -323,52 +270,27 @@ else
|
||||||
vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)
|
vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop)
|
||||||
endif
|
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
|
ifdef property_overrides_split_enabled
|
||||||
FINAL_VENDOR_BUILD_PROPERTIES += \
|
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 := $(call uniq-pairs-by-first-component, \
|
||||||
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
|
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
|
||||||
endif # property_overrides_split_enabled
|
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: $@
|
@echo Target vendor buildinfo: $@
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(hide) rm -f $@ && touch $@
|
$(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) $(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 "#" >> $@; \
|
$(hide) echo "#" >> $@; \
|
||||||
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
|
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
|
||||||
echo "#" >> $@;
|
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
|
ifdef property_overrides_split_enabled
|
||||||
$(hide) $(foreach file,$(vendor_prop_files), \
|
$(hide) $(foreach file,$(vendor_prop_files), \
|
||||||
if [ -f "$(file)" ]; then \
|
if [ -f "$(file)" ]; then \
|
||||||
|
@ -437,7 +359,7 @@ odm_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/odm.prop)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
FINAL_ODM_BUILD_PROPERTIES += \
|
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 := $(call uniq-pairs-by-first-component, \
|
||||||
$(FINAL_ODM_BUILD_PROPERTIES),=)
|
$(FINAL_ODM_BUILD_PROPERTIES),=)
|
||||||
|
|
||||||
|
@ -445,9 +367,6 @@ $(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS)
|
||||||
@echo Target odm buildinfo: $@
|
@echo Target odm buildinfo: $@
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(hide) rm -f $@ && touch $@
|
$(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) $(call generate-common-build-props,odm,$@)
|
||||||
$(hide) $(foreach file,$(odm_prop_files), \
|
$(hide) $(foreach file,$(odm_prop_files), \
|
||||||
if [ -f "$(file)" ]; then \
|
if [ -f "$(file)" ]; then \
|
||||||
|
|
|
@ -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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
#
|
#
|
||||||
# Copyright (C) 2009 The Android Open Source Project
|
# Copyright (C) 2009 The Android Open Source Project
|
||||||
#
|
#
|
||||||
|
@ -24,121 +24,114 @@ import sys
|
||||||
# so we decrease the value by 1 here.
|
# so we decrease the value by 1 here.
|
||||||
PROP_VALUE_MAX = 91
|
PROP_VALUE_MAX = 91
|
||||||
|
|
||||||
# Put the modifications that you need to make into the /system/build.prop into this
|
# Put the modifications that you need to make into the */build.prop into this
|
||||||
# function. The prop object has get(name) and put(name,value) methods.
|
# function.
|
||||||
def mangle_build_prop(prop):
|
def mangle_build_prop(prop_list):
|
||||||
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):
|
|
||||||
# If ro.debuggable is 1, then enable adb on USB by default
|
# If ro.debuggable is 1, then enable adb on USB by default
|
||||||
# (this is for userdebug builds)
|
# (this is for userdebug builds)
|
||||||
if prop.get("ro.debuggable") == "1":
|
if prop_list.get("ro.debuggable") == "1":
|
||||||
val = prop.get("persist.sys.usb.config")
|
val = prop_list.get("persist.sys.usb.config")
|
||||||
if "adb" not in val:
|
if "adb" not in val:
|
||||||
if val == "":
|
if val == "":
|
||||||
val = "adb"
|
val = "adb"
|
||||||
else:
|
else:
|
||||||
val = val + ",adb"
|
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
|
# 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
|
# default to "adb". That might not the right policy there, but it's better
|
||||||
# to be explicit.
|
# to be explicit.
|
||||||
if not prop.get("persist.sys.usb.config"):
|
if not prop_list.get("persist.sys.usb.config"):
|
||||||
prop.put("persist.sys.usb.config", "none");
|
prop_list.put("persist.sys.usb.config", "none");
|
||||||
|
|
||||||
def validate(prop):
|
def validate(prop_list):
|
||||||
"""Validate the properties.
|
"""Validate the properties.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True if nothing is wrong.
|
True if nothing is wrong.
|
||||||
"""
|
"""
|
||||||
check_pass = True
|
check_pass = True
|
||||||
buildprops = prop.to_dict()
|
for p in prop_list.get_all():
|
||||||
for key, value in buildprops.iteritems():
|
if len(p.value) > PROP_VALUE_MAX and not p.name.startswith("ro."):
|
||||||
# Check build properties' length.
|
|
||||||
if len(value) > PROP_VALUE_MAX and not key.startswith("ro."):
|
|
||||||
check_pass = False
|
check_pass = False
|
||||||
sys.stderr.write("error: %s cannot exceed %d bytes: " %
|
sys.stderr.write("error: %s cannot exceed %d bytes: " %
|
||||||
(key, PROP_VALUE_MAX))
|
(p.name, PROP_VALUE_MAX))
|
||||||
sys.stderr.write("%s (%d)\n" % (value, len(value)))
|
sys.stderr.write("%s (%d)\n" % (p.value, len(p.value)))
|
||||||
return check_pass
|
return check_pass
|
||||||
|
|
||||||
class PropFile:
|
class Prop:
|
||||||
|
|
||||||
def __init__(self, lines):
|
def __init__(self, name, value, comment=None):
|
||||||
self.lines = [s.strip() for s in lines]
|
self.name = name.strip()
|
||||||
|
self.value = value.strip()
|
||||||
|
self.comment = comment
|
||||||
|
|
||||||
def to_dict(self):
|
@staticmethod
|
||||||
props = {}
|
def from_line(line):
|
||||||
for line in self.lines:
|
line = line.rstrip('\n')
|
||||||
if not line or line.startswith("#"):
|
if line.startswith("#"):
|
||||||
continue
|
return Prop("", "", line)
|
||||||
if "=" in line:
|
elif "=" in line:
|
||||||
key, value = line.split("=", 1)
|
name, value = line.split("=", 1)
|
||||||
props[key] = value
|
return Prop(name, value)
|
||||||
return props
|
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):
|
def get(self, name):
|
||||||
key = name + "="
|
return next((p.value for p in self.props if p.name == name), "")
|
||||||
for line in self.lines:
|
|
||||||
if line.startswith(key):
|
|
||||||
return line[len(key):]
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def put(self, name, value):
|
def put(self, name, value):
|
||||||
key = name + "="
|
index = next((i for i,p in enumerate(self.props) if p.name == name), -1)
|
||||||
for i in range(0,len(self.lines)):
|
if index == -1:
|
||||||
if self.lines[i].startswith(key):
|
self.props.append(Prop(name, value))
|
||||||
self.lines[i] = key + value
|
else:
|
||||||
return
|
self.props[index].value = value
|
||||||
self.lines.append(key + value)
|
|
||||||
|
|
||||||
def delete(self, name):
|
def delete(self, name):
|
||||||
key = name + "="
|
self.props = [p for p in self.props if p.name != name]
|
||||||
self.lines = [ line for line in self.lines if not line.startswith(key) ]
|
|
||||||
|
|
||||||
def write(self, f):
|
def write(self, filename):
|
||||||
f.write("\n".join(self.lines))
|
with open(filename, 'w+') as f:
|
||||||
f.write("\n")
|
for p in self.props:
|
||||||
|
f.write(str(p) + "\n")
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
filename = argv[1]
|
filename = argv[1]
|
||||||
f = open(filename)
|
|
||||||
lines = f.readlines()
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
properties = PropFile(lines)
|
if not filename.endswith("/build.prop"):
|
||||||
|
|
||||||
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:
|
|
||||||
sys.stderr.write("bad command line: " + str(argv) + "\n")
|
sys.stderr.write("bad command line: " + str(argv) + "\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not validate(properties):
|
props = PropList(filename)
|
||||||
|
mangle_build_prop(props)
|
||||||
|
if not validate(props):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Drop any blacklisted keys
|
# Drop any blacklisted keys
|
||||||
for key in argv[2:]:
|
for key in argv[2:]:
|
||||||
properties.delete(key)
|
props.delete(key)
|
||||||
|
|
||||||
f = open(filename, 'w+')
|
props.write(filename)
|
||||||
properties.write(f)
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
|
Loading…
Reference in a new issue