Merge "Introduce build variable `OVERRIDE_TARGET_FLATTEN_APEX`." am: 81681abfef
am: 0a24633ef5
Change-Id: Id67efdb4a883e38caf90cf34c0fb8f91fba19aca
diff --git a/core/board_config.mk b/core/board_config.mk
index 4f73547..3127c19 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -584,8 +584,16 @@
# APEXes are by default flattened, i.e. non-updatable.
# It can be unflattened (and updatable) by inheriting from
# updatable_apex.mk
-ifeq (,$(TARGET_FLATTEN_APEX))
-TARGET_FLATTEN_APEX := true
+#
+# APEX flattening can also be forcibly enabled (resp. disabled) by
+# setting OVERRIDE_TARGET_FLATTEN_APEX to true (resp. false), e.g. by
+# setting the OVERRIDE_TARGET_FLATTEN_APEX environment variable.
+ifdef OVERRIDE_TARGET_FLATTEN_APEX
+ TARGET_FLATTEN_APEX := $(OVERRIDE_TARGET_FLATTEN_APEX)
+else
+ ifeq (,$(TARGET_FLATTEN_APEX))
+ TARGET_FLATTEN_APEX := true
+ endif
endif
ifeq (,$(TARGET_BUILD_APPS))
diff --git a/target/product/updatable_apex.mk b/target/product/updatable_apex.mk
index a9f4baf..bdaf545 100644
--- a/target/product/updatable_apex.mk
+++ b/target/product/updatable_apex.mk
@@ -16,5 +16,7 @@
# Inherit this when the target needs to support updating APEXes
-PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true
-TARGET_FLATTEN_APEX := false
+ifneq ($(OVERRIDE_TARGET_FLATTEN_APEX),true)
+ PRODUCT_PROPERTY_OVERRIDES := ro.apex.updatable=true
+ TARGET_FLATTEN_APEX := false
+endif