Merge changes I465ea6c9,I57b77d7c

* changes:
  generate multiple boot.img files in aosp_arm64
  create emulator_arm64 device for sdk_phone_arm64 to use
diff --git a/Deprecation.md b/Deprecation.md
index 2f936e3..74b54fa 100644
--- a/Deprecation.md
+++ b/Deprecation.md
@@ -14,21 +14,21 @@
 
 | Module type                      | State     |
 | -------------------------------- | --------- |
-| `BUILD_AUX_EXECUTABLE`           | Error     |
-| `BUILD_AUX_STATIC_LIBRARY`       | Error     |
+| `BUILD_AUX_EXECUTABLE`           | Obsolete  |
+| `BUILD_AUX_STATIC_LIBRARY`       | Obsolete  |
 | `BUILD_COPY_HEADERS`             | Error     |
 | `BUILD_HOST_EXECUTABLE`          | Error     |
-| `BUILD_HOST_FUZZ_TEST`           | Error     |
-| `BUILD_HOST_NATIVE_TEST`         | Error     |
+| `BUILD_HOST_FUZZ_TEST`           | Obsolete  |
+| `BUILD_HOST_NATIVE_TEST`         | Obsolete  |
 | `BUILD_HOST_SHARED_LIBRARY`      | Error     |
-| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error     |
+| `BUILD_HOST_SHARED_TEST_LIBRARY` | Obsolete  |
 | `BUILD_HOST_STATIC_LIBRARY`      | Error     |
-| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error     |
-| `BUILD_HOST_TEST_CONFIG`         | Error     |
-| `BUILD_NATIVE_BENCHMARK`         | Error     |
-| `BUILD_SHARED_TEST_LIBRARY`      | Error     |
-| `BUILD_STATIC_TEST_LIBRARY`      | Error     |
-| `BUILD_TARGET_TEST_CONFIG`       | Error     |
+| `BUILD_HOST_STATIC_TEST_LIBRARY` | Obsolete  |
+| `BUILD_HOST_TEST_CONFIG`         | Obsolete  |
+| `BUILD_NATIVE_BENCHMARK`         | Obsolete  |
+| `BUILD_SHARED_TEST_LIBRARY`      | Obsolete  |
+| `BUILD_STATIC_TEST_LIBRARY`      | Obsolete  |
+| `BUILD_TARGET_TEST_CONFIG`       | Obsolete  |
 | `BUILD_*`                        | Available |
 
 ## Module Type Deprecation Process
diff --git a/core/Makefile b/core/Makefile
index 401696d..ab0c047 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -39,6 +39,16 @@
       use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
 )
 endef
