Split PRODUCT_USE_LOGICAL_PARTITIONS into sub-flags.

Split the flag into PRODUCT_USE_DYNAMIC_PARTITION_SIZE
and PRODUCT_BUILD_SUPER_PARTITION. More sub-flags can be
added with the same way.

Also change some checks with USE_LOGICAL_PARTITIONS with
the appropriate sub-flags.

This allows easier device bring-up to fulfill the requirements
separately.

This also enables dynamic partition size without logical patition.
Originally, to enable BOARD_*_PARTITION_RESERVED_SIZE must also
enable PRODUCT_USE_LOGICAL_PARTITIONS. The patch fix the rule to
let dynamic partition size is able to be used independently.

Fixes: 111966003

Test: make superimage with PRODUCT_USE_LOGICAL_PARTITIONS
Change-Id: I45b29c87bf94356d8416bbd58a14c8982039c222
diff --git a/core/config.mk b/core/config.mk
index 0a23ef9..b4ddf4b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -925,13 +925,21 @@
 endif
 .KATI_READONLY := PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
 
-ifndef USE_LOGICAL_PARTITIONS
-  USE_LOGICAL_PARTITIONS := $(PRODUCT_USE_LOGICAL_PARTITIONS)
-endif
-.KATI_READONLY := USE_LOGICAL_PARTITIONS
-
 ifeq ($(USE_LOGICAL_PARTITIONS),true)
+    requirements := \
+        PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
+        PRODUCT_BUILD_SUPER_PARTITION \
+        PRODUCT_USE_FASTBOOTD \
+
+    $(foreach req,$(requirements),$(if $(filter false,$($(req))),\
+        $(error USE_LOGICAL_PARTITIONS requires $(req) to be true)))
+
+    requirements :=
+
   BOARD_KERNEL_CMDLINE += androidboot.logical_partitions=1
+endif
+
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true)
 
 ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),)
 ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),)
@@ -961,6 +969,9 @@
 endif
 endif
 
+endif # PRODUCT_USE_DYNAMIC_PARTITION_SIZE
+
+ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true)
 ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
 # BOARD_SUPER_PARTITION_PARTITION_LIST: a list of the following tokens
 valid_super_partition_list := system vendor product product_services
@@ -971,8 +982,7 @@
 endif
 valid_super_partition_list :=
 endif # BOARD_SUPER_PARTITION_PARTITION_LIST
-
-endif # USE_LOGICAL_PARTITIONS
+endif # PRODUCT_BUILD_SUPER_PARTITION
 
 # ###############################################################
 # Set up final options.