Merge "Remove infrastructure to run bp2build" into main
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index fed4190..3c79f19 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -17,6 +17,7 @@
         "aconfig_values.go",
         "aconfig_value_set.go",
         "all_aconfig_declarations.go",
+        "exported_java_aconfig_library.go",
         "init.go",
         "testing.go",
     ],
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index 593ccc0..697dc22 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -211,6 +211,7 @@
 }
 
 func mergeAconfigFiles(ctx android.ModuleContext, inputs android.Paths) android.Paths {
+	inputs = android.LastUniquePaths(inputs)
 	if len(inputs) == 1 {
 		return android.Paths{inputs[0]}
 	}
diff --git a/aconfig/exported_java_aconfig_library.go b/aconfig/exported_java_aconfig_library.go
new file mode 100644
index 0000000..45c5e39
--- /dev/null
+++ b/aconfig/exported_java_aconfig_library.go
@@ -0,0 +1,56 @@
+// Copyright 2023 Google Inc. All rights reserved.
+//
+// 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.
+
+package aconfig
+
+import (
+	"android/soong/android"
+)
+
+func ExportedJavaDeclarationsLibraryFactory() android.Singleton {
+	return &exportedJavaDeclarationsLibrarySingleton{}
+}
+
+type exportedJavaDeclarationsLibrarySingleton struct {
+	intermediatePath android.OutputPath
+}
+
+func (this *exportedJavaDeclarationsLibrarySingleton) GenerateBuildActions(ctx android.SingletonContext) {
+	// Find all of the aconfig_declarations modules
+	var cacheFiles android.Paths
+	ctx.VisitAllModules(func(module android.Module) {
+		if !ctx.ModuleHasProvider(module, DeclarationsProviderKey) {
+			return
+		}
+		decl := ctx.ModuleProvider(module, DeclarationsProviderKey).(DeclarationsProviderData)
+		cacheFiles = append(cacheFiles, decl.IntermediateCacheOutputPath)
+	})
+
+	// Generate build action for aconfig
+	this.intermediatePath = android.PathForIntermediates(ctx, "exported_java_aconfig_library.jar")
+	ctx.Build(pctx, android.BuildParams{
+		Rule:        exportedJavaRule,
+		Inputs:      cacheFiles,
+		Output:      this.intermediatePath,
+		Description: "exported_java_aconfig_library",
+		Args: map[string]string{
+			"cache_files": android.JoinPathsWithPrefix(cacheFiles, " "),
+		},
+	})
+	ctx.Phony("exported_java_aconfig_library", this.intermediatePath)
+}
+
+func (this *exportedJavaDeclarationsLibrarySingleton) MakeVars(ctx android.MakeVarsContext) {
+	ctx.DistForGoalWithFilename("sdk", this.intermediatePath, "android-flags.jar")
+}
diff --git a/aconfig/init.go b/aconfig/init.go
index 72f6bb6..05fab4c 100644
--- a/aconfig/init.go
+++ b/aconfig/init.go
@@ -67,6 +67,20 @@
 			Command:     `${aconfig} dump --dedup --format protobuf --out $out $flags`,
 			CommandDeps: []string{"${aconfig}"},
 		}, "flags")
+	// For exported_java_aconfig_library: Generate a JAR from all
+	// java_aconfig_libraries to be consumed by apps built outside the
+	// platform
+	exportedJavaRule = pctx.AndroidStaticRule("exported_java_aconfig_library",
+		blueprint.RuleParams{
+			Command: `rm -rf ${out}.tmp` +
+				`&& for cache in ${cache_files}; do ${aconfig} create-java-lib --cache $$cache --out ${out}.tmp; done` +
+				`&& $soong_zip -write_if_changed -jar -o ${out} -C ${out}.tmp -D ${out}.tmp` +
+				`&& rm -rf ${out}.tmp`,
+			CommandDeps: []string{
+				"$aconfig",
+				"$soong_zip",
+			},
+		}, "cache_files")
 )
 
 func init() {
@@ -80,4 +94,5 @@
 	ctx.RegisterModuleType("aconfig_values", ValuesFactory)
 	ctx.RegisterModuleType("aconfig_value_set", ValueSetFactory)
 	ctx.RegisterParallelSingletonType("all_aconfig_declarations", AllAconfigDeclarationsFactory)
+	ctx.RegisterParallelSingletonType("exported_java_aconfig_library", ExportedJavaDeclarationsLibraryFactory)
 }
