Merge "Add performance counter metrics to build.trace.gz" into main
diff --git a/OWNERS b/OWNERS
index 9221d3e..c52231e 100644
--- a/OWNERS
+++ b/OWNERS
@@ -2,29 +2,29 @@
 # approving build related projects.
 
 # AMER
-agespino@google.com
+agespino@google.com  #{LAST_RESORT_SUGGESTION}
 ccross@android.com
 colefaust@google.com
-cparsons@google.com
-dacek@google.com
-delmerico@google.com
+cparsons@google.com  #{LAST_RESORT_SUGGESTION}
+dacek@google.com  #{LAST_RESORT_SUGGESTION}
+delmerico@google.com  #{LAST_RESORT_SUGGESTION}
 dwillemsen@google.com
-eakammer@google.com
+eakammer@google.com  #{LAST_RESORT_SUGGESTION}
 jihoonkang@google.com
-jobredeaux@google.com
+jobredeaux@google.com  #{LAST_RESORT_SUGGESTION}
 joeo@google.com
-juu@google.com
+juu@google.com  #{LAST_RESORT_SUGGESTION}
 lamontjones@google.com
 mrziwang@google.com
 spandandas@google.com
-tradical@google.com
-usta@google.com
-vinhdaitran@google.com
+tradical@google.com  #{LAST_RESORT_SUGGESTION}
+usta@google.com  #{LAST_RESORT_SUGGESTION}
+vinhdaitran@google.com  #{LAST_RESORT_SUGGESTION}
 weiwli@google.com
 yudiliu@google.com
 
 # APAC
-jingwen@google.com
+jingwen@google.com  #{LAST_RESORT_SUGGESTION}
 
 # EMEA
-lberki@google.com
+lberki@google.com  #{LAST_RESORT_SUGGESTION}
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 5b2519d..07e1f12 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -184,6 +184,7 @@
 		"external/libdrm":                          Bp2BuildDefaultTrue,
 		"external/libevent":                        Bp2BuildDefaultTrueRecursively,
 		"external/libgav1":                         Bp2BuildDefaultTrueRecursively,
+		"external/libdav1d":                        Bp2BuildDefaultTrueRecursively,
 		"external/libhevc":                         Bp2BuildDefaultTrueRecursively,
 		"external/libjpeg-turbo":                   Bp2BuildDefaultTrueRecursively,
 		"external/libmpeg2":                        Bp2BuildDefaultTrueRecursively,
@@ -813,6 +814,7 @@
 		"libcodec2_soft_vp8dec",
 		"libcodec2_soft_vp9dec",
 		"libcodec2_soft_av1dec_gav1",
+		"libcodec2_soft_av1dec_dav1d",
 		"libcodec2_soft_vp8enc",
 		"libcodec2_soft_vp9enc",
 		"libcodec2_soft_rawdec",
@@ -1643,10 +1645,11 @@
 		"libneuralnetworks",
 		"libneuralnetworks_static",
 		// M13: media.swcodec launch
-		"com.android.media.swcodec",
-		"test_com.android.media.swcodec",
-		"libstagefright_foundation",
-		"libcodec2_hidl@1.0",
+		// TODO(b/307389608) Relaunch swcodec after fixing rust dependencies
+		// "com.android.media.swcodec",
+		// "test_com.android.media.swcodec",
+		// "libstagefright_foundation",
+		// "libcodec2_hidl@1.0",
 	}
 
 	// Staging-mode allowlist. Modules in this list are only built
