Align boot jar exclusion with apex_contributions

`RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST` exists to flag apex boot
jars that may exist in source builds, but not in a google apex prebuilt
(a prebuilt might not have been generated yet). This is a build flag, and
exists in the <rel>.scl

It is feasible that certain products in a specific release config
never use apex prebuilts. Therefore, we need to selectively
apply `RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST` to products that
use apex prebuilts. At ToT, this is done via looking at
module_build_from_source_value of ANDROID soong config namespace, and
<apex>_module soong config namespace for every optional module.

<apex>_module soong config namespace was removed in
https://r.android.com/3056785. In preparation for removing
module_build_from_source, use
`PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS` to determine if
prebuilts are being used.

Test: in internal, lunch barbet-ap2a-userdebug && get_build_var APEX_BOOT_JARS_EXCLUDED
com.android.mediaprovider:framework-pdf com.android.mediaprovider:framework-pdf-v
(this is the only release config where there is a delta between prebuilt
and source apex boot jars)

Test: in internal, lunch barbet-trunk_staging && get_build_var
APEX_BOOT_JARS_EXCLUDED
"" (empty string)

Change-Id: I981ad3a7767f3602a844c8d53eadfd1f2e5db420
diff --git a/core/art_config.mk b/core/art_config.mk
index 47b4bcf..a3f9a41 100644
--- a/core/art_config.mk
+++ b/core/art_config.mk
@@ -24,17 +24,16 @@
 
 # Create APEX_BOOT_JARS_EXCLUDED which is a list of jars to be removed from
 # ApexBoorJars when built from mainline prebuilts.
-# soong variables indicate whether the prebuilt is enabled:
-# - $(m)_module/source_build for art and TOGGLEABLE_PREBUILT_MODULES
-# - ANDROID/module_build_from_source for other mainline modules
 # Note that RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST is the list of module names
 # and library names of jars that need to be removed. We have to keep separated list per
 # release config due to possibility of different prebuilt content.
-APEX_BOOT_JARS_EXCLUDED :=
-$(foreach pair, $(RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST),\
-  $(eval m := $(subst com.android.,,$(call word-colon,1,$(pair)))) \
-  $(if $(call soong_config_get,$(m)_module,source_build), \
-    $(if $(filter true,$(call soong_config_get,$(m)_module,source_build)),, \
-      $(eval APEX_BOOT_JARS_EXCLUDED += $(pair))), \
-    $(if $(filter true,$(call soong_config_get,ANDROID,module_build_from_source)),, \
-      $(eval APEX_BOOT_JARS_EXCLUDED += $(pair)))))
+#
+# If a device has opted to not use google prebuilts (determined using
+# PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS), then no jars need to be removed.
+# Example of products where PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS is true are
+# 1. aosp devices (they do not use google apexes)
+# 2. hwasan devices (apex prebuilts are not compatible with these devices)
+# 3. coverage builds
+ifneq (true, $(PRODUCT_BUILD_IGNORE_APEX_CONTRIBUTION_CONTENTS))
+  APEX_BOOT_JARS_EXCLUDED += $(RELEASE_APEX_BOOT_JARS_PREBUILT_EXCLUDED_LIST)
+endif