RESTRICT AUTOMERGE: Exclude mcts tests from cts based on the env config, a CP from aosp/3081046.


Change-Id: Ic4d5e27ff970fab71bb7e85b1dee261fe9793723
Test: make cts EXCLUDE_MCTS=true
Bug: 345592291
diff --git a/core/base_rules.mk b/core/base_rules.mk
index c453469..ddbfe3f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -725,6 +725,14 @@
   test_config := $(wildcard $(LOCAL_PATH)/AndroidTest.xml)
 endif
 
+ifeq ($(EXCLUDE_MCTS),true)
+  ifneq (,$(test_config))
+    ifneq (,$(filter mcts-%,$(LOCAL_COMPATIBILITY_SUITE)))
+      LOCAL_COMPATIBILITY_SUITE := $(filter-out cts,$(LOCAL_COMPATIBILITY_SUITE))
+    endif
+  endif
+endif
+
 ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
 
 # If we are building a native test or benchmark and its stem variants are not defined,