+
+# TODO(b/140560012): Flip BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES to default
+# false after all problematic devices are tagged.
+check_elf_prebuilt_product_copy_files :=
+ifneq (,$(filter false,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES)))
+check_elf_prebuilt_product_copy_files := true
+endif
+check_elf_prebuilt_product_copy_files_hint := \
+    found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.
+
 # filter out the duplicate <source file>:<dest file> pairs.
 unique_product_copy_files_pairs :=
 $(foreach cf,$(PRODUCT_COPY_FILES), \
@@ -59,7 +69,10 @@
                 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
                 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
                     $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
-                    $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
+                    $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \
+                               $(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \
+                        $(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \
+                        $(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \
         $(eval unique_product_copy_files_destinations += $(_dest))))
 
 # Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
diff --git a/core/aux_config.mk b/core/aux_config.mk
deleted file mode 100644
index 10d2536..0000000
--- a/core/aux_config.mk
+++ /dev/null
@@ -1,187 +0,0 @@
-variant_list := $(filter AUX-%,$(MAKECMDGOALS))
-
-ifdef variant_list
-AUX_OS_VARIANT_LIST := $(patsubst AUX-%,%,$(variant_list))
-else
-AUX_OS_VARIANT_LIST := $(TARGET_AUX_OS_VARIANT_LIST)
-endif
-
-# exclude AUX targets from build
-ifeq ($(AUX_OS_VARIANT_LIST),none)
-AUX_OS_VARIANT_LIST :=
-endif
-
-# temporary workaround to support external toolchain
-ifeq ($(NANOHUB_TOOLCHAIN),)
-AUX_OS_VARIANT_LIST :=
-endif
-
-# setup toolchain paths for various CPU architectures
-# this one will come from android prebuilts eventually
-AUX_TOOLCHAIN_cortexm4 := $(NANOHUB_TOOLCHAIN)
-ifeq ($(wildcard $(AUX_TOOLCHAIN_cortexm4)gcc),)
-AUX_TOOLCHAIN_cortexm4:=
-endif
-
-# there is no MAKE var that defines path to HOST toolchain
-# all the interesting paths are hardcoded in soong, and are not available from here
-# There is no other way but to hardcode them again, as we may need host x86 toolcain for AUX
-ifeq ($(HOST_OS),linux)
-AUX_TOOLCHAIN_x86 := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
-endif
-
-# setup AUX globals
-AUX_SHLIB_SUFFIX := .so
-AUX_GLOBAL_ARFLAGS := crsPD
-AUX_STATIC_LIB_SUFFIX := .a
-
-# Load ever-lasting "indexed" version of AUX variant environment; it is treated as READ-ONLY from this
-# moment on.
-#
-# $(1) - variant
-# no return value
-define aux-variant-setup-paths
-$(eval AUX_OUT_ROOT_$(1) := $(PRODUCT_OUT)/aux/$(1)) \
-$(eval AUX_COMMON_OUT_ROOT_$(1) := $(AUX_OUT_ROOT_$(1))/common) \
-$(eval AUX_OUT_$(1) := $(AUX_OUT_ROOT_$(1))/$(AUX_OS_$(1))-$(AUX_ARCH_$(1))-$(AUX_CPU_$(1))) \
-$(eval AUX_OUT_INTERMEDIATES_$(1) := $(AUX_OUT_$(1))/obj) \
-$(eval AUX_OUT_COMMON_INTERMEDIATES_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/obj) \
-$(eval AUX_OUT_HEADERS_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/include) \
-$(eval AUX_OUT_NOTICE_FILES_$(1) := $(AUX_OUT_INTERMEDIATES_$(1))/NOTICE_FILES) \
-$(eval AUX_OUT_FAKE_$(1) := $(AUX_OUT_$(1))/fake_packages) \
-$(eval AUX_OUT_GEN_$(1) := $(AUX_OUT_$(1))/gen) \
-$(eval AUX_OUT_COMMON_GEN_$(1) := $(AUX_COMMON_OUT_ROOT_$(1))/gen) \
-$(eval AUX_OUT_EXECUTABLES_$(1) := $(AUX_OUT_$(1))/bin) \
-$(eval AUX_OUT_UNSTRIPPED_$(1) := $(AUX_OUT_$(1))/symbols)
-endef
-
-# Copy "indexed" AUX environment for given VARIANT into
-# volatile not-indexed set of variables for simplicity of access.
-# Injection of index support throughout the build system is suboptimal
-# hence volatile environment is constructed
-# Unlike HOST*, TARGET* variables, AUX* variables are NOT read-only, but their
-# indexed versions are.
-#
-# $(1) - variant
-# no return value
-define aux-variant-load-env
-$(eval AUX_OS_VARIANT:=$(1)) \
-$(eval AUX_OS:=$(AUX_OS_$(1))) \
-$(eval AUX_ARCH:=$(AUX_ARCH_$(1))) \
-$(eval AUX_SUBARCH:=$(AUX_SUBARCH_$(1))) \
-$(eval AUX_CPU:=$(AUX_CPU_$(1))) \
-$(eval AUX_OS_PATH:=$(AUX_OS_PATH_$(1))) \
-$(eval AUX_OUT_ROOT := $(AUX_OUT_ROOT_$(1))) \
-$(eval AUX_COMMON_OUT_ROOT := $(AUX_COMMON_OUT_ROOT_$(1))) \
-$(eval AUX_OUT := $(AUX_OUT_$(1))) \
-$(eval AUX_OUT_INTERMEDIATES := $(AUX_OUT_INTERMEDIATES_$(1))) \
-$(eval AUX_OUT_COMMON_INTERMEDIATES := $(AUX_OUT_COMMON_INTERMEDIATES_$(1))) \
-$(eval AUX_OUT_HEADERS := $(AUX_OUT_HEADERS_$(1))) \
-$(eval AUX_OUT_NOTICE_FILES := $(AUX_OUT_NOTICE_FILES_$(1))) \
-$(eval AUX_OUT_FAKE := $(AUX_OUT_FAKE_$(1))) \
-$(eval AUX_OUT_GEN := $(AUX_OUT_GEN_$(1))) \
-$(eval AUX_OUT_COMMON_GEN := $(AUX_OUT_COMMON_GEN_$(1))) \
-$(eval AUX_OUT_EXECUTABLES := $(AUX_OUT_EXECUTABLES_$(1))) \
-$(eval AUX_OUT_UNSTRIPPED := $(AUX_OUT_UNSTRIPPED_$(1)))
-endef
-
-# given a variant:path pair, load the variant conviguration with aux-variant-setup-paths from file
-# this is a build system extension mechainsm, since configuration typically resides in non-build
-# project space
-#
-# $(1) - variant:path pair
-# $(2) - file suffix
-# no return value
-define aux-variant-import-from-pair
-$(eval _pair := $(subst :, ,$(1))) \
-$(eval _name:=$(word 1,$(_pair))) \
-$(eval _path:=$(word 2,$(_pair))) \
-$(eval include $(_path)/$(_name)$(2)) \
-$(eval AUX_OS_VARIANT_LIST_$(AUX_OS_$(1)):=) \
-$(call aux-variant-setup-paths,$(_name)) \
-$(eval AUX_ALL_VARIANTS += $(_name)) \
-$(eval AUX_ALL_OSES := $(filter-out $(AUX_OS_$(_name)),$(AUX_ALL_OSES)) $(AUX_OS_$(_name))) \
-$(eval AUX_ALL_CPUS := $(filter-out $(AUX_CPU_$(_name)),$(AUX_ALL_CPUS)) $(AUX_CPU_$(_name))) \
-$(eval AUX_ALL_ARCHS := $(filter-out $(AUX_ARCH_$(_name)),$(AUX_ALL_ARCHS)) $(AUX_ARCH_$(_name))) \
-$(eval AUX_ALL_SUBARCHS := $(filter-out $(AUX_SUBARCH_$(_name)),$(AUX_ALL_SUBARCHS)) $(AUX_SUBARCH_$(_name)))
-endef
-
-# Load system configuration referenced by AUX variant config;
-# this is a build extension mechanism; typically system config
-# resides in a non-build projects;
-# system config may define new rules and globally visible BUILD*
-# includes to support project-specific build steps and toolchains
-# MAintains list of valiants that reference this os config in OS "indexed" var
-# this facilitates multivariant build of the OS (or whataver it is the name of common component these variants share)
-#
-# $(1) - variant
-# no return value
-define aux-import-os-config
-$(eval _aioc_os := $(AUX_OS_$(1))) \
-$(eval AUX_OS_PATH_$(1) := $(patsubst $(_aioc_os):%,%,$(filter $(_aioc_os):%,$(AUX_ALL_OS_PATHS)))) \
-$(eval _aioc_os_cfg := $(AUX_OS_PATH_$(1))/$(_aioc_os)$(os_sfx)) \
-$(if $(wildcard $(_aioc_os_cfg)),,$(error AUX '$(_aioc_os)' OS config file [$(notdir $(_aioc_os_cfg))] required by AUX variant '$(1)' does not exist)) \
-$(if $(filter $(_aioc_os),$(_os_list)),,$(eval include $(_aioc_os_cfg))) \
-$(eval AUX_OS_VARIANT_LIST_$(_aioc_os) += $(1)) \
-$(eval _os_list += $(_aioc_os))
-endef
-
-# make sure that AUX config variables are minimally sane;
-# as a bare minimum they must contain the vars described by aux_env
-# Generate error if requirement is not met.
-#
-#$(1) - variant
-# no return value
-define aux-variant-validate
-$(eval _all:=) \
-$(eval _req:=$(addsuffix _$(1),$(aux_env))) \
-$(foreach var,$(_req),$(eval _all += $(var))) \
-$(eval _missing := $(filter-out $(_all),$(_req))) \
-$(if $(_missing),$(error AUX variant $(1) must define vars: $(_missing)))
-endef
-
-AUX_ALL_VARIANTS :=
-AUX_ALL_OSES :=
-AUX_ALL_CPUS :=
-AUX_ALL_ARCHS :=
-AUX_ALL_SUBARCHS :=
-
-variant_sfx :=_aux_variant_config.mk
-os_sfx :=_aux_os_config.mk
-
-ifdef AUX_OS_VARIANT_LIST
-
-config_roots := $(wildcard device vendor)
-all_configs :=
-ifdef config_roots
-all_configs := $(sort $(shell find $(config_roots) -maxdepth 4 -name '*$(variant_sfx)' -o -name '*$(os_sfx)'))
-endif
-all_os_configs := $(filter %$(os_sfx),$(all_configs))
-all_variant_configs := $(filter %$(variant_sfx),$(all_configs))
-
-AUX_ALL_OS_PATHS := $(foreach f,$(all_os_configs),$(patsubst %$(os_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
-AUX_ALL_OS_VARIANT_PATHS := $(foreach f,$(all_variant_configs),$(patsubst %$(variant_sfx),%,$(notdir $(f))):$(patsubst %/,%,$(dir $(f))))
-
-my_variant_pairs := $(foreach v,$(AUX_OS_VARIANT_LIST),$(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)))
-my_missing_variants := $(foreach v,$(AUX_OS_VARIANT_LIST),$(if $(filter $(v):%,$(AUX_ALL_OS_VARIANT_PATHS)),,$(v)))
-
-ifneq ($(strip $(my_missing_variants)),)
-$(error Don't know how to build variant(s): $(my_missing_variants))
-endif
-
-# mandatory variables
-aux_env := AUX_OS AUX_ARCH AUX_SUBARCH AUX_CPU
-
-$(foreach v,$(my_variant_pairs),$(if $(filter $(v),$(AUX_ALL_VARIANTS)),,$(call aux-variant-import-from-pair,$(v),$(variant_sfx))))
-
-ifdef AUX_ALL_VARIANTS
-_os_list :=
-$(foreach v,$(AUX_ALL_VARIANTS),\
-  $(call aux-import-os-config,$(v)) \
-  $(call aux-variant-validate,$(v)) \
-)
-endif
-
-endif # AUX_OS_VARIANT_LIST
-
-INSTALLED_AUX_TARGETS :=
diff --git a/core/aux_executable.mk b/core/aux_executable.mk
deleted file mode 100644
index 5395e61..0000000
--- a/core/aux_executable.mk
+++ /dev/null
@@ -1,95 +0,0 @@
-# caller might have included aux_toolchain, e.g. if custom build steps are defined
-ifeq ($(LOCAL_IS_AUX_MODULE),)
-include $(BUILD_SYSTEM)/aux_toolchain.mk
-endif
-
-ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
-
-###########################################################
-## Standard rules for building an executable file.
-##
-## Additional inputs from base_rules.make:
-## None.
-###########################################################
-
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := EXECUTABLES
-endif
-
-$(call $(aux-executable-hook))
-
-###########################################################
-## Standard rules for building any target-side binaries
-## with dynamic linkage (dynamic libraries or executables
-## that link with dynamic libraries)
-##
-## Files including this file must define a rule to build
-## the target $(linked_module).
-###########################################################
-
-# The name of the target file, without any path prepended.
-# This duplicates logic from base_rules.mk because we need to
-# know its results before base_rules.mk is included.
-include $(BUILD_SYSTEM)/configure_module_stem.mk
-
-intermediates := $(call local-intermediates-dir)
-
-# Define the target that is the unmodified output of the linker.
-# The basename of this target must be the same as the final output
-# binary name, because it's used to set the "soname" in the binary.
-# The includer of this file will define a rule to build this target.
-linked_module := $(intermediates)/LINKED/$(my_built_module_stem)
-
-ALL_ORIGINAL_DYNAMIC_BINARIES += $(linked_module)
-
-# Because AUX_SYMBOL_FILTER_FILE depends on ALL_ORIGINAL_DYNAMIC_BINARIES,
-# the linked_module rules won't necessarily inherit the PRIVATE_
-# variables from LOCAL_BUILT_MODULE.  This tells binary.make to explicitly
-# define the PRIVATE_ variables for linked_module as well as for
-# LOCAL_BUILT_MODULE.
-LOCAL_INTERMEDIATE_TARGETS += $(linked_module)
-
-###################################
-include $(BUILD_SYSTEM)/binary.mk
-###################################
-
-aux_output := $(linked_module)
-
-ifneq ($(LOCAL_CUSTOM_BUILD_STEP_INPUT),)
-ifneq ($(LOCAL_CUSTOM_BUILD_STEP_OUTPUT),)
-
-# injecting custom build steps
-$(LOCAL_CUSTOM_BUILD_STEP_INPUT): $(aux_output)
-	@echo "$(AUX_DISPLAY) custom copy: $(PRIVATE_MODULE) ($@)"
-	@mkdir -p $(dir $@)
-	$(hide) $(copy-file-to-target)
-
-aux_output := $(LOCAL_CUSTOM_BUILD_STEP_OUTPUT)
-
-endif
-endif
-
-$(LOCAL_BUILT_MODULE): $(aux_output)
-	@echo "$(AUX_DISPLAY) final copy: $(PRIVATE_MODULE) ($@)"
-	@mkdir -p $(dir $@)
-	$(hide) $(copy-file-to-target)
-
-INSTALLED_AUX_TARGETS += $(LOCAL_INSTALLED_MODULE)
-
-$(cleantarget): PRIVATE_CLEAN_FILES += \
-    $(linked_module) \
-
-# Define PRIVATE_ variables from global vars
-$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
-
-ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
-	$(transform-o-to-aux-static-executable)
-	$(PRIVATE_POST_LINK_CMD)
-else
-$(linked_module): $(all_objects) $(all_libraries) $(LOCAL_ADDITIONAL_DEPENDENCIES)
-	$(transform-o-to-aux-executable)
-	$(PRIVATE_POST_LINK_CMD)
-endif
-
-endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_static_library.mk b/core/aux_static_library.mk
deleted file mode 100644
index d88478d..0000000
--- a/core/aux_static_library.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-ifeq ($(LOCAL_IS_AUX_MODULE),)
-include $(BUILD_SYSTEM)/aux_toolchain.mk
-endif
-
-ifeq ($(AUX_BUILD_NOT_COMPATIBLE),)
-
-ifeq ($(strip $(LOCAL_MODULE_CLASS)),)
-LOCAL_MODULE_CLASS := STATIC_LIBRARIES
-endif
-ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
-LOCAL_MODULE_SUFFIX := .a
-endif
-
-LOCAL_UNINSTALLABLE_MODULE := true
-
-ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
-$(error $(LOCAL_PATH): Cannot set module stem for a library)
-endif
-
-include $(BUILD_SYSTEM)/binary.mk
-
-$(LOCAL_BUILT_MODULE) : PRIVATE_AR := $(AUX_AR)
-$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
-$(LOCAL_BUILT_MODULE) : $(all_objects)
-	$(transform-o-to-aux-static-lib)
-
-endif # AUX_BUILD_NOT_COMPATIBLE
diff --git a/core/aux_toolchain.mk b/core/aux_toolchain.mk
deleted file mode 100644
index c710228..0000000
--- a/core/aux_toolchain.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-###########################################################
-# takes form LOCAL_AUX_TOOLCHAIN_$(LOCAL_AUX_CPU)
-###########################################################
-
-###############################
-# setup AUX environment
-###############################
-
-# shortcuts for targets with a single instance of OS, ARCH, VARIANT, CPU
-AUX_TOOLCHAIN := $(if $(LOCAL_AUX_TOOLCHAIN),$(LOCAL_AUX_TOOLCHAIN),$(AUX_TOOLCHAIN_$(AUX_CPU)))
-AUX_BUILD_NOT_COMPATIBLE:=
-ifeq ($(strip $(AUX_TOOLCHAIN)),)
-  ifeq ($(strip $(AUX_CPU)),)
-    $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined CPU for AUX toolchain)
-    AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
-  else
-    $(warning $(LOCAL_PATH): $(LOCAL_MODULE): Undefined AUX toolchain for CPU=$(AUX_CPU))
-    AUX_BUILD_NOT_COMPATIBLE += TOOLCHAIN
-  endif
-endif
-
-AUX_BUILD_NOT_COMPATIBLE += $(foreach var,OS ARCH SUBARCH CPU OS_VARIANT,$(if $(LOCAL_AUX_$(var)),$(if \
-    $(filter $(LOCAL_AUX_$(var)),$(AUX_$(var))),,$(var))))
-
-AUX_BUILD_NOT_COMPATIBLE := $(strip $(AUX_BUILD_NOT_COMPATIBLE))
-
-ifneq ($(AUX_BUILD_NOT_COMPATIBLE),)
-$(info $(LOCAL_PATH): $(LOCAL_MODULE): not compatible: "$(AUX_BUILD_NOT_COMPATIBLE)" with)
-$(info ====> OS=$(AUX_OS) CPU=$(AUX_CPU) ARCH=$(AUX_ARCH) SUBARCH=$(AUX_SUBARCH) OS_VARIANT=$(AUX_OS_VARIANT))
-$(info ====> TOOLCHAIN=$(AUX_TOOLCHAIN))
-endif
-
-AUX_AR := $(AUX_TOOLCHAIN)ar
-AUX_AS := $(AUX_TOOLCHAIN)gcc
-AUX_CC := $(AUX_TOOLCHAIN)gcc
-AUX_CXX := $(AUX_TOOLCHAIN)g++
-AUX_LINKER := $(AUX_TOOLCHAIN)ld
-AUX_OBJCOPY := $(AUX_TOOLCHAIN)objcopy
-AUX_OBJDUMP := $(AUX_TOOLCHAIN)objdump
-
-###############################
-# setup Android environment
-###############################
-
-LOCAL_IS_AUX_MODULE := true
-LOCAL_2ND_ARCH_VAR_PREFIX :=
-LOCAL_CC := $(AUX_CC)
-LOCAL_CXX := $(AUX_CXX)
-LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
-LOCAL_SYSTEM_SHARED_LIBRARIES :=
-LOCAL_CXX_STL := none
-LOCAL_NO_PIC := true
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 1d1c114..b161384 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -34,7 +34,6 @@
 $(call verify-module-name)
 
 LOCAL_IS_HOST_MODULE := $(strip $(LOCAL_IS_HOST_MODULE))
-LOCAL_IS_AUX_MODULE := $(strip $(LOCAL_IS_AUX_MODULE))
 ifdef LOCAL_IS_HOST_MODULE
   ifneq ($(LOCAL_IS_HOST_MODULE),true)
     $(error $(LOCAL_PATH): LOCAL_IS_HOST_MODULE must be "true" or empty, not "$(LOCAL_IS_HOST_MODULE)")
@@ -47,16 +46,8 @@
   my_host := host-
   my_kind := HOST
 else
-  ifdef LOCAL_IS_AUX_MODULE
-    ifneq ($(LOCAL_IS_AUX_MODULE),true)
-      $(error $(LOCAL_PATH): LOCAL_IS_AUX_MODULE must be "true" or empty, not "$(LOCAL_IS_AUX_MODULE)")
-    endif
-    my_prefix := AUX_
-    my_kind := AUX
-  else
-    my_prefix := TARGET_
-    my_kind :=
-  endif
+  my_prefix := TARGET_
+  my_kind :=
   my_host :=
 endif
 
@@ -316,12 +307,9 @@
   my_all_targets := device_$(my_register_name)_all_targets
 endif
 
-# variant is enough to make nano class unique; it serves as a key to lookup (OS,ARCH) tuple
-aux_class := $($(my_prefix)OS_VARIANT)
 # Make sure that this IS_HOST/CLASS/MODULE combination is unique.
 module_id := MODULE.$(if \
-    $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),$(if \
-    $(LOCAL_IS_AUX_MODULE),$(aux_class),TARGET)).$(LOCAL_MODULE_CLASS).$(my_register_name)
+    $(LOCAL_IS_HOST_MODULE),$($(my_prefix)OS),TARGET).$(LOCAL_MODULE_CLASS).$(my_register_name)
 ifdef $(module_id)
 $(error $(LOCAL_PATH): $(module_id) already defined by $($(module_id)))
 endif
@@ -428,7 +416,6 @@
 ###########################################################
 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PATH:=$(LOCAL_PATH)
 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_HOST_MODULE := $(LOCAL_IS_HOST_MODULE)
-$(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_IS_AUX_MODULE := $(LOCAL_IS_AUX_MODULE)
 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_HOST:= $(my_host)
 $(LOCAL_INTERMEDIATE_TARGETS) : PRIVATE_PREFIX := $(my_prefix)
 
diff --git a/core/board_config.mk b/core/board_config.mk
index a329cb1..2279c3f 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -87,6 +87,7 @@
 
 _build_broken_var_list := \
   BUILD_BROKEN_DUP_RULES \
+  BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \
   BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \
   BUILD_BROKEN_PREBUILT_ELF_FILES \
   BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 3d481df..e2bdb37 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -293,7 +293,6 @@
 LOCAL_SYSTEM_SHARED_LIBRARIES:=none
 LOCAL_TARGET_REQUIRED_MODULES:=
 LOCAL_TEST_CONFIG:=
-LOCAL_TEST_CONFIG_OPTIONS:=
 LOCAL_TEST_DATA:=
 LOCAL_TEST_MODULE_TO_PROGUARD_WITH:=
 LOCAL_TIDY:=
@@ -474,17 +473,6 @@
 LOCAL_ROBOTEST_TIMEOUT :=
 LOCAL_TEST_PACKAGE :=
 
-# Aux specific variables
-LOCAL_AUX_ARCH :=
-LOCAL_AUX_CPU :=
-LOCAL_AUX_OS :=
-LOCAL_AUX_OS_VARIANT :=
-LOCAL_AUX_SUBARCH :=
-LOCAL_AUX_TOOLCHAIN :=
-LOCAL_CUSTOM_BUILD_STEP_INPUT:=
-LOCAL_CUSTOM_BUILD_STEP_OUTPUT:=
-LOCAL_IS_AUX_MODULE :=
-
 full_android_manifest :=
 non_system_module :=
 
diff --git a/core/config.mk b/core/config.mk
index b329b0d..160614d 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -122,6 +122,19 @@
 $(KATI_obsolete_var MD5SUM)
 $(KATI_obsolete_var BOARD_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES)
 $(KATI_obsolete_var LOCAL_HAL_STATIC_LIBRARIES, See $(CHANGES_URL)#BOARD_HAL_STATIC_LIBRARIES)
+$(KATI_obsolete_var \
+  TARGET_AUX_OS_VARIANT_LIST \
+  LOCAL_AUX_ARCH \
+  LOCAL_AUX_CPU \
+  LOCAL_AUX_OS \
+  LOCAL_AUX_OS_VARIANT \
+  LOCAL_AUX_SUBARCH \
+  LOCAL_AUX_TOOLCHAIN \
+  LOCAL_CUSTOM_BUILD_STEP_INPUT \
+  LOCAL_CUSTOM_BUILD_STEP_OUTPUT \
+  LOCAL_IS_AUX_MODULE \
+  ,AUX support has been removed)
+$(KATI_obsolete_var HOST_OUT_TEST_CONFIG TARGET_OUT_TEST_CONFIG LOCAL_TEST_CONFIG_OPTIONS)
 
 # Used to force goals to build.  Only use for conditionally defined goals.
 .PHONY: FORCE
@@ -170,8 +183,6 @@
 BUILD_HOST_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_library.mk
 BUILD_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/static_library.mk
 BUILD_HEADER_LIBRARY :=$= $(BUILD_SYSTEM)/header_library.mk
-BUILD_AUX_STATIC_LIBRARY :=$= $(BUILD_SYSTEM)/aux_static_library.mk
-BUILD_AUX_EXECUTABLE :=$= $(BUILD_SYSTEM)/aux_executable.mk
 BUILD_SHARED_LIBRARY :=$= $(BUILD_SYSTEM)/shared_library.mk
 BUILD_EXECUTABLE :=$= $(BUILD_SYSTEM)/executable.mk
 BUILD_HOST_EXECUTABLE :=$= $(BUILD_SYSTEM)/host_executable.mk
@@ -186,23 +197,12 @@
 BUILD_HOST_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_java_library.mk
 BUILD_COPY_HEADERS :=$= $(BUILD_SYSTEM)/copy_headers.mk
 BUILD_NATIVE_TEST :=$= $(BUILD_SYSTEM)/native_test.mk
-BUILD_NATIVE_BENCHMARK :=$= $(BUILD_SYSTEM)/native_benchmark.mk
-BUILD_HOST_NATIVE_TEST :=$= $(BUILD_SYSTEM)/host_native_test.mk
 BUILD_FUZZ_TEST :=$= $(BUILD_SYSTEM)/fuzz_test.mk
-BUILD_HOST_FUZZ_TEST :=$= $(BUILD_SYSTEM)/host_fuzz_test.mk
-
-BUILD_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/shared_test_lib.mk
-BUILD_HOST_SHARED_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_shared_test_lib.mk
-BUILD_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/static_test_lib.mk
-BUILD_HOST_STATIC_TEST_LIBRARY :=$= $(BUILD_SYSTEM)/host_static_test_lib.mk
 
 BUILD_NOTICE_FILE :=$= $(BUILD_SYSTEM)/notice_files.mk
 BUILD_HOST_DALVIK_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_java_library.mk
 BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY :=$= $(BUILD_SYSTEM)/host_dalvik_static_java_library.mk
 
-BUILD_HOST_TEST_CONFIG :=$= $(BUILD_SYSTEM)/host_test_config.mk
-BUILD_TARGET_TEST_CONFIG :=$= $(BUILD_SYSTEM)/target_test_config.mk
-
 include $(BUILD_SYSTEM)/deprecation.mk
 
 # ###############################################################
@@ -579,7 +579,7 @@
 # prebuilts/build-tools/common/bison.
 # To run bison from elsewhere you need to set up enviromental variable
 # BISON_PKGDATADIR.
-BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison
+BISON_PKGDATADIR := $(prebuilt_build_tools)/common/bison
 BISON := $(prebuilt_build_tools_bin_noasan)/bison
 YACC := $(BISON) -d
 BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
@@ -1149,19 +1149,6 @@
 TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
 TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,30,$(TARGET_AVAILABLE_SDK_VERSIONS))
 
-ifndef INTERNAL_PLATFORM_PRIVATE_API_FILE
-INTERNAL_PLATFORM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private.txt
-endif
-ifndef INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE
-INTERNAL_PLATFORM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private-dex.txt
-endif
-ifndef INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE
-INTERNAL_PLATFORM_SYSTEM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private.txt
-endif
-ifndef INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE
-INTERNAL_PLATFORM_SYSTEM_PRIVATE_DEX_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/system-private-dex.txt
-endif
-
 # Missing optional uses-libraries so that the platform doesn't create build rules that depend on
 # them.
 INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := \
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index 8c76a8d..c5cb91c 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -372,8 +372,8 @@
   my_cflags += $(HWADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS)
 endif
 
-# Use minimal diagnostics when integer overflow is enabled; never do it for HOST or AUX modules
-ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_IS_AUX_MODULE),)
+# Use minimal diagnostics when integer overflow is enabled; never do it for HOST modules
+ifeq ($(LOCAL_IS_HOST_MODULE),)
   # Pre-emptively add UBSAN minimal runtime incase a static library dependency requires it
   ifeq ($(filter STATIC_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
     ifndef LOCAL_SDK_VERSION
diff --git a/core/definitions.mk b/core/definitions.mk
index b714bdb..1467e96 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -95,7 +95,6 @@
 
 # Display names for various build targets
 TARGET_DISPLAY := target
-AUX_DISPLAY := aux
 HOST_DISPLAY := host
 HOST_CROSS_DISPLAY := host cross
 
@@ -510,23 +509,18 @@
 $(if $(1),$(call reverse-list,$(wordlist 2,$(words $(1)),$(1)))) $(firstword $(1))
 endef
 
-define def-host-aux-target
-$(eval _idf_val_:=$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST,$(if $(strip $(LOCAL_IS_AUX_MODULE)),AUX,))) \
-$(_idf_val_)
-endef
-
 ###########################################################
 ## Returns correct _idfPrefix from the list:
-##   { HOST, HOST_CROSS, AUX, TARGET }
+##   { HOST, HOST_CROSS, TARGET }
 ###########################################################
 # the following rules checked in order:
-# ($1 is in {AUX, HOST_CROSS} => $1;
+# ($1 is in {HOST_CROSS} => $1;
 # ($1 is empty) => TARGET;
 # ($2 is not empty) => HOST_CROSS;
 # => HOST;
 define find-idf-prefix
 $(strip \
-    $(eval _idf_pfx_:=$(strip $(filter AUX HOST_CROSS,$(1)))) \
+    $(eval _idf_pfx_:=$(strip $(filter HOST_CROSS,$(1)))) \
     $(eval _idf_pfx_:=$(if $(strip $(1)),$(if $(_idf_pfx_),$(_idf_pfx_),$(if $(strip $(2)),HOST_CROSS,HOST)),TARGET)) \
     $(_idf_pfx_)
 )
@@ -542,7 +536,7 @@
 
 # $(1): target class, like "APPS"
 # $(2): target name, like "NotePad"
-# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
+# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> }
 # $(4): if non-empty, force the intermediates to be COMMON
 # $(5): if non-empty, force the intermediates to be for the 2nd arch
 # $(6): if non-empty, force the intermediates to be for the host cross os
@@ -579,7 +573,7 @@
         $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-intermediates-dir)) \
     $(if $(strip $(LOCAL_MODULE)),, \
         $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-intermediates-dir)) \
