Merge "emulator: remove vintf and some whitelists"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 949e88d..ee38a74 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -689,6 +689,12 @@
 # that they live in the ART APEX (b/142944799).
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/framework/*.jar)
 
+# Remove symlinks for VNDK apexes
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/vndk-*)
+
+# Switch to symlinks for VNDK libs
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/vndk-*)
+
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
 # ************************************************
diff --git a/core/Makefile b/core/Makefile
index 9c60855..6015796 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -4815,6 +4815,8 @@
   $(call dump-super-image-info,$(2))
   $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
     echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);)
+  $(if $(BUILDING_SYSTEM_OTHER_IMAGE), $(if $(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)), \
+    echo "system_other_image=$(INSTALLED_SYSTEMOTHERIMAGE_TARGET)" >> $(2);))
   mkdir -p $(dir $(1))
   PATH=$(dir $(LPMAKE)):$$PATH \
     $(BUILD_SUPER_IMAGE) -v $(2) $(1)
@@ -4824,6 +4826,12 @@
 INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \
     $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
 
+ifdef BUILDING_SYSTEM_OTHER_IMAGE
+ifneq ($(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
+INSTALLED_SUPERIMAGE_DEPENDENCIES += $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
+endif
+endif
+
 # If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the
 # $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will
 # be built for non-dist builds. This is useful for devices that uses super.img directly, e.g.
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 2439f79..efb21e7 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -182,7 +182,9 @@
   my_shared_libraries += $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_RUNTIME_LIBRARY)
   ifneq ($(filter EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
     ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-      my_static_libraries := $(my_static_libraries) $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_STATIC_LIBRARY)
+      my_static_libraries := $(my_static_libraries) \
+                             $($(LOCAL_2ND_ARCH_VAR_PREFIX)HWADDRESS_SANITIZER_STATIC_LIBRARY) \
+                             libdl
     endif
   endif
 endif
diff --git a/core/cxx_stl_setup.mk b/core/cxx_stl_setup.mk
index 95b1090..6571d99 100644
--- a/core/cxx_stl_setup.mk
+++ b/core/cxx_stl_setup.mk
@@ -82,7 +82,7 @@
         endif
 
         ifeq ($(my_link_type),static)
-            my_static_libraries += libm libc libdl
+            my_static_libraries += libm libc
         endif
     endif
 else ifeq ($(my_cxx_stl),ndk)
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 0c58cd6..d35cb7e 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -259,14 +259,6 @@
 # Java libraries in the ART apex build rule.
 ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
 TARGET_CORE_JARS := $(ART_APEX_JARS) conscrypt
-ifeq ($(EMMA_INSTRUMENT),true)
-  ifneq ($(EMMA_INSTRUMENT_STATIC),true)
-    # For instrumented build, if Jacoco is not being included statically
-    # in instrumented packages then include Jacoco classes into the
-    # bootclasspath.
-    TARGET_CORE_JARS += jacocoagent
-  endif # EMMA_INSTRUMENT_STATIC
-endif # EMMA_INSTRUMENT
 HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
 #################################################################
 
diff --git a/core/main.mk b/core/main.mk
index a5e2456..29c5a4c 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1253,8 +1253,6 @@
   endef
 endif
 
-# TODO(b/142944799): Implement Java library absence check for Core Libraries.
-
 ifdef FULL_BUILD
   ifneq (true,$(ALLOW_MISSING_DEPENDENCIES))
     # Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)
diff --git a/core/product_config.mk b/core/product_config.mk
index 1293c94..4fc7bf6 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -184,6 +184,18 @@
 all_product_makefiles :=
 all_product_configs :=
 
+# Jacoco agent JARS to be built and installed, if any.
+ifeq ($(EMMA_INSTRUMENT),true)
+  ifneq ($(EMMA_INSTRUMENT_STATIC),true)
+    # For instrumented build, if Jacoco is not being included statically
+    # in instrumented packages then include Jacoco classes into the
+    # bootclasspath.
+    $(foreach product,$(PRODUCTS),\
+      $(eval PRODUCTS.$(product).PRODUCT_PACKAGES += jacocoagent)\
+      $(eval PRODUCTS.$(product).PRODUCT_BOOT_JARS += jacocoagent))
+  endif # EMMA_INSTRUMENT_STATIC
+endif # EMMA_INSTRUMENT
+
 ############################################################################
 # Strip and assign the PRODUCT_ variables.
 $(call strip-product-vars)
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 9e3f0d3..20950ca 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -120,11 +120,12 @@
 endif
 
 ifeq ($(LOCAL_VNDK_DEPEND_ON_CORE_VARIANT),true)
+$(LOCAL_BUILT_MODULE): PRIVATE_TOOLS_PREFIX := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX)
 $(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE) $(LIBRARY_IDENTITY_CHECK_SCRIPT)
 	$(call verify-vndk-libs-identical,\
 		$(PRIVATE_CORE_VARIANT),\
 		$<,\
-		$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)TOOLS_PREFIX))
+		$(PRIVATE_TOOLS_PREFIX))
 	$(copy-file-to-target)
 else
 $(LOCAL_BUILT_MODULE): $(LOCAL_PREBUILT_MODULE_FILE)
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index cc4785a..dda805f 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -39,9 +39,6 @@
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
 endif
 
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-    root/init.zygote64_32.rc \
-
 #
 # All components inherited here go to product image
 #
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index a471702..153f499 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -39,9 +39,6 @@
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
 endif
 
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-    root/init.zygote64_32.rc \
-
 #
 # All components inherited here go to product image
 #
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 03d7681..0f873de 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -157,6 +157,7 @@
 VNDK-core: android.hardware.radio@1.2.so
 VNDK-core: android.hardware.radio@1.3.so
 VNDK-core: android.hardware.radio@1.4.so
+VNDK-core: android.hardware.radio@1.5.so
 VNDK-core: android.hardware.secure_element@1.0.so
 VNDK-core: android.hardware.secure_element@1.1.so
 VNDK-core: android.hardware.sensors@1.0.so
diff --git a/target/product/gsi_arm64.mk b/target/product/gsi_arm64.mk
index 09fb633..645bc3a 100644
--- a/target/product/gsi_arm64.mk
+++ b/target/product/gsi_arm64.mk
@@ -23,9 +23,6 @@
 # Enable mainline checking
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
 
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-    root/init.zygote64_32.rc \
-
 #
 # All components inherited here go to product image
 #
diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk
index cab3916..faaa935 100644
--- a/target/product/gsi_release.mk
+++ b/target/product/gsi_release.mk
@@ -51,19 +51,3 @@
 
 # Support addtional P and Q VNDK packages
 PRODUCT_EXTRA_VNDK_VERSIONS := 28 29
-
-# The 64 bits GSI build targets inhiert core_64_bit.mk to enable 64 bits and
-# include the init.zygote64_32.rc.
-# 64 bits GSI for releasing need to includes different zygote settings for
-# vendor.img to select by setting property ro.zygote=zygote64_32 or
-# ro.zygote=zygote32_64:
-#   1. 64-bit primary, 32-bit secondary, or
-#   2. 32-bit primary, 64-bit secondary
-# Here includes the init.zygote32_64.rc if it had inhierted core_64_bit.mk.
-ifeq (true|true,$(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS))
-PRODUCT_COPY_FILES += \
-    system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-    root/init.zygote32_64.rc
-endif
diff --git a/target/product/mainline_arm64.mk b/target/product/mainline_arm64.mk
index 6d998d6..666ce41 100644
--- a/target/product/mainline_arm64.mk
+++ b/target/product/mainline_arm64.mk
@@ -26,8 +26,6 @@
 PRODUCT_RESTRICT_VENDOR_FILES := all
 
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-  root/init.zygote64_32.rc \
 
 # Modules that should probably be moved to /product
 PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index cd6a0f7..f7eb8ad 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -110,6 +110,13 @@
 PRODUCT_HOST_PACKAGES += \
     tinyplay
 
+# Include all zygote init scripts. "ro.zygote" will select one of them.
+PRODUCT_COPY_FILES += \
+    system/core/rootdir/init.zygote32.rc:root/init.zygote32.rc \
+    system/core/rootdir/init.zygote64.rc:root/init.zygote64.rc \
+    system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc \
+    system/core/rootdir/init.zygote64_32.rc:root/init.zygote64_32.rc
+
 # Enable dynamic partition size
 PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
 
diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk
index 4031371..6249068 100644
--- a/target/product/mainline_system_arm64.mk
+++ b/target/product/mainline_system_arm64.mk
@@ -23,8 +23,6 @@
 
 # Enable mainline checking
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-  root/init.zygote64_32.rc \
 
 PRODUCT_BUILD_CACHE_IMAGE := false
 PRODUCT_BUILD_ODM_IMAGE := false
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index b8cb2ff..581a72b 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -20,6 +20,11 @@
 $(error TARGET_CORE_JARS is empty; cannot update PRODUCT_PACKAGES variable)
 endif
 
+# Minimal boot classpath. This should be a subset of PRODUCT_BOOT_JARS, and equivalent to
+# TARGET_CORE_JARS.
+PRODUCT_PACKAGES += \
+    $(TARGET_CORE_JARS)
+
 # Additional mixins to the boot classpath.
 PRODUCT_PACKAGES += \
     android.test.base \
@@ -32,9 +37,6 @@
 PRODUCT_PACKAGES += com.android.runtime
 
 # ART APEX module.
-# Note that this package includes the minimal boot classpath JARs (listed in
-# TARGET_CORE_JARS), which should no longer be added directly to
-# PRODUCT_PACKAGES.
 PRODUCT_PACKAGES += com.android.art
 PRODUCT_HOST_PACKAGES += com.android.art
 
diff --git a/target/product/sdk_phone_x86_64.mk b/target/product/sdk_phone_x86_64.mk
index 267796f..2d0d6e1 100644
--- a/target/product/sdk_phone_x86_64.mk
+++ b/target/product/sdk_phone_x86_64.mk
@@ -27,9 +27,6 @@
 PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
 endif
 
-PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
-    root/init.zygote64_32.rc \
-
 #
 # All components inherited here go to product image
 #