diff --git a/android/config.go b/android/config.go
index 0fec792..312a5da 100644
--- a/android/config.go
+++ b/android/config.go
@@ -187,22 +187,7 @@
 
 // The aconfig value set passed to aconfig, derived from RELEASE_VERSION
 func (c Config) ReleaseAconfigValueSets() []string {
-	// This logic to handle both Soong module name and bazel target is temporary in order to
-	// provide backward compatibility where aosp and internal both have the release
-	// aconfig value set but can't be updated at the same time to use bazel target
-	var valueSets []string
-	for _, valueSet := range c.config.productVariables.ReleaseAconfigValueSets {
-		value := strings.Split(valueSet, ":")
-		valueLen := len(value)
-		if valueLen > 2 {
-			// This shouldn't happen as this should be either a module name or a bazel target path.
-			panic(fmt.Errorf("config file: invalid value for release aconfig value sets: %s", valueSet))
-		}
-		if valueLen > 0 {
-			valueSets = append(valueSets, value[valueLen-1])
-		}
-	}
-	return valueSets
+	return c.config.productVariables.ReleaseAconfigValueSets
 }
 
 // The flag default permission value passed to aconfig
diff --git a/apex/apex.go b/apex/apex.go
index a4dc7f1..38a166e 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1970,6 +1970,7 @@
 				fi := apexFileForRustLibrary(ctx, ch)
 				fi.isJniLib = isJniLib
 				vctx.filesInfo = append(vctx.filesInfo, fi)
+				addAconfigFiles(vctx, ctx, child)
 				return true // track transitive dependencies
 			default:
 				ctx.PropertyErrorf(propertyName, "%q is not a cc_library or cc_library_shared module", depName)
@@ -1982,6 +1983,7 @@
 				return true // track transitive dependencies
 			case *rust.Module:
 				vctx.filesInfo = append(vctx.filesInfo, apexFileForRustExecutable(ctx, ch))
+				addAconfigFiles(vctx, ctx, child)
 				return true // track transitive dependencies
 			default:
 				ctx.PropertyErrorf("binaries",
@@ -2189,7 +2191,6 @@
 			}
 
 			vctx.filesInfo = append(vctx.filesInfo, af)