-    $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1),$(2),$(3)) \
+    $(call intermediates-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1),$(2),$(3)) \
 )
 endef
 
@@ -594,7 +588,7 @@
 
 # $(1): target class, like "APPS"
 # $(2): target name, like "NotePad"
-# $(3): { HOST, HOST_CROSS, AUX, <empty (TARGET)>, <other non-empty (HOST)> }
+# $(3): { HOST, HOST_CROSS, <empty (TARGET)>, <other non-empty (HOST)> }
 # $(4): if non-empty, force the generated sources to be COMMON
 define generated-sources-dir-for
 $(strip \
@@ -624,7 +618,7 @@
         $(error $(LOCAL_PATH): LOCAL_MODULE_CLASS not defined before call to local-generated-sources-dir)) \
     $(if $(strip $(LOCAL_MODULE)),, \
         $(error $(LOCAL_PATH): LOCAL_MODULE not defined before call to local-generated-sources-dir)) \
-    $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(call def-host-aux-target),$(1)) \
+    $(call generated-sources-dir-for,$(LOCAL_MODULE_CLASS),$(LOCAL_MODULE),$(if $(strip $(LOCAL_IS_HOST_MODULE)),HOST),$(1)) \
 )
 endef
 
@@ -1499,89 +1493,6 @@
 $(hide) mv -f $@.tmp $@
 endef
 
