From 00cf76767f92bab7a269c67a0cb7090e961fc51c Mon Sep 17 00:00:00 2001
From: Dan Willemsen <dwillemsen@google.com>
Date: Wed, 4 Jan 2017 17:16:09 -0800
Subject: [PATCH] TARGET_RECOVERY_UPDATER_LIBS should not be used with AB
 updates

Also mark these variables as readonly so that later Android.mk cannot
change them.

Bug: 33607778
Test: build/tools/kati_all_products.sh -j12
Change-Id: I5f9a4df02bfdfd56549728f074bbb3fc251edb3d
---
 core/envsetup.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/core/envsetup.mk b/core/envsetup.mk
index b2c766aa8..fedd3f3fd 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -188,7 +188,15 @@ else ifdef BOARD_USES_VENDORIMAGE
 $(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image)
 endif
 ###########################################
-
+# Ensure that only TARGET_RECOVERY_UPDATER_LIBS *or* AB_OTA_UPDATER is set.
+TARGET_RECOVERY_UPDATER_LIBS ?=
+AB_OTA_UPDATER ?=
+.KATI_READONLY := TARGET_RECOVERY_UPDATER_LIBS AB_OTA_UPDATER
+ifeq ($(AB_OTA_UPDATER),true)
+  ifneq ($(strip $(TARGET_RECOVERY_UPDATER_LIBS)),)
+    $(error Do not use TARGET_RECOVERY_UPDATER_LIBS when using AB_OTA_UPDATER)
+  endif
+endif
 
 # ---------------------------------------------------------------
 # Set up configuration for target machine.