Enforce the consistency between AB_OTA_UPDATER and AB_OTA_PARTITIONS.

They are designed to be used as a pair -- we should create separate
flags when there's a need.

Fixes: 130433003
Test: TreeHugger
Test: Define only one of them. `m dist` fails.
Change-Id: Ied57bd67fbed59b160c407dbb4c0d624581c58f7
diff --git a/core/Makefile b/core/Makefile
index 951761c..bcd889d 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4032,6 +4032,18 @@
     $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
     $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
   endif
+
+  # Not checking in board_config.mk, since AB_OTA_PARTITIONS may be updated in Android.mk (e.g. to
+  # additionally include radio or bootloader partitions).
+  ifeq ($(AB_OTA_PARTITIONS),)
+    $(error AB_OTA_PARTITIONS must be defined when using AB_OTA_UPDATER)
+  endif
+endif
+
+ifneq ($(AB_OTA_PARTITIONS),)
+  ifneq ($(AB_OTA_UPDATER),true)
+    $(error AB_OTA_UPDATER must be true when defining AB_OTA_PARTITIONS)
+  endif
 endif
 
 # Run fs_config while creating the target files package