-# $(1): the full path of the source static library.
-# $(2): the full path of the destination static library.
-define _extract-and-include-single-aux-whole-static-lib
-$(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\
-    rm -rf $$ldir; \
-    mkdir -p $$ldir; \
-    cp $(1) $$ldir; \
-    lib_to_include=$$ldir/$(notdir $(1)); \
-    filelist=; \
-    subdir=0; \
-    for f in `$(PRIVATE_AR) t $(1)`; do \
-        if [ -e $$ldir/$$f ]; then \
-            mkdir $$ldir/$$subdir; \
-            ext=$$subdir/; \
-            subdir=$$((subdir+1)); \
-            $(PRIVATE_AR) m $$lib_to_include $$f; \
-        else \
-            ext=; \
-        fi; \
-        $(PRIVATE_AR) p $$lib_to_include $$f > $$ldir/$$ext$$f; \
-        filelist="$$filelist $$ldir/$$ext$$f"; \
-    done ; \
-    $(PRIVATE_AR) $(AUX_GLOBAL_ARFLAGS) $(2) $$filelist
-
-endef
-
-define extract-and-include-aux-whole-static-libs
-$(call extract-and-include-whole-static-libs-first, $(firstword $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)),$(1))
-$(foreach lib,$(wordlist 2,999,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)), \
-    $(call _extract-and-include-single-aux-whole-static-lib, $(lib), $(1)))
-endef
-
-# Explicitly delete the archive first so that ar doesn't
-# try to add to an existing archive.
-define transform-o-to-aux-static-lib
-@echo "$($(PRIVATE_PREFIX)DISPLAY) StaticLib: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-@rm -f $@ $@.tmp
-$(call extract-and-include-aux-whole-static-libs,$@.tmp)
-$(call split-long-arguments,$(PRIVATE_AR) \
-    $(AUX_GLOBAL_ARFLAGS) $@.tmp,$(PRIVATE_ALL_OBJECTS))
-$(hide) mv -f $@.tmp $@
-endef
-
-define transform-o-to-aux-executable-inner
-$(hide) $(PRIVATE_CXX_LINK) -pie \
-  -Bdynamic \
-  -Wl,--gc-sections \
-  $(PRIVATE_ALL_OBJECTS) \
-  -Wl,--whole-archive \
-  $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
-  -Wl,--no-whole-archive \
-  $(PRIVATE_ALL_STATIC_LIBRARIES) \
-  $(PRIVATE_LDFLAGS) \
-  -o $@
-endef
-
-define transform-o-to-aux-executable
-@echo "$(AUX_DISPLAY) Executable: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-$(transform-o-to-aux-executable-inner)
-endef
-
-define transform-o-to-aux-static-executable-inner
-$(hide) $(PRIVATE_CXX_LINK) \
-  -Bstatic \
-  -Wl,--gc-sections \
-  $(PRIVATE_ALL_OBJECTS) \
-  -Wl,--whole-archive \
-  $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
-  -Wl,--no-whole-archive \
-  $(PRIVATE_ALL_STATIC_LIBRARIES) \
-  $(PRIVATE_LDFLAGS) \
-  -Wl,-Map=$(@).map \
-  -o $@
-endef
-
-define transform-o-to-aux-static-executable
-@echo "$(AUX_DISPLAY) StaticExecutable: $(PRIVATE_MODULE) ($@)"
-@mkdir -p $(dir $@)
-$(transform-o-to-aux-static-executable-inner)
-endef
-
 ###########################################################
 ## Commands for running host ar
 ###########################################################