diff --git a/apex/apex_test.go b/apex/apex_test.go
index e70d3af..2bed554 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3882,13 +3882,24 @@
 func vndkLibrariesTxtFiles(vers ...string) (result string) {
 	for _, v := range vers {
 		if v == "current" {
-			for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
+			for _, txt := range []string{"vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
 				result += `
 					` + txt + `_libraries_txt {
 						name: "` + txt + `.libraries.txt",
+						insert_vndk_version: true,
 					}
 				`
 			}
+			result += `
+				llndk_libraries_txt {
+					name: "llndk.libraries.txt",
+				}
+				llndk_libraries_txt_for_apex {
+					name: "llndk.libraries.txt.apex",
+					stem: "llndk.libraries.txt",
+					insert_vndk_version: true,
+				}
+			`
 		} else {
 			for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
 				result += `
diff --git a/bazel/aquery.go b/bazel/aquery.go
index 27ccb20..35942bc 100644
--- a/bazel/aquery.go
+++ b/bazel/aquery.go
@@ -443,26 +443,21 @@
 
 // escapes the args received from aquery and creates a command string
 func commandString(actionEntry *analysis_v2_proto.Action) string {
-	switch actionEntry.Mnemonic {
-	case "GoCompilePkg", "GoStdlib":
-		argsEscaped := []string{}
-		for _, arg := range actionEntry.Arguments {
-			if arg == "" {
-				// If this is an empty string, add ''
-				// And not
-				// 1. (literal empty)
-				// 2. `''\'''\'''` (escaped version of '')
-				//
-				// If we had used (1), then this would appear as a whitespace when we strings.Join
-				argsEscaped = append(argsEscaped, "''")
-			} else {
-				argsEscaped = append(argsEscaped, proptools.ShellEscapeIncludingSpaces(arg))
-			}
+	argsEscaped := make([]string, len(actionEntry.Arguments))
+	for i, arg := range actionEntry.Arguments {
+		if arg == "" {
+			// If this is an empty string, add ''
+			// And not
+			// 1. (literal empty)
+			// 2. `''\'''\'''` (escaped version of '')
+			//
+			// If we had used (1), then this would appear as a whitespace when we strings.Join
+			argsEscaped[i] = "''"
+		} else {
+			argsEscaped[i] = proptools.ShellEscapeIncludingSpaces(arg)
 		}
-		return strings.Join(argsEscaped, " ")
-	default:
-		return strings.Join(proptools.ShellEscapeListIncludingSpaces(actionEntry.Arguments), " ")
 	}
+	return strings.Join(argsEscaped, " ")
 }
 
 func (a *aqueryArtifactHandler) normalActionBuildStatement(actionEntry *analysis_v2_proto.Action) (*BuildStatement, error) {
diff --git a/cc/config/global.go b/cc/config/global.go
index 67ea4fd..892a86c 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -259,6 +259,7 @@
 		"-Werror=fortify-source",
 
 		"-Werror=address-of-temporary",
+		"-Werror=incompatible-function-pointer-types",
 		"-Werror=null-dereference",
 		"-Werror=return-type",
 
@@ -335,10 +336,6 @@
 		"-fcommon",
 		// http://b/191699019
 		"-Wno-format-insufficient-args",
-		// http://b/296321145
-		// Indicates potential memory or stack corruption, so should be changed
-		// to a hard error. Currently triggered by some vendor code.
-		"-Wno-incompatible-function-pointer-types",
 		// http://b/296321508
 		// Introduced in response to a critical security vulnerability and
 		// should be a hard error - it requires only whitespace changes to fix.
@@ -356,7 +353,7 @@
 
 	llvmNextExtraCommonGlobalCflags = []string{
 		// Do not report warnings when testing with the top of trunk LLVM.
-		"-Wno-error",
+		"-Wno-everything",
 	}
 
 	// Flags that must not appear in any command line.
@@ -472,6 +469,7 @@
 		flags := noOverrideGlobalCflags
 		if ctx.Config().IsEnvTrue("LLVM_NEXT") {
 			flags = append(noOverrideGlobalCflags, llvmNextExtraCommonGlobalCflags...)
+			IllegalFlags = []string{} // Don't fail build while testing a new compiler.
 		}
 		return strings.Join(flags, " ")
 	})
diff --git a/cc/library.go b/cc/library.go
index b7688f7..1807bbf 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -2195,7 +2195,7 @@
 
 			// do not install vndk libs
 			// vndk libs are packaged into VNDK APEX
-			if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() {
+			if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() && !ctx.inProduct() {
 				return
 			}
 		} else if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() {
diff --git a/cc/vndk.go b/cc/vndk.go
index 5ac5032..a849455 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -28,10 +28,12 @@
 	"android/soong/snapshot"
 
 	"github.com/google/blueprint"
+	"github.com/google/blueprint/proptools"
 )
 
 const (
 	llndkLibrariesTxt                = "llndk.libraries.txt"
+	llndkLibrariesTxtForApex         = "llndk.libraries.txt.apex"
 	vndkCoreLibrariesTxt             = "vndkcore.libraries.txt"
 	vndkSpLibrariesTxt               = "vndksp.libraries.txt"
 	vndkPrivateLibrariesTxt          = "vndkprivate.libraries.txt"
@@ -40,6 +42,7 @@
 )
 
 func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
+	// Return the list of vndk txt files for the vndk apex of the vndkVersion.
 	if vndkVersion == "current" {
 		// We can assume all txt files are snapshotted if we find one of them.
 		currentVndkSnapshotted := ctx.OtherModuleExists(insertVndkVersion(llndkLibrariesTxt, ctx.DeviceConfig().PlatformVndkVersion()))
@@ -51,20 +54,13 @@
 			vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
 		} else {
 			// Use the txt files generated from the source
-			result := []string{
+			return []string{
+				llndkLibrariesTxtForApex,
 				vndkCoreLibrariesTxt,
 				vndkSpLibrariesTxt,
 				vndkPrivateLibrariesTxt,
 				vndkProductLibrariesTxt,
 			}
-
-			// TODO(b/290159430) This part will not be required once deprecation
-			// of VNDK is handled with 'ro.vndk.version' property
-			if !ctx.Config().IsVndkDeprecated() {
-				result = append(result, llndkLibrariesTxt)
-			}
-
-			return result
 		}
 	}
 
@@ -451,6 +447,7 @@
 
 func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) {
 	ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt", llndkLibrariesTxtFactory)
+	ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt_for_apex", llndkLibrariesTxtApexOnlyFactory)
 	ctx.RegisterParallelSingletonModuleType("vndksp_libraries_txt", vndkSPLibrariesTxtFactory)
 	ctx.RegisterParallelSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory)
 	ctx.RegisterParallelSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory)
@@ -474,22 +471,31 @@
 
 type VndkLibrariesTxtProperties struct {
 	Insert_vndk_version *bool
+	Stem                *string
 }
 
 var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
 var _ android.OutputFileProducer = &vndkLibrariesTxt{}
 
 // llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
-// generated by Soong but can be referenced by other modules.
-// For example, apex_vndk can depend on these files as prebuilt.
+// generated by Soong.
 // Make uses LLNDK_LIBRARIES to determine which libraries to install.
-// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
+// HWASAN is only part of the LLNDK in builds in which libc depends on HWASAN.
 // Therefore, by removing the library here, we cause it to only be installed if libc
 // depends on it.
 func llndkLibrariesTxtFactory() android.SingletonModule {
 	return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "LLNDK_LIBRARIES", "libclang_rt.hwasan")
 }
 
+// llndk_libraries_txt_for_apex is a singleton module that provide the same LLNDK libraries list
+// with the llndk_libraries_txt, but skips setting make variable LLNDK_LIBRARIES. So, it must not
+// be used without installing llndk_libraries_txt singleton.
+// We include llndk_libraries_txt by default to install the llndk.libraries.txt file to system/etc.
+// This singleton module is to install the llndk.libraries.<ver>.txt file to vndk apex.
+func llndkLibrariesTxtApexOnlyFactory() android.SingletonModule {
+	return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "", "libclang_rt.hwasan")
+}
+
 // vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
 // generated by Soong but can be referenced by other modules.
 // For example, apex_vndk can depend on these files as prebuilt.
@@ -557,15 +563,10 @@
 }
 
 func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
-	filename := txt.Name()
+	filename := proptools.StringDefault(txt.properties.Stem, txt.Name())
 
-	shouldInsertVndkVersion := BoolDefault(txt.properties.Insert_vndk_version, true)
-	// llndk.libraries.txt file installed in the system image should not contain version info.
-	if ctx.Config().IsVndkDeprecated() && txt.Name() == llndkLibrariesTxt {
-		shouldInsertVndkVersion = false
-	}
-	if shouldInsertVndkVersion {
-		filename = insertVndkVersion(txt.Name(), ctx.DeviceConfig().PlatformVndkVersion())
+	if Bool(txt.properties.Insert_vndk_version) {
+		filename = insertVndkVersion(filename, ctx.DeviceConfig().PlatformVndkVersion())
 	}
 
 	txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
@@ -592,6 +593,10 @@
 }
 
 func (txt *vndkLibrariesTxt) MakeVars(ctx android.MakeVarsContext) {
+	if txt.makeVarName == "" {
+		return
+	}
+
 	filter := func(modules []string, prefix string) []string {
 		if prefix == "" {
 			return modules
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 3b8f4f5..18cba77 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -91,14 +91,6 @@
 		config:      buildActionConfig,
 		stdio:       stdio,
 		run:         runMake,
-	}, {
-		flag:        "--finalize-bazel-metrics",
-		description: "finalize b metrics and upload",
-		config:      build.UploadOnlyConfig,
-		stdio:       stdio,
-		// Finalize-bazel-metrics mode updates metrics files and calls the metrics
-		// uploader. This marks the end of a b invocation.
-		run: finalizeBazelMetrics,
 	},
 }
 
@@ -199,7 +191,6 @@
 	soongMetricsFile := filepath.Join(logsDir, c.logsPrefix+"soong_metrics")
 	rbeMetricsFile := filepath.Join(logsDir, c.logsPrefix+"rbe_metrics.pb")
 	bp2buildMetricsFile := filepath.Join(logsDir, c.logsPrefix+"bp2build_metrics.pb")
-	bazelMetricsFile := filepath.Join(logsDir, c.logsPrefix+"bazel_metrics.pb")
 	soongBuildMetricsFile := filepath.Join(logsDir, c.logsPrefix+"soong_build_metrics.pb")
 
 	metricsFiles := []string{
@@ -207,7 +198,6 @@
 		rbeMetricsFile,           // high level metrics related to remote build execution.
 		bp2buildMetricsFile,      // high level metrics related to bp2build.
 		soongMetricsFile,         // high level metrics related to this build system.
-		bazelMetricsFile,         // high level metrics related to bazel execution
 		soongBuildMetricsFile,    // high level metrics related to soong build(except bp2build)
 		config.BazelMetricsDir(), // directory that contains a set of bazel metrics.
 	}
@@ -247,10 +237,9 @@
 	soongMetricsFile := filepath.Join(logsDir, logsPrefix+"soong_metrics")
 	bp2buildMetricsFile := filepath.Join(logsDir, logsPrefix+"bp2build_metrics.pb")
 	soongBuildMetricsFile := filepath.Join(logsDir, logsPrefix+"soong_build_metrics.pb")
-	bazelMetricsFile := filepath.Join(logsDir, logsPrefix+"bazel_metrics.pb")
 
 	//Delete the stale metrics files
-	staleFileSlice := []string{buildErrorFile, rbeMetricsFile, soongMetricsFile, bp2buildMetricsFile, soongBuildMetricsFile, bazelMetricsFile}
+	staleFileSlice := []string{buildErrorFile, rbeMetricsFile, soongMetricsFile, bp2buildMetricsFile, soongBuildMetricsFile}
 	if err := deleteStaleMetrics(staleFileSlice); err != nil {
 		log.Fatalln(err)
 	}
@@ -701,28 +690,3 @@
 		ctx.Println("Failed to increase file limit:", err)
 	}
 }
-
-func finalizeBazelMetrics(ctx build.Context, config build.Config, args []string) {
-	updateTotalRealTime(ctx, config, args)
-
-	logsDir := config.LogsDir()
-	logsPrefix := config.GetLogsPrefix()
-	bazelMetricsFile := filepath.Join(logsDir, logsPrefix+"bazel_metrics.pb")
-	bazelProfileFile := filepath.Join(logsDir, logsPrefix+"analyzed_bazel_profile.txt")
-	build.ProcessBazelMetrics(bazelProfileFile, bazelMetricsFile, ctx, config)
-}
-func updateTotalRealTime(ctx build.Context, config build.Config, args []string) {
-	soongMetricsFile := filepath.Join(config.LogsDir(), "soong_metrics")
-
-	//read file into proto
-	data, err := os.ReadFile(soongMetricsFile)
-	if err != nil {
-		ctx.Fatal(err)
-	}
-	met := ctx.ContextImpl.Metrics
-
-	err = met.UpdateTotalRealTimeAndNonZeroExit(data, config.BazelExitCode())
-	if err != nil {
-		ctx.Fatal(err)
-	}
-}
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index b3c662d..ea6be90 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -53,11 +53,6 @@
 		// go/keep-sorted start
 		"AudioFocusControlProtoStub_cc",
 		"AudioFocusControlProtoStub_h",
-		"BlueberryFacadeAndCertGeneratedStub_py",
-		"BlueberryFacadeGeneratedStub_cc",
-		"BlueberryFacadeGeneratedStub_h",
-		"BluetoothGeneratedDumpsysBinarySchema_bfbs",
-		"BluetoothGeneratedDumpsysDataSchema_h",
 		"CompilationTestCases_package-dex-usage",
 		"ControlEnvProxyServerProto_cc",
 		"ControlEnvProxyServerProto_h",
@@ -109,36 +104,12 @@
 		"camera-its",
 		"checkIn-service-stub-lite",
 		"chre_atoms_log.h",
-		"com.android.apex.apkrollback.test.pem",
-		"com.android.apex.apkrollback.test.pubkey",
-		"com.android.apex.cts.shim.debug.pem",
-		"com.android.apex.cts.shim.debug.pubkey",
-		"com.android.apex.cts.shim.pem",
-		"com.android.apex.cts.shim.pubkey",
-		"com.android.apex.cts.shim.v2_no_pb",
-		"com.android.apex.cts.shim.v2_signed_bob",
-		"com.android.apex.cts.shim.v2_signed_bob_rot",
-		"com.android.apex.cts.shim.v2_signed_bob_rot_rollback",
-		"com.android.apex.cts.shim.v2_unsigned_apk_container",
-		"com.android.apex.cts.shim.v3_signed_bob",
-		"com.android.apex.cts.shim.v3_signed_bob_rot",
-		"com.android.apex.cts.shim_not_pre_installed.pem",
-		"com.android.apex.cts.shim_not_pre_installed.pubkey",
-		"com.android.apex.rotation.key.bob.pem",
-		"com.android.apex.rotation.key.bob.pk8",
-		"com.android.apex.rotation.key.bob.rot",
-		"com.android.apex.rotation.key.bob.rot.rollback",
-		"com.android.apex.rotation.key.bob.x509.pem",
 		"com.android.apex.test.bar_stripped",
 		"com.android.apex.test.baz_stripped",
 		"com.android.apex.test.foo_stripped",
 		"com.android.apex.test.pony_stripped",
 		"com.android.apex.test.sharedlibs_generated",
 		"com.android.apex.test.sharedlibs_secondary_generated",
-		"com.android.overlaytest.overlaid.pem",
-		"com.android.overlaytest.overlaid.pubkey",
-		"com.android.overlaytest.overlay.pem",
-		"com.android.overlaytest.overlay.pubkey",
 		"common-profile-text-protos",
 		"core-tests-smali-dex",
 		"cronet_aml_base_android_runtime_jni_headers",
@@ -184,7 +155,6 @@
 		"hidl_java_impl_test_gen",
 		"lib-test-profile-text-protos",
 		"libbssl_sys_src_nostd",
-		"libbt_topshim_facade_py_proto",
 		"libc_musl_sysroot_bits",
 		"libchrome-crypto-include",
 		"libchrome-include",
diff --git a/java/base.go b/java/base.go
index 53f22a7..e1c2386 100644
--- a/java/base.go
+++ b/java/base.go
@@ -1014,8 +1014,16 @@
 	ctx android.ModuleContext, flags javaBuilderFlags, srcFiles android.Paths) javaBuilderFlags {
 	// javac flags.
 	javacFlags := j.properties.Javacflags
+	var needsDebugInfo bool
 
-	if ctx.Config().MinimizeJavaDebugInfo() && !ctx.Host() {
+	needsDebugInfo = false
+	for _, flag := range javacFlags {
+		if strings.HasPrefix(flag, "-g") {
+			needsDebugInfo = true
+		}
+	}
+
+	if ctx.Config().MinimizeJavaDebugInfo() && !ctx.Host() && !needsDebugInfo {
 		// For non-host binaries, override the -g flag passed globally to remove
 		// local variable debug info to reduce disk and memory usage.
 		javacFlags = append(javacFlags, "-g:source,lines")
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 4ad3907..7807889 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1751,11 +1751,9 @@
 		"BroadcastBehavior",
 		"DeprecationMismatch",
 		"HiddenSuperclass",
-		"HiddenTypeParameter",
 		"MissingPermission",
 		"SdkConstant",
 		"Todo",
-		"UnavailableSymbol",
 	}
 	droidstubsArgs = append(droidstubsArgs, android.JoinWithPrefix(disabledWarnings, "--hide "))
 
diff --git a/sysprop/sysprop_library.go b/sysprop/sysprop_library.go
index 13cf68f..fe2cc9c 100644
--- a/sysprop/sysprop_library.go
+++ b/sysprop/sysprop_library.go
@@ -172,6 +172,12 @@
 		// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
 		// Forwarded to cc_library.min_sdk_version
 		Min_sdk_version *string
+
+		// C compiler flags used to build library
+		Cflags []string
+
+		// Linker flags used to build binary
+		Ldflags []string
 	}
 
 	Java struct {
@@ -416,6 +422,8 @@
 	Host_supported     *bool
 	Apex_available     []string
 	Min_sdk_version    *string
+	Cflags             []string
+	Ldflags            []string
 	Bazel_module       struct {
 		Label *string
 	}
@@ -511,6 +519,8 @@
 	ccProps.Host_supported = m.properties.Host_supported
 	ccProps.Apex_available = m.ApexProperties.Apex_available
 	ccProps.Min_sdk_version = m.properties.Cpp.Min_sdk_version
+	ccProps.Cflags = m.properties.Cpp.Cflags
+	ccProps.Ldflags = m.properties.Cpp.Ldflags
 	ccProps.Bazel_module.Label = label
 	ctx.CreateModule(cc.LibraryFactory, &ccProps)
 
diff --git a/ui/build/config.go b/ui/build/config.go
index f227110..5cf6ea8 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -205,34 +205,6 @@
 	return nil
 }
 
-func defaultBazelProdMode(cfg *configImpl) bool {
-	// Environment flag to disable Bazel for users which experience
-	// broken bazel-handled builds, or significant performance regressions.
-	if cfg.IsBazelMixedBuildForceDisabled() {
-		return false
-	}
-	// Darwin-host builds are currently untested with Bazel.
-	if runtime.GOOS == "darwin" {
-		return false
-	}
-	return true
-}
-
-func UploadOnlyConfig(ctx Context, args ...string) Config {
-	ret := &configImpl{
-		environ:       OsEnvironment(),
-		sandboxConfig: &SandboxConfig{},
-	}
-	ret.parseArgs(ctx, args)
-	srcDir := absPath(ctx, ".")
-	bc := os.Getenv("ANDROID_BUILD_ENVIRONMENT_CONFIG")
-	if err := loadEnvConfig(ctx, ret, bc); err != nil {
-		ctx.Fatalln("Failed to parse env config files: %v", err)
-	}
-	ret.metricsUploader = GetMetricsUploader(srcDir, ret.environ)
-	return Config{ret}
-}
-
 func NewConfig(ctx Context, args ...string) Config {
 	ret := &configImpl{
 		environ:               OsEnvironment(),
@@ -240,6 +212,11 @@
 		ninjaWeightListSource: DEFAULT,
 	}
 
+	// Skip soong tests by default on Linux
+	if runtime.GOOS == "linux" {
+		ret.skipSoongTests = true
+	}
+
 	// Default matching ninja
 	ret.parallel = runtime.NumCPU() + 2
 	ret.keepGoing = 1
@@ -772,6 +749,8 @@
 			c.skipConfig = true
 		} else if arg == "--skip-soong-tests" {
 			c.skipSoongTests = true
+		} else if arg == "--no-skip-soong-tests" {
+			c.skipSoongTests = false
 		} else if arg == "--skip-metrics-upload" {
 			c.skipMetricsUpload = true
 		} else if arg == "--mk-metrics" {
@@ -828,16 +807,6 @@
 			}
 		} else if arg == "--ensure-allowlist-integrity" {
 			c.ensureAllowlistIntegrity = true
-		} else if strings.HasPrefix(arg, "--bazel-exit-code=") {
-			bazelExitCodeStr := strings.TrimPrefix(arg, "--bazel-exit-code=")
-			val, err := strconv.Atoi(bazelExitCodeStr)
-			if err == nil {
-				c.bazelExitCode = int32(val)
-			} else {
-				ctx.Fatalf("Error parsing bazel-exit-code", err)
-			}
-		} else if strings.HasPrefix(arg, "--bes-id=") {
-			c.besId = strings.TrimPrefix(arg, "--bes-id=")
 		} else if len(arg) > 0 && arg[0] == '-' {
 			parseArgNum := func(def int) int {
 				if len(arg) > 2 {
@@ -885,9 +854,6 @@
 			c.arguments = append(c.arguments, arg)
 		}
 	}
-	if (!c.bazelProdMode) && (!c.bazelStagingMode) {
-		c.bazelProdMode = defaultBazelProdMode(c)
-	}
 }
 
 func validateNinjaWeightList(weightListFilePath string) (err error) {
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index d68ced8..4a275a8 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -32,7 +32,6 @@
 // of what an event is and how the metrics system is a stack based system.
 
 import (
-	"fmt"
 	"os"
 	"runtime"
 	"strings"
@@ -228,20 +227,6 @@
 	m.metrics.BuildDateTimestamp = proto.Int64(buildTimestamp.UnixNano() / int64(time.Second))
 }
 
-func (m *Metrics) UpdateTotalRealTimeAndNonZeroExit(data []byte, bazelExitCode int32) error {
-	if err := proto.Unmarshal(data, &m.metrics); err != nil {
-		return fmt.Errorf("Failed to unmarshal proto: %w", err)
-	}
-	startTime := *m.metrics.Total.StartTime
-	endTime := uint64(time.Now().UnixNano())
-
-	*m.metrics.Total.RealTime = *proto.Uint64(endTime - startTime)
-
-	bazelError := bazelExitCode != 0
-	m.metrics.NonZeroExit = proto.Bool(bazelError)
-	return nil
-}
-
 // SetBuildCommand adds the build command specified by the user to the
 // list of collected metrics.
 func (m *Metrics) SetBuildCommand(cmd []string) {