-			addAconfigFiles(vctx, ctx, child)
 			return true // track transitive dependencies
 		} else if rm, ok := child.(*rust.Module); ok {
 			af := apexFileForRustLibrary(ctx, rm)
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 2ed053e..abf6b15 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10897,9 +10897,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_foo"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -10910,9 +10908,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_bar"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -10927,9 +10923,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_foo",
 			aconfig_declarations: "my_aconfig_declarations_foo",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -10944,9 +10938,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_bar",
 			aconfig_declarations: "my_aconfig_declarations_bar",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11001,9 +10993,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_foo"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11011,10 +11001,11 @@
 		cc_library {
 			name: "my_cc_library_bar",
 			srcs: ["foo/bar/MyClass.cc"],
-			static_libs: ["my_cc_aconfig_library_bar"],
-			// TODO: remove //apex_available:platform
+			static_libs: [
+				"my_cc_aconfig_library_bar",
+				"my_cc_aconfig_library_baz",
+			],
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11023,9 +11014,7 @@
 			name: "my_cc_binary_baz",
 			srcs: ["foo/bar/MyClass.cc"],
 			static_libs: ["my_cc_aconfig_library_baz"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11040,9 +11029,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_foo",
 			aconfig_declarations: "my_aconfig_declarations_foo",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11057,9 +11044,7 @@
 		cc_aconfig_library {
 			name: "my_cc_aconfig_library_bar",
 			aconfig_declarations: "my_aconfig_declarations_bar",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11074,9 +11059,7 @@
 		cc_aconfig_library {
 			name: "my_cc_aconfig_library_baz",
 			aconfig_declarations: "my_aconfig_declarations_baz",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11116,6 +11099,151 @@
 	ensureContains(t, buildParams.Output.String(), "android_common_myapex/aconfig_flags.pb")
 }
 
+func TestAconfigFilesRustDeps(t *testing.T) {
+	ctx := testApex(t, apex_default_bp+`
+		apex {
+			name: "myapex",
+			manifest: ":myapex.manifest",
+			androidManifest: ":myapex.androidmanifest",
+			key: "myapex.key",
+			native_shared_libs: [
+				"libmy_rust_library",
+			],
+			binaries: [
+				"my_rust_binary",
+			],
+			rust_dyn_libs: [
+				"libmy_rust_dylib",
+			],
+			updatable: false,
+		}
+
+		rust_library {
+			name: "libflags_rust", // test mock
+			crate_name: "flags_rust",
+			srcs: ["lib.rs"],
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_library {
+			name: "liblazy_static", // test mock
+			crate_name: "lazy_static",
+			srcs: ["src/lib.rs"],
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_ffi_shared {
+			name: "libmy_rust_library",
+			srcs: ["src/lib.rs"],
+			rustlibs: ["libmy_rust_aconfig_library_foo"],
+			crate_name: "my_rust_library",
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_library_dylib {
+			name: "libmy_rust_dylib",
+			srcs: ["foo/bar/MyClass.rs"],
+			rustlibs: ["libmy_rust_aconfig_library_bar"],
+			crate_name: "my_rust_dylib",
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_binary {
+			name: "my_rust_binary",
+			srcs: ["foo/bar/MyClass.rs"],
+			rustlibs: [
+				"libmy_rust_aconfig_library_baz",
+				"libmy_rust_dylib",
+			],
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		aconfig_declarations {
+			name: "my_aconfig_declarations_foo",
+			package: "com.example.package",
+			container: "myapex",
+			srcs: ["foo.aconfig"],
+		}
+
+		aconfig_declarations {
+			name: "my_aconfig_declarations_bar",
+			package: "com.example.package",
+			container: "myapex",
+			srcs: ["bar.aconfig"],
+		}
+
+		aconfig_declarations {
+			name: "my_aconfig_declarations_baz",
+			package: "com.example.package",
+			container: "myapex",
+			srcs: ["baz.aconfig"],
+		}
+
+		rust_aconfig_library {
+			name: "libmy_rust_aconfig_library_foo",
+			aconfig_declarations: "my_aconfig_declarations_foo",
+			crate_name: "my_rust_aconfig_library_foo",
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_aconfig_library {
+			name: "libmy_rust_aconfig_library_bar",
+			aconfig_declarations: "my_aconfig_declarations_bar",
+			crate_name: "my_rust_aconfig_library_bar",
+			apex_available: [
+				"myapex",
+			],
+		}
+
+		rust_aconfig_library {
+			name: "libmy_rust_aconfig_library_baz",
+			aconfig_declarations: "my_aconfig_declarations_baz",
+			crate_name: "my_rust_aconfig_library_baz",
+			apex_available: [
+				"myapex",
+			],
+		}
+	`)
+
+	mod := ctx.ModuleForTests("myapex", "android_common_myapex")
+	s := mod.Rule("apexRule").Args["copy_commands"]
+	copyCmds := regexp.MustCompile(" *&& *").Split(s, -1)
+	if len(copyCmds) != 23 {
+		t.Fatalf("Expected 23 commands, got %d in:\n%s", len(copyCmds), s)
+	}
+
+	ensureMatches(t, copyCmds[22], "^cp -f .*/aconfig_flags.pb .*/image.apex$")
+
+	combineAconfigRule := mod.Rule("All_aconfig_declarations_dump")
+	s = " " + combineAconfigRule.Args["cache_files"]
+	aconfigArgs := regexp.MustCompile(" --cache ").Split(s, -1)[1:]
+	if len(aconfigArgs) != 2 {
+		t.Fatalf("Expected 2 commands, got %d in:\n%s", len(aconfigArgs), s)
+	}
+	android.EnsureListContainsSuffix(t, aconfigArgs, "my_aconfig_declarations_foo/intermediate.pb")
+	android.EnsureListContainsSuffix(t, aconfigArgs, "my_rust_binary/android_arm64_armv8-a_apex10000/aconfig_merged.pb")
+
+	buildParams := combineAconfigRule.BuildParams
+	if len(buildParams.Inputs) != 2 {
+		t.Fatalf("Expected 3 input, got %d", len(buildParams.Inputs))
+	}
+	android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_aconfig_declarations_foo/intermediate.pb")
+	android.EnsureListContainsSuffix(t, buildParams.Inputs.Strings(), "my_rust_binary/android_arm64_armv8-a_apex10000/aconfig_merged.pb")
+	ensureContains(t, buildParams.Output.String(), "android_common_myapex/aconfig_flags.pb")
+}
+
 func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) {
 	ctx := testApex(t, apex_default_bp+`
 		apex {
@@ -11136,9 +11264,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_foo"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11149,9 +11275,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["other_java_aconfig_library_bar"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11166,9 +11290,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_foo",
 			aconfig_declarations: "my_aconfig_declarations_foo",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11183,9 +11305,7 @@
 		java_aconfig_library {
 			name: "other_java_aconfig_library_bar",
 			aconfig_declarations: "other_aconfig_declarations_bar",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11228,9 +11348,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_foo"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11241,9 +11359,7 @@
 			sdk_version: "none",
 			system_modules: "none",
 			static_libs: ["my_java_aconfig_library_bar"],
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11258,9 +11374,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_foo",
 			aconfig_declarations: "my_aconfig_declarations_foo",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
@@ -11268,9 +11382,7 @@
 		java_aconfig_library {
 			name: "my_java_aconfig_library_bar",
 			aconfig_declarations: "my_aconfig_declarations_foo",
-			// TODO: remove //apex_available:platform
 			apex_available: [
-				"//apex_available:platform",
 				"myapex",
 			],
 		}
diff --git a/cc/binary.go b/cc/binary.go
index ebe672b..61541ad 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -445,6 +445,10 @@
 	return binary.unstrippedOutputFile
 }
 
+func (binary *binaryDecorator) strippedAllOutputFilePath() android.Path {
+	panic("Not implemented.")
+}
+
 func (binary *binaryDecorator) setSymlinkList(ctx ModuleContext) {
 	for _, symlink := range binary.Properties.Symlinks {
 		binary.symlinks = append(binary.symlinks,
diff --git a/cc/builder.go b/cc/builder.go
index 69cf75b..e4d5be2 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -1052,6 +1052,9 @@
 	if flags.StripKeepSymbolsAndDebugFrame {
 		args += " --keep-symbols-and-debug-frame"
 	}
+	if ctx.Windows() {
+		args += " --windows"
+	}
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        strip,
diff --git a/cc/cc.go b/cc/cc.go
index 12db797..7a06128 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -617,6 +617,7 @@
 	link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
 	appendLdflags([]string)
 	unstrippedOutputFilePath() android.Path
+	strippedAllOutputFilePath() android.Path
 
 	nativeCoverage() bool
 	coverageOutputFilePath() android.OptionalPath
@@ -3634,6 +3635,11 @@
 			return android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), nil
 		}
 		return nil, nil
+	case "stripped_all":
+		if c.linker != nil {
+			return android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), nil
+		}
+		return nil, nil
 	default:
 		return nil, fmt.Errorf("unsupported module reference tag %q", tag)
 	}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index a1842d7..3631f19 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -4758,3 +4758,29 @@
 		})
 	}
 }
+
+func TestStrippedAllOutputFile(t *testing.T) {
+	t.Parallel()
+	bp := `
+		cc_library {
+			name: "test_lib",
+			srcs: ["test_lib.cpp"],
+			dist: {
+				targets: [ "dist_target" ],
+				tag: "stripped_all",
+			}
+		}
+ `
+	config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
+	ctx := testCcWithConfig(t, config)
+	module := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared").Module()
+	outputFile, err := module.(android.OutputFileProducer).OutputFiles("stripped_all")
+	if err != nil {
+		t.Errorf("Expected cc_library to produce output files, error: %s", err)
+		return
+	}
+	if !strings.HasSuffix(outputFile.Strings()[0], "/stripped_all/test_lib.so") {
+		t.Errorf("Unexpected output file: %s", outputFile.Strings()[0])
+		return
+	}
+}
diff --git a/cc/library.go b/cc/library.go
index 2aa0b1b..4d5a254 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -400,6 +400,8 @@
 
 	// Location of the linked, unstripped library for shared libraries
 	unstrippedOutputFile android.Path
+	// Location of the linked, stripped library for shared libraries, strip: "all"
+	strippedAllOutputFile android.Path
 
 	// Location of the file that should be copied to dist dir when requested
 	distFile android.Path
@@ -1201,6 +1203,17 @@
 		}
 	}
 
+	// Generate an output file for dist as if strip: "all" is set on the module.
+	// Currently this is for layoutlib release process only.
+	for _, dist := range ctx.Module().(*Module).Dists() {
+		if dist.Tag != nil && *dist.Tag == "stripped_all" {
+			strippedAllOutputFile := android.PathForModuleOut(ctx, "stripped_all", fileName)
+			transformStrip(ctx, outputFile, strippedAllOutputFile, StripFlags{Toolchain: flags.Toolchain})
+			library.strippedAllOutputFile = strippedAllOutputFile
+			break
+		}
+	}
+
 	sharedLibs := deps.EarlySharedLibs
 	sharedLibs = append(sharedLibs, deps.SharedLibs...)
 	sharedLibs = append(sharedLibs, deps.LateSharedLibs...)
@@ -1262,6 +1275,10 @@
 	return library.unstrippedOutputFile
 }
 
+func (library *libraryDecorator) strippedAllOutputFilePath() android.Path {
+	return library.strippedAllOutputFile
+}
+
 func (library *libraryDecorator) disableStripping() {
 	library.stripper.StripProperties.Strip.None = BoolPtr(true)
 }
diff --git a/cc/object.go b/cc/object.go
index b9c40d8..0dba99f 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -219,6 +219,10 @@
 	return nil
 }
 
+func (object *objectLinker) strippedAllOutputFilePath() android.Path {
+	panic("Not implemented.")
+}
+
 func (object *objectLinker) nativeCoverage() bool {
 	return true
 }
diff --git a/genrule/allowlists.go b/genrule/allowlists.go
index 926d6c0..8abf73e 100644
--- a/genrule/allowlists.go
+++ b/genrule/allowlists.go
@@ -32,7 +32,6 @@
 
 	SandboxingDenyPathList = []string{
 		// go/keep-sorted start
-		"art/test",
 		// go/keep-sorted end
 	}
 )
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 97f14d7..ffdd890 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -508,7 +508,7 @@
 						if len(paths) == 0 {
 							return reportError("label %q has no files", label)
 						}
-						return proptools.ShellEscape(strings.Join(paths, " ")), nil
+						return strings.Join(proptools.ShellEscapeList(paths), " "), nil
 					} else {
 						return reportError("unknown locations label %q is not in srcs, out, tools or tool_files.", label)
 					}
diff --git a/java/app.go b/java/app.go
index ee82a32..d5c4eba 100755
--- a/java/app.go
+++ b/java/app.go
@@ -139,6 +139,12 @@
 	// PRODUCT_CHARACTERISTICS.
 	Generate_product_characteristics_rro *bool
 
+	// A list of files or dependencies to make available to the build sandbox. This is
+	// useful if source files are symlinks, the targets of the symlinks must be listed here.
+	// Note that currently not all actions implemented by android_apps are sandboxed, so you
+	// may only see this being necessary in lint builds.
+	Compile_data []string
+
 	ProductCharacteristicsRROPackageName        *string `blueprint:"mutated"`
 	ProductCharacteristicsRROManifestModuleName *string `blueprint:"mutated"`
 }
@@ -818,6 +824,7 @@
 	a.linter.mergedManifest = a.aapt.mergedManifestFile
 	a.linter.manifest = a.aapt.manifestPath
 	a.linter.resources = a.aapt.resourceFiles
+	a.linter.compile_data = android.PathsForModuleSrc(ctx, a.appProperties.Compile_data)
 	a.linter.buildModuleReportZip = ctx.Config().UnbundledBuildApps()
 
 	dexJarFile, packageResources := a.dexBuildActions(ctx)
diff --git a/java/lint.go b/java/lint.go
index 34720e5..eb46ea8 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -93,6 +93,7 @@
 	outputs                 lintOutputs
 	properties              LintProperties
 	extraMainlineLintErrors []string
+	compile_data            android.Paths
 
 	reports android.Paths
 
@@ -448,7 +449,7 @@
 
 	srcsList := android.PathForModuleOut(ctx, "lint", "lint-srcs.list")
 	srcsListRsp := android.PathForModuleOut(ctx, "lint-srcs.list.rsp")
-	rule.Command().Text("cp").FlagWithRspFileInputList("", srcsListRsp, l.srcs).Output(srcsList)
+	rule.Command().Text("cp").FlagWithRspFileInputList("", srcsListRsp, l.srcs).Output(srcsList).Implicits(l.compile_data)
 
 	lintPaths := l.writeLintProjectXML(ctx, rule, srcsList)
 
@@ -491,6 +492,7 @@
 
 	cmd.BuiltTool("lint").ImplicitTool(ctx.Config().HostJavaToolPath(ctx, "lint.jar")).
 		Flag("--quiet").
+		Flag("--include-aosp-issues").
 		FlagWithInput("--project ", lintPaths.projectXML).
 		FlagWithInput("--config ", lintPaths.configXML).
 		FlagWithOutput("--html ", html).
diff --git a/java/lint_defaults.txt b/java/lint_defaults.txt
index 8494d02..b8ce95c 100644
--- a/java/lint_defaults.txt
+++ b/java/lint_defaults.txt
@@ -122,10 +122,10 @@
 --warning_check RemoteViewLayout
 --warning_check SupportAnnotationUsage
 --warning_check UniqueConstants
-
-# TODO(b/294098365): these checks fail in AOSP, but pass downstream
---warning_check ForegroundServiceType
---warning_check MutableImplicitPendingIntent
+--warning_check UseSdkSuppress
+# TODO(b/303434307) The intent is for this to be set to error severity
+# once existing violations are cleaned up
+--warning_check FlaggedApi
 
 --warning_check ExactAlarm
 --warning_check ExpiredTargetSdkVersion
diff --git a/scripts/strip.sh b/scripts/strip.sh
index 71cb1c6..8d69f0d 100755
--- a/scripts/strip.sh
+++ b/scripts/strip.sh
@@ -29,6 +29,7 @@
 #   --keep-symbols
 #   --keep-symbols-and-debug-frame
 #   --remove-build-id
+#   --windows
 
 set -o pipefail
 
@@ -43,6 +44,7 @@
         --keep-symbols                  Keep symbols in out-file
         --keep-symbols-and-debug-frame  Keep symbols and .debug_frame in out-file
         --remove-build-id               Remove the gnu build-id section in out-file
+        --windows                       Input file is Windows DLL or executable
 EOF
     exit 1
 }
@@ -50,7 +52,11 @@
 do_strip() {
     # GNU strip --strip-all does not strip .ARM.attributes,
     # so we tell llvm-strip to keep it too.
-    "${CLANG_BIN}/llvm-strip" --strip-all --keep-section=.ARM.attributes "${infile}" -o "${outfile}.tmp"
+    local keep_section=--keep-section=.ARM.attributes
+    if [ -n "${windows}" ]; then
+      keep_section=
+    fi
+    "${CLANG_BIN}/llvm-strip" --strip-all ${keep_section} "${infile}" -o "${outfile}.tmp"
 }
 
 do_strip_keep_symbols_and_debug_frame() {
@@ -149,6 +155,7 @@
                 keep-symbols) keep_symbols=true ;;
                 keep-symbols-and-debug-frame) keep_symbols_and_debug_frame=true ;;
                 remove-build-id) remove_build_id=true ;;
+                windows) windows=true ;;
                 *) echo "Unknown option --${OPTARG}"; usage ;;
             esac;;
         ?) usage ;;
diff --git a/testing/code_metadata_internal_proto/go.mod b/testing/code_metadata_internal_proto/go.mod
deleted file mode 100644
index 7e9129d..0000000
--- a/testing/code_metadata_internal_proto/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module android/soong/testing/code_metadata_internal_proto
-
-go 1.18
diff --git a/testing/code_metadata_proto/go.mod b/testing/code_metadata_proto/go.mod
deleted file mode 100644
index ada2411..0000000
--- a/testing/code_metadata_proto/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module android/soong/testing/code_metadata_proto
-
-go 1.18
diff --git a/testing/test_spec_proto/go.mod b/testing/test_spec_proto/go.mod
deleted file mode 100644
index b581aac..0000000
--- a/testing/test_spec_proto/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module android/soong/testing/test_spec_proto
-
-go 1.18
diff --git a/ui/status/ninja.go b/ui/status/ninja.go
index 1e97908..f4e3fb8 100644
--- a/ui/status/ninja.go
+++ b/ui/status/ninja.go
@@ -194,7 +194,7 @@
 
 			if estimatedDuration > 0 {
 				n.status.SetEstimatedTime(time.Now().Add(estimatedDuration))
-				n.status.Verbose(fmt.Sprintf("parallelism: %d, estimiated from total time: %s, critical path time: %s",
+				n.status.Verbose(fmt.Sprintf("parallelism: %d, estimated from total time: %s, critical path time: %s",
 					parallelism,
 					estimatedDurationFromTotal,
 					estimatedDurationFromCriticalPath))