@@ -2093,7 +2004,7 @@
 $(if $(PRIVATE_JAR_EXCLUDE_PACKAGES), $(hide) rm -rf \
     $(foreach pkg, $(PRIVATE_JAR_EXCLUDE_PACKAGES), \
         $(PRIVATE_CLASS_INTERMEDIATES_DIR)/$(subst .,/,$(pkg))))
-$(hide) $(JAR) -cf $@ $(call jar-args-sorted-files-in-directory,$(PRIVATE_CLASS_INTERMEDIATES_DIR))
+$(hide) $(SOONG_ZIP) -jar -o $@ -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) -D $(PRIVATE_CLASS_INTERMEDIATES_DIR)
 $(if $(PRIVATE_EXTRA_JAR_ARGS),$(call add-java-resources-to,$@))
 endef
 
@@ -2552,6 +2463,22 @@
     $(_cmf_dest)))
 endef
 
+# Copy the file only if it's not an ELF file. For use via $(eval).
+# $(1): source file
+# $(2): destination file
+# $(3): message to print on error
+define copy-non-elf-file-checked
+$(2): $(1) $(LLVM_READOBJ)
+	@echo "Copy non-ELF: $$@"
+	$(hide) \
+	    if $(LLVM_READOBJ) -h $$< >/dev/null 2>&1; then \
+	        $(call echo-error,$$@,$(3)); \
+	        $(call echo-error,$$@,found ELF file: $$<); \
+	        false; \
+	    fi
+	$$(copy-file-to-target)
+endef
+
 # The -t option to acp and the -p option to cp is
 # required for OSX.  OSX has a ridiculous restriction
 # where it's an error for a .a file's modification time
