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

Commit dd3af422 authored by Jiyong Park's avatar Jiyong Park Committed by Gerrit Code Review
Browse files

Merge changes from topic "sysprop"

* changes:
  Handle the case when non-optional props have the same value
  BUILD_BROKEN_DUP_SYSPROP as escape hatch for the new sysprop restriction
  pm.dexopt.* props in runtime_libart.mk becomes optional
  Some properties are set as optional
  ro.zygote in base_system.mk is optional
  Don't inherit tablet-dalvik-heap for GSI and emulator
  Support optional prop assignments
parents 3a3d501e 24d9cad5
Loading
Loading
Loading
Loading
+87 −0
Original line number Diff line number Diff line
# Build System Changes for Android.mk Writers

## Changes in system properties settings

### Product variables

System properties for each of the partition is supposed to be set via following
product config variables.

For system partititon,

* `PRODUCT_SYSTEM_PROPERITES`
* `PRODUCT_SYSTEM_DEFAULT_PROPERTIES` is highly discouraged. Will be deprecated.

For vendor partition,

* `PRODUCT_VENDOR_PROPERTIES`
* `PRODUCT_PROPERTY_OVERRIDES` is highly discouraged. Will be deprecated.
* `PRODUCT_DEFAULT_PROPERTY_OVERRIDES` is also discouraged. Will be deprecated.

For odm partition,

* `PRODUCT_ODM_PROPERTIES`

For system_ext partition,

* `PRODUCT_SYSTEM_EXT_PROPERTIES`

For product partition,

* `PRODUCT_PRODUCT_PROPERTIES`

### Duplication is not allowed within a partition

For each partition, having multiple sysprop assignments for the same name is
prohibited. For example, the following will now trigger an error:

`PRODUCT_VENDOR_PROPERTIES += foo=true foo=false`

Having duplication across partitions are still allowed. So, the following is
not an error:

`PRODUCT_VENDOR_PROPERTIES += foo=true`
`PRODUCT_SYSTEM_PROPERTIES += foo=false`

In that case, the final value is determined at runtime. The precedence is

* product
* odm
* vendor
* system_ext
* system

So, `foo` becomes `true` because vendor has higher priority than system.

To temporarily turn the build-time restriction off, use

`BUILD_BROKEN_DUP_SYSPROP := true`

### Optional assignments

System properties can now be set as optional using the new syntax:

`name ?= value`

Then the system property named `name` gets the value `value` only when there
is no other non-optional assignments having the same name. For example, the
following is allowed and `foo` gets `true`

`PRODUCT_VENDOR_PROPERTIES += foo=true foo?=false`

Note that the order between the optional and the non-optional assignments
doesn't matter. The following gives the same result as above.

`PRODUCT_VENDOR_PROPERTIES += foo?=false foo=true`

Optional assignments can be duplicated and in that case their order matters.
Specifically, the last one eclipses others.

`PRODUCT_VENDOR_PROPERTIES += foo?=apple foo?=banana foo?=mango`

With above, `foo` becomes `mango` since its the last one.

Note that this behavior is different from the previous behavior of preferring
the first one. To go back to the original behavior for compatability reason,
use:

`BUILD_BROKEN_DUP_SYSPROP := true`

## ELF prebuilts in PRODUCT_COPY_FILES

ELF prebuilts in PRODUCT_COPY_FILES that are installed into these paths are an
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ _build_broken_var_list := \
  BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
  BUILD_BROKEN_USES_NETWORK \
  BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
  BUILD_BROKEN_DUP_SYSPROP \

_build_broken_var_list += \
  $(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
+16 −4
Original line number Diff line number Diff line
@@ -71,10 +71,22 @@ endef
define build-properties
ALL_DEFAULT_INSTALLED_MODULES += $(2)

# TODO(b/117892318): eliminate the call to uniq-pairs-by-first-component when
# it is guaranteed that there is no dup.
$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
$(eval # Eliminate spaces around the ?= and = separators.)
$(foreach name,$(strip $(4)),\
    $(eval _resolved_$(name) := $$(call collapse-pairs, $$(call uniq-pairs-by-first-component,$$($(name)),=)))\
    $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
    $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
)

$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
$(eval # Optional assignments are all converted to normal assignments and)
$(eval # when their duplicates the first one wins)
$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
    $(foreach name,$(strip $(4)),\
        $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
        $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
    )\
    $(eval _option := --allow-dup)\
)

$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3)
@@ -99,7 +111,7 @@ $(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3
	        echo "$$(line)" >> $$@;\
	    )\
	)
	$(hide) $(POST_PROCESS_PROPS) $$@ $(5)
	$(hide) $(POST_PROCESS_PROPS) $$(_option) $$@ $(5)
	$(hide) echo "# end of file" >> $$@
endef

+0 −4
Original line number Diff line number Diff line
@@ -26,7 +26,3 @@ endif

PRODUCT_COPY_FILES += \
    $(LOCAL_KERNEL):kernel

# Adjust the Dalvik heap to be appropriate for a tablet.
$(call inherit-product-if-exists, frameworks/base/build/tablet-dalvik-heap.mk)
$(call inherit-product-if-exists, frameworks/native/build/tablet-dalvik-heap.mk)
+0 −4
Original line number Diff line number Diff line
@@ -18,7 +18,3 @@ PRODUCT_COPY_FILES += \
    device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4:kernel-5.4 \
    device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-gz:kernel-5.4-gz \
    device/google/cuttlefish_kernel/5.4-arm64/kernel-5.4-lz4:kernel-5.4-lz4

# Adjust the Dalvik heap to be appropriate for a tablet.
$(call inherit-product-if-exists, frameworks/base/build/tablet-dalvik-heap.mk)
$(call inherit-product-if-exists, frameworks/native/build/tablet-dalvik-heap.mk)
Loading