Merge "Changes.md: Format section BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES"
diff --git a/core/binary.mk b/core/binary.mk
index a70a047..6c1c4db 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -71,12 +71,8 @@
   my_pool := $(GOMA_OR_RBE_POOL)
 endif
 
-# TODO(b/158212027): Remove `$(COVERAGE_PATHS)` from this condition when all users have been moved
-# to `NATIVE_COVERAGE_PATHS`.
-ifneq (,$(strip $(foreach dir,$(COVERAGE_PATHS) $(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
-# TODO(b/158212027): Remove `$(COVERAGE_EXCLUDE_PATHS)` from this condition when all users have been
-# moved to `NATIVE_COVERAGE_EXCLUDE_PATHS`.
-ifeq (,$(strip $(foreach dir,$(COVERAGE_EXCLUDE_PATHS) $(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
+ifneq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
+ifeq (,$(strip $(foreach dir,$(NATIVE_COVERAGE_EXCLUDE_PATHS),$(filter $(dir)%,$(LOCAL_PATH)))))
   my_native_coverage := true
 else
   my_native_coverage := false
diff --git a/core/config.mk b/core/config.mk
index a5b8ef7..5092e90 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -151,6 +151,8 @@
 $(KATI_obsolete_var TARGET_PREFER_32_BIT TARGET_PREFER_32_BIT_APPS TARGET_PREFER_32_BIT_EXECUTABLES)
 $(KATI_obsolete_var PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST.)
 $(KATI_obsolete_var PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST,Use PRODUCT_ARTIFACT_PATH_REQUIREMENT_ALLOWED_LIST.)
+$(KATI_obsolete_var COVERAGE_PATHS,Use NATIVE_COVERAGE_PATHS instead)
+$(KATI_obsolete_var COVERAGE_EXCLUDE_PATHS,Use NATIVE_COVERAGE_EXCLUDE_PATHS instead)
 
 # Used to force goals to build.  Only use for conditionally defined goals.
 .PHONY: FORCE
diff --git a/core/main.mk b/core/main.mk
index 2a0d847..c2287bb 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -102,16 +102,6 @@
 EMMA_INSTRUMENT := true
 endif
 
-# TODO(b/158212027): Remove this when we are certain these assertions are not
-# breaking any continuous build; then turn `COVERAGE_PATHS` and
-# `COVERAGE_EXCLUDE_PATHS` into kati obsolete variables.
-ifneq ($(COVERAGE_PATHS),)
-  $(error Variable COVERAGE_PATHS is obsolete. Use NATIVE_COVERAGE_PATHS instead)
-endif
-ifneq ($(COVERAGE_EXCLUDE_PATHS),)
-  $(error Variable COVERAGE_EXCLUDE_PATHS is obsolete. Use NATIVE_COVERAGE_EXCLUDE_PATHS instead)
-endif
-
 ifeq (true,$(EMMA_INSTRUMENT))
 # Adding the jacoco library can cause the inclusion of
 # some typically banned classes
diff --git a/core/soong_config.mk b/core/soong_config.mk
index b9e7a27..bc0dc6e 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -116,12 +116,8 @@
 
 $(call add_json_bool, GcovCoverage,                      $(filter true,$(NATIVE_COVERAGE)))
 $(call add_json_bool, ClangCoverage,                     $(filter true,$(CLANG_COVERAGE)))
-# TODO(b/158212027): Remove `$(COVERAGE_PATHS)` from this list when all users have been moved to
-# `NATIVE_COVERAGE_PATHS`.
-$(call add_json_list, NativeCoveragePaths,               $(COVERAGE_PATHS) $(NATIVE_COVERAGE_PATHS))
-# TODO(b/158212027): Remove `$(COVERAGE_EXCLUDE_PATHS)` from this list when all users have been
-# moved to `NATIVE_COVERAGE_EXCLUDE_PATHS`.
-$(call add_json_list, NativeCoverageExcludePaths,        $(COVERAGE_EXCLUDE_PATHS) $(NATIVE_COVERAGE_EXCLUDE_PATHS))
+$(call add_json_list, NativeCoveragePaths,               $(NATIVE_COVERAGE_PATHS))
+$(call add_json_list, NativeCoverageExcludePaths,        $(NATIVE_COVERAGE_EXCLUDE_PATHS))
 
 $(call add_json_bool, SamplingPGO,                       $(filter true,$(SAMPLING_PGO)))
 
diff --git a/rbesetup.sh b/rbesetup.sh
index 145e1e8..f9317a3 100644
--- a/rbesetup.sh
+++ b/rbesetup.sh
@@ -23,3 +23,14 @@
   RBE_re_proxy="${RBE_BINARIES_DIR}/reproxy" \
   $@
 }
+
+# This function detects if the uploader is available and sets the path of it to
+# ANDROID_ENABLE_METRICS_UPLOAD.
+function _export_metrics_uploader() {
+  local uploader_path="$(gettop)/vendor/google/misc/metrics_uploader_prebuilt/metrics_uploader.sh"
+  if [ -x "${uploader_path}" ]; then
+    export ANDROID_ENABLE_METRICS_UPLOAD="${uploader_path}"
+  fi
+}
+
+_export_metrics_uploader