diff --git a/core/deprecation.mk b/core/deprecation.mk
index 19bd4cf..2b7a869 100644
--- a/core/deprecation.mk
+++ b/core/deprecation.mk
@@ -29,25 +29,25 @@
 # BUILD_BROKEN_USES_BUILD_* in your BoardConfig.mk in order to turn them back
 # to warnings.
 DEFAULT_ERROR_BUILD_MODULE_TYPES :=$= \
-  BUILD_AUX_EXECUTABLE \
-  BUILD_AUX_STATIC_LIBRARY \
   BUILD_COPY_HEADERS \
   BUILD_HOST_EXECUTABLE \
-  BUILD_HOST_FUZZ_TEST \
-  BUILD_HOST_NATIVE_TEST \
   BUILD_HOST_SHARED_LIBRARY \
   BUILD_HOST_STATIC_LIBRARY \
-  BUILD_HOST_STATIC_TEST_LIBRARY \
-  BUILD_HOST_TEST_CONFIG \
-  BUILD_NATIVE_BENCHMARK \
-  BUILD_STATIC_TEST_LIBRARY \
-  BUILD_TARGET_TEST_CONFIG \
 
 # These are BUILD_* variables that are always errors to reference.
 # Setting the BUILD_BROKEN_USES_BUILD_* variables is also an error.
 OBSOLETE_BUILD_MODULE_TYPES :=$= \
+  BUILD_AUX_EXECUTABLE \
+  BUILD_AUX_STATIC_LIBRARY \
+  BUILD_HOST_FUZZ_TEST \
+  BUILD_HOST_NATIVE_TEST \
   BUILD_HOST_SHARED_TEST_LIBRARY \
+  BUILD_HOST_STATIC_TEST_LIBRARY \
+  BUILD_HOST_TEST_CONFIG \
+  BUILD_NATIVE_BENCHMARK \
   BUILD_SHARED_TEST_LIBRARY \
+  BUILD_STATIC_TEST_LIBRARY \
+  BUILD_TARGET_TEST_CONFIG \
 
 $(foreach m,$(OBSOLETE_BUILD_MODULE_TYPES),\
   $(KATI_obsolete_var $(m),Please convert to Soong) \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index ac3d5cf..6e75a18 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -360,9 +360,6 @@
   HOST_OUT_COMMON_INTERMEDIATES \
   HOST_OUT_FAKE
 
-# Nano environment config
-include $(BUILD_SYSTEM)/aux_config.mk
-
 HOST_CROSS_OUT_INTERMEDIATES := $(HOST_CROSS_OUT)/obj
 HOST_CROSS_OUT_NOTICE_FILES := $(HOST_CROSS_OUT_INTERMEDIATES)/NOTICE_FILES
 .KATI_READONLY := \
@@ -378,9 +375,6 @@
 HOST_CROSS_OUT_GEN := $(HOST_CROSS_OUT)/gen
 .KATI_READONLY := HOST_CROSS_OUT_GEN
 
-HOST_OUT_TEST_CONFIG := $(HOST_OUT)/test_config
-.KATI_READONLY := HOST_OUT_TEST_CONFIG
-
 # Out for HOST_2ND_ARCH
 $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATES := $(HOST_OUT)/obj32
 $(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES := $(HOST_OUT)/lib
@@ -466,7 +460,6 @@
 TARGET_OUT_NOTICE_FILES := $(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES
 TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages
 TARGET_OUT_TESTCASES := $(PRODUCT_OUT)/testcases
-TARGET_OUT_TEST_CONFIG := $(PRODUCT_OUT)/test_config
 .KATI_READONLY := \
   TARGET_OUT_EXECUTABLES \
   TARGET_OUT_OPTIONAL_EXECUTABLES \
@@ -480,8 +473,7 @@
   TARGET_OUT_ETC \
   TARGET_OUT_NOTICE_FILES \
   TARGET_OUT_FAKE \
-  TARGET_OUT_TESTCASES \
-  TARGET_OUT_TEST_CONFIG
+  TARGET_OUT_TESTCASES
 
 ifeq ($(SANITIZE_LITE),true)
 # When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 5021510..da32978 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -99,6 +99,7 @@
     $(NORMALIZE_PATH) \
     $(JAR_ARGS) \
     $(ZIPSYNC) \
+    $(SOONG_ZIP) \
     | $(SOONG_JAVAC_WRAPPER)
 	$(transform-host-java-to-dalvik-package)
 
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
deleted file mode 100644
index 54c6577..0000000
--- a/core/host_fuzz_test.mk
+++ /dev/null
@@ -1,10 +0,0 @@
-################################################
-## A thin wrapper around BUILD_HOST_EXECUTABLE
-## Common flags for host fuzz tests are added.
-################################################
-$(call record-module-type,HOST_FUZZ_TEST)
-
-LOCAL_SANITIZE += fuzzer
-LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 8998d52..f9abe9b 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -90,6 +90,7 @@
     $(ZIPTIME) \
     $(JAR_ARGS) \
     $(ZIPSYNC) \
+    $(SOONG_ZIP) \
     | $(SOONG_JAVAC_WRAPPER)
 	$(transform-host-java-to-package)
 	$(remove-timestamps-from-package)
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
deleted file mode 100644
index aa05bb3..0000000
--- a/core/host_native_test.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-################################################
-## A thin wrapper around BUILD_HOST_EXECUTABLE
-## Common flags for host native tests are added.
-################################################
-$(call record-module-type,HOST_NATIVE_TEST)
-
-ifdef LOCAL_MODULE_CLASS
-ifneq ($(LOCAL_MODULE_CLASS),NATIVE_TESTS)
-$(error $(LOCAL_PATH): LOCAL_MODULE_CLASS must be NATIVE_TESTS with BUILD_HOST_NATIVE_TEST)
-endif
-endif
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-
-include $(BUILD_SYSTEM)/host_test_internal.mk
-
-ifndef LOCAL_MULTILIB
-ifndef LOCAL_32_BIT_ONLY
-LOCAL_MULTILIB := both
-endif
-endif
-
-include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_shared_test_lib.mk b/core/host_shared_test_lib.mk
deleted file mode 100644
index ed7e23a..0000000
--- a/core/host_shared_test_lib.mk
+++ /dev/null
@@ -1 +0,0 @@
-$(error BUILD_HOST_SHARED_TEST_LIBRARY is obsolete)
diff --git a/core/host_static_test_lib.mk b/core/host_static_test_lib.mk
deleted file mode 100644
index a9e39b1..0000000
--- a/core/host_static_test_lib.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-##################################################
-## A thin wrapper around BUILD_HOST_STATIC_LIBRARY
-## Common flags for host native tests are added.
-##################################################
-$(call record-module-type,HOST_STATIC_TEST_LIBRARY)
-
-include $(BUILD_SYSTEM)/host_test_internal.mk
-
-include $(BUILD_SYSTEM)/host_static_library.mk
diff --git a/core/host_test_config.mk b/core/host_test_config.mk
deleted file mode 100644
index b9975e5..0000000
--- a/core/host_test_config.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Common rules for building a TradeFed test XML file for host side tests.
-#
-
-$(call record-module-type,HOST_TEST_CONFIG)
-
-LOCAL_IS_HOST_MODULE := true
-
-include $(BUILD_SYSTEM)/test_config_common.mk
diff --git a/core/host_test_internal.mk b/core/host_test_internal.mk
deleted file mode 100644
index dfe8cf1..0000000
--- a/core/host_test_internal.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#####################################################
-## Shared definitions for all host test compilations.
-#####################################################
-
-ifeq ($(LOCAL_GTEST),true)
-  LOCAL_CFLAGS_linux += -DGTEST_OS_LINUX
-  LOCAL_CFLAGS_darwin += -DGTEST_OS_MAC
-
-  LOCAL_CFLAGS += -DGTEST_HAS_STD_STRING -O0 -g
-
-  LOCAL_STATIC_LIBRARIES += libgtest_main_host libgtest_host
-endif
-
-ifdef LOCAL_MODULE_PATH
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH when building test $(LOCAL_MODULE))
-endif
-
-ifdef LOCAL_MODULE_PATH_32
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_32 when building test $(LOCAL_MODULE))
-endif
-
-ifdef LOCAL_MODULE_PATH_64
-$(error $(LOCAL_PATH): Do not set LOCAL_MODULE_PATH_64 when building test $(LOCAL_MODULE))
-endif
-
-ifndef LOCAL_MODULE_RELATIVE_PATH
-LOCAL_MODULE_RELATIVE_PATH := $(LOCAL_MODULE)
-endif
diff --git a/core/java.mk b/core/java.mk
index 44e005d..6798efa 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -296,6 +296,7 @@
     $(NORMALIZE_PATH) \
     $(JAR_ARGS) \
     $(ZIPSYNC) \
+    $(SOONG_ZIP) \
     | $(SOONG_JAVAC_WRAPPER)
 	@echo "Target Java: $@
 	$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES))
