Configure boot image profiles for platform and unbundled ART module
builds (reland).

- Use art/build/boot/boot-image-profile.txt for the primary boot image
  in the ART module, both when it's built from source in platform and
  as an unbundled module.

- Use frameworks/base/boot/boot-image-profile.txt for the framework
  extension image in platform, but not in unbundled builds.

This should obsolete the combined profile
frameworks/base/config/boot-image-profile.txt.

This relands https://r.android.com/1881863 with a fix to allow multiple
values on PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION.

Test: build/soong/soong_ui.bash --dumpvar-mode \
        PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION
  and check that it prints both art/build/boot/boot-image-profile.txt
  and frameworks/base/boot/boot-image-profile.txt in a platform build
  on master.
Test: build/soong/soong_ui.bash --dumpvar-mode \
        PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION
  and check that it prints only art/build/boot/boot-image-profile.txt
  in an unbundled build on master-art.
Test: banchan com.android.art && m
  on master-art and check that
  out/soong/.intermediates/art/build/apex/com.android.art/android_common_com.android.art_image/image.apex/javalib/x86_64/boot.oat
  shrinks from 14 MB to 4.7.
Test: m droid
  on master together with https://r.android.com/1895131 and check that
  out/soong/.intermediates/art/build/apex/com.android.art/android_common_com.android.art_image/image.apex/javalib/x86_64/boot.oat
  and out/target/product/vsoc_x86_64/system/framework/x86_64/boot-framework.oat
  are identical.
Test: lunch armv8-eng && art/tools/buildbot-build.sh
  on master-art
Bug: 174746397
Change-Id: I9114271bc69cf0888150b2c778a086bc50b73045
diff --git a/core/product.mk b/core/product.mk
index 683c429..503b44f 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -275,10 +275,10 @@
 _product_single_value_vars += PRODUCT_DEX_PREOPT_RESOLVE_STARTUP_STRINGS
 
 # Boot image options.
+_product_list_vars += PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION
 _product_single_value_vars += \
     PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST \
     PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE \
-    PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION \
     PRODUCT_USES_DEFAULT_ART_CONFIG \
 
 _product_single_value_vars += PRODUCT_SYSTEM_SERVER_COMPILER_FILTER
diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk
index 071edbf..e988d00 100644
--- a/target/product/default_art_config.mk
+++ b/target/product/default_art_config.mk
@@ -14,6 +14,9 @@
 # limitations under the License.
 #
 
+# This file contains product config for the ART module that is common for
+# platform and unbundled builds.
+
 ifeq ($(ART_APEX_JARS),)
   $(error ART_APEX_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
 endif
@@ -69,6 +72,8 @@
     com.android.media:service-media-s \
     com.android.permission:service-permission \
 
+PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION += art/build/boot/boot-image-profile.txt
+
 # Minimal configuration for running dex2oat (default argument values).
 # PRODUCT_USES_DEFAULT_ART_CONFIG must be true to enable boot image compilation.
 PRODUCT_USES_DEFAULT_ART_CONFIG := true
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 43fb8fc..ee63757 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -75,6 +75,14 @@
 PRODUCT_PACKAGES += \
     hiddenapi-package-whitelist.xml \
 
+ifeq (,$(TARGET_BUILD_UNBUNDLED))
+  # Don't depend on the framework boot image profile in unbundled builds where
+  # frameworks/base may not be present.
+  # TODO(b/179900989): We may not need this check once we stop using full
+  # platform products on the thin ART manifest branch.
+  PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION += frameworks/base/boot/boot-image-profile.txt
+endif
+
 # The dalvik.vm.dexopt.thermal-cutoff property must contain one of the values
 # listed here:
 #