diff --git a/core/link_type.mk b/core/link_type.mk
index f7604ff..ff525cb 100644
--- a/core/link_type.mk
+++ b/core/link_type.mk
@@ -10,7 +10,7 @@
 #   my_link_deps: the dependencies, in the form of <MODULE_CLASS>:<name>
 #
 
-my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross))$(if $(filter AUX,$(my_kind)),-$(AUX_OS_VARIANT)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
+my_link_prefix := LINK_TYPE:$(call find-idf-prefix,$(my_kind),$(my_host_cross)):$(if $(my_common),$(my_common):_,_:$(if $(my_2nd_arch_prefix),$(my_2nd_arch_prefix),_))
 link_type := $(my_link_prefix):$(LOCAL_MODULE_CLASS):$(LOCAL_MODULE)
 ALL_LINK_TYPES := $(ALL_LINK_TYPES) $(link_type)
 $(link_type).TYPE := $(my_link_type)
diff --git a/core/main.mk b/core/main.mk
index 8b85170..151a018 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -344,9 +344,6 @@
 $(error The 'sdk' target may not be specified with any other targets)
 endif
 
-# AUX dependencies are already added by now; remove triggers from the MAKECMDGOALS
-MAKECMDGOALS := $(strip $(filter-out AUX-%,$(MAKECMDGOALS)))
-
 # TODO: this should be eng I think.  Since the sdk is built from the eng
 # variant.
 tags_to_install := debug eng
@@ -830,7 +827,6 @@
 #     - TARGET
 #     - HOST
 #     - HOST_CROSS
-#     - AUX-<variant-name>
 #   3: Whether to use the common intermediates directory or not
 #     - _
 #     - COMMON
@@ -857,14 +853,8 @@
 
 link_type_error :=
 
-define link-type-prefix-base
-$(word 2,$(subst :,$(space),$(1)))
-endef
 define link-type-prefix
-$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,AUX,$(link-type-prefix-base)),$(link-type-prefix-base))
-endef
-define link-type-aux-variant
-$(if $(filter AUX-%,$(link-type-prefix-base)),$(patsubst AUX-%,%,$(link-type-prefix-base)))
+$(word 2,$(subst :,$(space),$(1)))
 endef
 define link-type-common
 $(patsubst _,,$(word 3,$(subst :,$(space),$(1))))
@@ -882,7 +872,7 @@
 $(strip $(eval _p := $(link-type-prefix))\
   $(if $(filter HOST HOST_CROSS,$(_p)),\
     $($(_p)_OS),\
-    $(if $(filter AUX,$(_p)),AUX,android)))
+    android))
 endef
 define link-type-arch
 $($(link-type-prefix)_$(link-type-2ndarchprefix)ARCH)
@@ -1435,9 +1425,6 @@
 .PHONY: vbmetaimage
 vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
 
-.PHONY: auxiliary
-auxiliary: $(INSTALLED_AUX_TARGETS)
-
 # Build files and then package it into the rom formats
 .PHONY: droidcore
 droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \
@@ -1483,7 +1470,6 @@
     $(INSTALLED_FILES_FILE_RECOVERY) \
     $(INSTALLED_FILES_JSON_RECOVERY) \
     $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
-    auxiliary \
     soong_docs
 
 # dist_files only for putting your library into the dist directory with a full build.
diff --git a/core/native_benchmark.mk b/core/native_benchmark.mk
deleted file mode 100644
index 073d8dd..0000000
--- a/core/native_benchmark.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-###########################################
-## A thin wrapper around BUILD_EXECUTABLE
-## Common flags for native benchmarks are added.
-###########################################
-$(call record-module-type,NATIVE_BENCHMARK)
-
-LOCAL_STATIC_LIBRARIES += libgoogle-benchmark
-
-ifndef LOCAL_MULTILIB
-ifndef LOCAL_32_BIT_ONLY
-LOCAL_MULTILIB := both
-endif
-endif
-
-include $(BUILD_EXECUTABLE)
diff --git a/core/ninja_config.mk b/core/ninja_config.mk
index 3f2e5de..1ead512 100644
--- a/core/ninja_config.mk
+++ b/core/ninja_config.mk
@@ -15,7 +15,6 @@
 	$(dont_bother_goals) \
 	all \
 	ECLIPSE-% \
-	AUX-% \
 	brillo_tests \
 	btnod \
 	build-art% \
diff --git a/core/shared_test_lib.mk b/core/shared_test_lib.mk
deleted file mode 100644
index 1ea9fe7..0000000
--- a/core/shared_test_lib.mk
+++ /dev/null
@@ -1 +0,0 @@
-$(error BUILD_SHARED_TEST_LIBRARY is obsolete)
diff --git a/core/soong_droiddoc_prebuilt.mk b/core/soong_droiddoc_prebuilt.mk
index 4e082bf..c0467df 100644
--- a/core/soong_droiddoc_prebuilt.mk
+++ b/core/soong_droiddoc_prebuilt.mk
@@ -12,11 +12,6 @@
 $(LOCAL_MODULE) : $(OUT_DOCS)/$(LOCAL_MODULE)-stubs.srcjar
 endif
 
-ifdef INTERNAL_PLATFORM_API_FILE
-.PHONY: $(LOCAL_MODULE) $(LOCAL_MODULE).txt
-$(LOCAL_MODULE) $(LOCAL_MODULE).txt : $(INTERNAL_PLATFORM_API_FILE) $(INTERNAL_PLATFORM_REMOVED_API_FILE)
-endif
-
 ifdef LOCAL_DROIDDOC_DOC_ZIP
 $(eval $(call copy-one-file,$(LOCAL_DROIDDOC_DOC_ZIP),$(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip))
 $(call dist-for-goals,docs,$(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip)
diff --git a/core/static_test_lib.mk b/core/static_test_lib.mk
deleted file mode 100644
index a0e2970..0000000
--- a/core/static_test_lib.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-#############################################
-## A thin wrapper around BUILD_STATIC_LIBRARY
-## Common flags for native tests are added.
-#############################################
-$(call record-module-type,STATIC_TEST_LIBRARY)
-
-include $(BUILD_SYSTEM)/target_test_internal.mk
-
-include $(BUILD_STATIC_LIBRARY)
diff --git a/core/target_test_config.mk b/core/target_test_config.mk
deleted file mode 100644
index 61f5d2b..0000000
--- a/core/target_test_config.mk
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Common rules for building a TradeFed test XML file for target side tests.
-#
-
-$(call record-module-type,TARGET_TEST_CONFIG)
-
-include $(BUILD_SYSTEM)/test_config_common.mk
diff --git a/core/tasks/vts-core-tests.mk b/core/tasks/vts-core-tests.mk
index 33da020..08663c2 100644
--- a/core/tasks/vts-core-tests.mk
+++ b/core/tasks/vts-core-tests.mk
@@ -28,9 +28,4 @@
 vts: $(compatibility_zip)
 $(call dist-for-goals, vts, $(compatibility_zip))
 
-# TODO(b/149249068): Remove vts-core phony target after it's removed from all
-# builders.
-.PHONY: vts-core
-vts-core: vts
-
 tests: vts
diff --git a/core/test_config_common.mk b/core/test_config_common.mk
deleted file mode 100644
index 487f9f2..0000000
--- a/core/test_config_common.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright (C) 2017 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_MODULE_CLASS := TEST_CONFIG
-
-# Output test config files to testcases directory.
-ifeq (,$(filter general-tests, $(LOCAL_COMPATIBILITY_SUITE)))
-  LOCAL_COMPATIBILITY_SUITE += general-tests
-endif
-
-LOCAL_MODULE_SUFFIX := .config
-
-my_test_config_file := $(wildcard $(LOCAL_PATH)/$(LOCAL_MODULE).xml)
-LOCAL_SRC_FILES :=
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-# The test config is not in a standalone XML file.
-ifndef my_test_config_file
-
-ifndef LOCAL_TEST_CONFIG_OPTIONS
-  $(call pretty-error,LOCAL_TEST_CONFIG_OPTIONS must be set if the test XML file is not provided.)
-endif
-
-my_base_test_config_file := $(LOCAL_PATH)/AndroidTest.xml
-my_test_config_file := $(dir $(LOCAL_BUILT_MODULE))AndroidTest.xml
-
-$(my_test_config_file) : PRIVATE_test_config_options := $(LOCAL_TEST_CONFIG_OPTIONS)
-$(my_test_config_file) : $(my_base_test_config_file)
-	@echo "Create $(notdir $@) with options: $(PRIVATE_test_config_options)."
-	$(eval _option_xml := \
-		$(foreach option,$(PRIVATE_test_config_options), \
-			$(eval p := $(subst :,$(space),$(option))) \
-			<option name="$(word 1,$(p))" value="$(word 2,$(p))" \/>\n))
-	$(hide) sed 's&</configuration>&$(_option_xml)</configuration>&' $< > $@
-
-endif # my_test_config_file
-
-$(LOCAL_BUILT_MODULE) : $(my_test_config_file)
-	$(copy-file-to-target)
-
-my_base_test_config_file :=
-my_test_config_file :=
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 434cbfc..3e5d3a3 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -81,6 +81,7 @@
     framework-res \
     framework-sysconfig.xml \
     fsck_msdos \
+    fsverity-release-cert-der \
     fs_config_files_system \
     fs_config_dirs_system \
     group_system \
@@ -106,7 +107,6 @@
     installd \
     iorapd \
     ip \
-    ip6tables \
     iptables \
     ip-up-vpn \
     javax.obex \
diff --git a/target/product/emulated_storage.mk b/target/product/emulated_storage.mk
index 89de192..d7cc9ce 100644
--- a/target/product/emulated_storage.mk
+++ b/target/product/emulated_storage.mk
@@ -15,7 +15,7 @@
 #
 
 PRODUCT_QUOTA_PROJID := 1
-PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.projid=1
+PRODUCT_PROPERTY_OVERRIDES += external_storage.projid.enabled=1
 
 PRODUCT_FS_CASEFOLD := 1
-PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.casefold=1
+PRODUCT_PROPERTY_OVERRIDES += external_storage.casefold.enabled=1
diff --git a/target/product/security/Android.bp b/target/product/security/Android.bp
index 080706b..5f4f82b 100644
--- a/target/product/security/Android.bp
+++ b/target/product/security/Android.bp
@@ -3,3 +3,11 @@
     name: "aosp-testkey",
     certificate: "testkey",
 }
+
+// Google-owned certificate for CTS testing, since we can't trust arbitrary keys on release devices.
+prebuilt_etc {
+    name: "fsverity-release-cert-der",
+    src: "fsverity-release.x509.der",
+    sub_dir: "security/fsverity",
+    filename_from_src: true,
+}
diff --git a/target/product/security/fsverity-release.x509.der b/target/product/security/fsverity-release.x509.der
new file mode 100644
index 0000000..cd8cd79
--- /dev/null
+++ b/target/product/security/fsverity-release.x509.der
Binary files differ
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 38772cc..5cf4810 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -932,8 +932,8 @@
   return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path)
 
 
-def AddAftlInclusionProof(output_image):
-  """Appends the aftl inclusion proof to the vbmeta image."""
+def ConstructAftlMakeImageCommands(output_image):
+  """Constructs the command to append the aftl image to vbmeta."""
 
   # Ensure the other AFTL parameters are set as well.
   assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.'
@@ -946,17 +946,24 @@
   build_info = BuildInfo(OPTIONS.info_dict)
   version_incremental = build_info.GetBuildProp("ro.build.version.incremental")
   aftltool = OPTIONS.aftl_tool_path
+  server_argument_list = [OPTIONS.aftl_server, OPTIONS.aftl_key_path]
   aftl_cmd = [aftltool, "make_icp_from_vbmeta",
               "--vbmeta_image_path", vbmeta_image,
               "--output", output_image,
               "--version_incremental", version_incremental,
-              "--transparency_log_servers", OPTIONS.aftl_server,
-              "--transparency_log_pub_keys", OPTIONS.aftl_key_path,
+              "--transparency_log_servers", ','.join(server_argument_list),
               "--manufacturer_key", OPTIONS.aftl_manufacturer_key_path,
               "--algorithm", "SHA256_RSA4096",
               "--padding", "4096"]
   if OPTIONS.aftl_signer_helper:
     aftl_cmd.extend(shlex.split(OPTIONS.aftl_signer_helper))
+  return aftl_cmd
+
+
+def AddAftlInclusionProof(output_image):
+  """Appends the aftl inclusion proof to the vbmeta image."""
+
+  aftl_cmd = ConstructAftlMakeImageCommands(output_image)
   RunAndCheckOutput(aftl_cmd)
 
   verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path',
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 7058da7..551f626 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -19,6 +19,7 @@
 import subprocess
 import tempfile
 import time
+import unittest
 import zipfile
 from hashlib import sha1
 
@@ -1431,8 +1432,45 @@
     self.assertEqual('3', chained_partition_args[1])
     self.assertTrue(os.path.exists(chained_partition_args[2]))
 
-  @test_utils.SkipIfExternalToolsUnavailable()
-  def test_BuildVBMeta_appendAftl(self):
+  def test_BuildVBMeta_appendAftlCommandSyntax(self):
+    testdata_dir = test_utils.get_testdata_dir()
+    common.OPTIONS.info_dict = {
+        'ab_update': 'true',
+        'avb_avbtool': 'avbtool',
+        'build.prop': {
+            'ro.build.version.incremental': '6285659',
+            'ro.product.device': 'coral',
+            'ro.build.fingerprint': 'google/coral/coral:R/RP1A.200311.002/'
+                                    '6285659:userdebug/dev-keys'
+        }
+    }
+    common.OPTIONS.aftl_tool_path = 'aftltool'
+    common.OPTIONS.aftl_server = 'log.endpoints.aftl-dev.cloud.goog:9000'
+    common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
+                                                'test_transparency_key.pub')
+    common.OPTIONS.aftl_manufacturer_key_path = os.path.join(
+        testdata_dir, 'test_aftl_rsa4096.pem')
+
+    vbmeta_image = tempfile.NamedTemporaryFile(delete=False)
+    cmd = common.ConstructAftlMakeImageCommands(vbmeta_image.name)
+    expected_cmd = [
+        'aftltool', 'make_icp_from_vbmeta',
+        '--vbmeta_image_path', 'place_holder',
+        '--output', vbmeta_image.name,
+        '--version_incremental', '6285659',
+        '--transparency_log_servers',
+        'log.endpoints.aftl-dev.cloud.goog:9000,{}'.format(
+            common.OPTIONS.aftl_key_path),
+        '--manufacturer_key', common.OPTIONS.aftl_manufacturer_key_path,
+        '--algorithm', 'SHA256_RSA4096',
+        '--padding', '4096']
+
+    # ignore the place holder, i.e. path to a temp file
+    self.assertEqual(cmd[:3], expected_cmd[:3])
+    self.assertEqual(cmd[4:], expected_cmd[4:])
+
+  @unittest.skip("enable after we have a server for public")
+  def test_BuildVBMeta_appendAftlContactServer(self):
     testdata_dir = test_utils.get_testdata_dir()
     common.OPTIONS.info_dict = {
         'ab_update': 'true',