Merge changes from topic "deprecate-zip-apex" into main

* changes:
  apex: Remove host support
  apex: Remove apexPackagingMutator
  apex: Remove 'zip' apex support
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index d6998b6..fec2cdc 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -338,6 +338,7 @@
 		"prebuilts/sdk/current/support":                    Bp2BuildDefaultTrue,
 		"prebuilts/tools":                                  Bp2BuildDefaultTrue,
 		"prebuilts/tools/common/m2":                        Bp2BuildDefaultTrue,
+		"prebuilts/r8":                                     Bp2BuildDefaultTrueRecursively,
 
 		"sdk/dumpeventlog":  Bp2BuildDefaultTrue,
 		"sdk/eventanalyzer": Bp2BuildDefaultTrue,
@@ -1565,6 +1566,14 @@
 		// TODO(b/297070571): cannot convert prebuilts_etc module which possess identical name and src properties
 		"boringssl_self_test.zygote64.rc",
 		"boringssl_self_test.zygote64_32.rc",
+
+		// depends on unconverted module tradefed
+		"HelloWorldPerformanceTest",
+
+		// r8 is a java_binary, which creates an implicit "r8.jar" target, but the
+		// same package contains a "r8.jar" file which gets overshadowed by the implicit target.
+		// We don't need this target as we're not using the Soong wrapper for now
+		"r8",
 	}
 
 	// Bazel prod-mode allowlist. Modules in this list are built by Bazel
diff --git a/android/config.go b/android/config.go
index 7e3bc7a..3e7bb14 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1948,10 +1948,6 @@
 	return c.config.productVariables.BuildBrokenVendorPropertyNamespace
 }
 
-func (c *deviceConfig) BuildBrokenVendorSeappUsesCoredomain() bool {
-	return c.config.productVariables.BuildBrokenVendorSeappUsesCoredomain
-}
-
 func (c *deviceConfig) BuildBrokenInputDir(name string) bool {
 	return InList(name, c.config.productVariables.BuildBrokenInputDirModules)
 }
diff --git a/android/neverallow.go b/android/neverallow.go
index 24031ba..2be6a74 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -60,6 +60,7 @@
 	AddNeverAllowRules(createBp2BuildRule())
 	AddNeverAllowRules(createCcStubsRule())
 	AddNeverAllowRules(createJavaExcludeStaticLibsRule())
+	AddNeverAllowRules(createProhibitHeaderOnlyRule())
 }
 
 // Add a NeverAllow rule to the set of rules to apply.
@@ -264,6 +265,13 @@
 		Because("exclude_static_libs property is only allowed for java modules defined in build/soong, libcore, and frameworks/base/api")
 }
 
+func createProhibitHeaderOnlyRule() Rule {
+	return NeverAllow().
+		Without("name", "framework-minus-apex-headers").
+		With("headers_only", "true").
+		Because("headers_only can only be used for generating framework-minus-apex headers for non-updatable modules")
+}
+
 func neverallowMutator(ctx BottomUpMutatorContext) {
 	m, ok := ctx.Module().(Module)
 	if !ok {
diff --git a/android/neverallow_test.go b/android/neverallow_test.go
index 2a938b8..b2620ef 100644
--- a/android/neverallow_test.go
+++ b/android/neverallow_test.go
@@ -361,6 +361,21 @@
 			`exclude_static_libs property is only allowed for java modules defined in build/soong, libcore, and frameworks/base/api`,
 		},
 	},
+	// Test for only allowing headers_only for framework-minus-apex-headers
+	{
+		name: `"headers_only" outside framework-minus-apex-headers modules`,
+		fs: map[string][]byte{
+			"a/b/Android.bp": []byte(`
+				java_library {
+					name: "baz",
+					headers_only: true,
+				}
+			`),
+		},
+		expectedErrors: []string{
+			`headers_only can only be used for generating framework-minus-apex headers for non-updatable modules`,
+		},
+	},
 }
 
 var prepareForNeverAllowTest = GroupFixturePreparers(
@@ -451,6 +466,7 @@
 	Sdk_version         *string
 	Uncompress_dex      *bool
 	Exclude_static_libs []string
+	Headers_only        *bool
 }
 
 type mockJavaLibraryModule struct {
diff --git a/android/variable.go b/android/variable.go
index 04e407f..ca9a221 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -443,17 +443,16 @@
 
 	ShippingApiLevel *string `json:",omitempty"`
 
-	BuildBrokenPluginValidation          []string `json:",omitempty"`
-	BuildBrokenClangAsFlags              bool     `json:",omitempty"`
-	BuildBrokenClangCFlags               bool     `json:",omitempty"`
-	BuildBrokenClangProperty             bool     `json:",omitempty"`
-	GenruleSandboxing                    *bool    `json:",omitempty"`
-	BuildBrokenEnforceSyspropOwner       bool     `json:",omitempty"`
-	BuildBrokenTrebleSyspropNeverallow   bool     `json:",omitempty"`
-	BuildBrokenUsesSoongPython2Modules   bool     `json:",omitempty"`
-	BuildBrokenVendorPropertyNamespace   bool     `json:",omitempty"`
-	BuildBrokenVendorSeappUsesCoredomain bool     `json:",omitempty"`
-	BuildBrokenInputDirModules           []string `json:",omitempty"`
+	BuildBrokenPluginValidation        []string `json:",omitempty"`
+	BuildBrokenClangAsFlags            bool     `json:",omitempty"`
+	BuildBrokenClangCFlags             bool     `json:",omitempty"`
+	BuildBrokenClangProperty           bool     `json:",omitempty"`
+	GenruleSandboxing                  *bool    `json:",omitempty"`
+	BuildBrokenEnforceSyspropOwner     bool     `json:",omitempty"`
+	BuildBrokenTrebleSyspropNeverallow bool     `json:",omitempty"`
+	BuildBrokenUsesSoongPython2Modules bool     `json:",omitempty"`
+	BuildBrokenVendorPropertyNamespace bool     `json:",omitempty"`
+	BuildBrokenInputDirModules         []string `json:",omitempty"`
 
 	BuildWarningBadOptionalUsesLibsAllowlist []string `json:",omitempty"`
 
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 4c20b50..2f5d8d4 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -258,6 +258,7 @@
 			if a.installable() {
 				fmt.Fprintln(w, "LOCAL_SOONG_INSTALLED_MODULE :=", a.installedFile.String())
 				fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_PAIRS :=", a.outputFile.String()+":"+a.installedFile.String())
+				fmt.Fprintln(w, "LOCAL_SOONG_INSTALL_SYMLINKS := ", strings.Join(a.compatSymlinks.Strings(), " "))
 			}
 
 			// Because apex writes .mk with Custom(), we need to write manually some common properties
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 192255b..1a90c3a 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -235,6 +235,7 @@
 					entries.SetString("LOCAL_MODULE_STEM", p.installFilename)
 					entries.SetPath("LOCAL_SOONG_INSTALLED_MODULE", p.installedFile)
 					entries.SetString("LOCAL_SOONG_INSTALL_PAIRS", p.outputApex.String()+":"+p.installedFile.String())
+					entries.AddStrings("LOCAL_SOONG_INSTALL_SYMLINKS", p.compatSymlinks.Strings()...)
 					entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", !p.installable())
 					entries.AddStrings("LOCAL_OVERRIDES_MODULES", p.prebuiltCommonProperties.Overrides...)
 					p.addRequiredModules(entries)
diff --git a/bp2build/cc_test_conversion_test.go b/bp2build/cc_test_conversion_test.go
index abceac8..76bbb57 100644
--- a/bp2build/cc_test_conversion_test.go
+++ b/bp2build/cc_test_conversion_test.go
@@ -238,7 +238,8 @@
 	runCcTestTestCase(t, ccTestBp2buildTestCase{
 		description: "cc test that defaults to test config AndroidTest.xml",
 		filesystem: map[string]string{
-			"AndroidTest.xml": "",
+			"AndroidTest.xml":   "",
+			"DynamicConfig.xml": "",
 		},
 		blueprint: `
 cc_test {
@@ -253,6 +254,7 @@
 				"srcs":                   `["test.cpp"]`,
 				"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
 				"test_config":            `"AndroidTest.xml"`,
+				"dynamic_config":         `"DynamicConfig.xml"`,
 				"deps": `[
         ":libgtest_main",
         ":libgtest",
diff --git a/cc/config/global.go b/cc/config/global.go
index 61ea0ad..23a05be 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -93,9 +93,6 @@
 		// guide and should not be a warning, at least by default.
 		"-Wno-c99-designator",
 
-		// Many old files still have GNU designator syntax.
-		"-Wno-gnu-designator",
-
 		// Warnings from clang-12
 		"-Wno-gnu-folding-constant",
 
diff --git a/java/androidmk.go b/java/androidmk.go
index 82505e9..b7e2d2f 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -79,6 +79,9 @@
 	} else if !library.ApexModuleBase.AvailableFor(android.AvailableToPlatform) {
 		// Platform variant.  If not available for the platform, we don't need Make module.
 		entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
+	} else if library.properties.Headers_only {
+		// If generating headers only then don't expose to Make.
+		entriesList = append(entriesList, android.AndroidMkEntries{Disabled: true})
 	} else {
 		entriesList = append(entriesList, android.AndroidMkEntries{
 			Class:      "JAVA_LIBRARIES",
diff --git a/java/base.go b/java/base.go
index 4fe093a..2c0b3ea 100644
--- a/java/base.go
+++ b/java/base.go
@@ -192,6 +192,9 @@
 
 	// Additional srcJars tacked in by GeneratedJavaLibraryModule
 	Generated_srcjars []android.Path `android:"mutated"`
+
+	// If true, then only the headers are built and not the implementation jar.
+	Headers_only bool
 }
 
 // Properties that are specific to device modules. Host module factories should not add these when
@@ -574,6 +577,17 @@
 	}
 }
 
+func (j *Module) checkHeadersOnly(ctx android.ModuleContext) {
+	if _, ok := ctx.Module().(android.SdkContext); ok {
+		headersOnly := proptools.Bool(&j.properties.Headers_only)
+		installable := proptools.Bool(j.properties.Installable)
+
+		if headersOnly && installable {
+			ctx.PropertyErrorf("headers_only", "This module has conflicting settings. headers_only is true which, which means this module doesn't generate an implementation jar. However installable is set to true.")
+		}
+	}
+}
+
 func (j *Module) addHostProperties() {
 	j.AddProperties(
 		&j.properties,
@@ -1153,6 +1167,36 @@
 	// final R classes from the app.
 	flags.classpath = append(android.CopyOf(extraClasspathJars), flags.classpath...)
 
+	// If compiling headers then compile them and skip the rest
+	if j.properties.Headers_only {
+		if srcFiles.HasExt(".kt") {
+			ctx.ModuleErrorf("Compiling headers_only with .kt not supported")
+		}
+		if ctx.Config().IsEnvFalse("TURBINE_ENABLED") || disableTurbine {
+			ctx.ModuleErrorf("headers_only is enabled but Turbine is disabled.")
+		}
+
+		_, j.headerJarFile =
+			j.compileJavaHeader(ctx, uniqueJavaFiles, srcJars, deps, flags, jarName,
+				extraCombinedJars)
+		if ctx.Failed() {
+			return
+		}
+
+		ctx.SetProvider(JavaInfoProvider, JavaInfo{
+			HeaderJars:                     android.PathsIfNonNil(j.headerJarFile),
+			TransitiveLibsHeaderJars:       j.transitiveLibsHeaderJars,
+			TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
+			AidlIncludeDirs:                j.exportAidlIncludeDirs,
+			ExportedPlugins:                j.exportedPluginJars,
+			ExportedPluginClasses:          j.exportedPluginClasses,
+			ExportedPluginDisableTurbine:   j.exportedDisableTurbine,
+		})
+
+		j.outputFile = j.headerJarFile
+		return
+	}
+
 	if srcFiles.HasExt(".kt") {
 		// When using kotlin sources turbine is used to generate annotation processor sources,
 		// including for annotation processors that generate API, so we can use turbine for
diff --git a/java/java.go b/java/java.go
index 5f59fe4..fe7f88f 100644
--- a/java/java.go
+++ b/java/java.go
@@ -698,6 +698,7 @@
 	}
 
 	j.checkSdkVersions(ctx)
+	j.checkHeadersOnly(ctx)
 	if ctx.Device() {
 		j.dexpreopter.installPath = j.dexpreopter.getInstallPath(
 			ctx, android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar"))
diff --git a/java/java_test.go b/java/java_test.go
index 6110e21..27933c3 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2370,3 +2370,21 @@
 		t.Errorf("Module output does not contain expected jar %s", "test.jar")
 	}
 }
+
+func TestHeadersOnly(t *testing.T) {
+	ctx, _ := testJava(t, `
+		java_library {
+			name: "foo",
+			srcs: ["a.java"],
+			headers_only: true,
+		}
+	`)
+
+	turbine := ctx.ModuleForTests("foo", "android_common").Rule("turbine")
+	if len(turbine.Inputs) != 1 || turbine.Inputs[0].String() != "a.java" {
+		t.Errorf(`foo inputs %v != ["a.java"]`, turbine.Inputs)
+	}
+
+	javac := ctx.ModuleForTests("foo", "android_common").MaybeRule("javac")
+	android.AssertDeepEquals(t, "javac rule", nil, javac.Rule)
+}
diff --git a/tradefed/autogen_bazel.go b/tradefed/autogen_bazel.go
index 9575f7a..8283984 100644
--- a/tradefed/autogen_bazel.go
+++ b/tradefed/autogen_bazel.go
@@ -39,7 +39,8 @@
 )
 
 type TestConfigAttributes struct {
-	Test_config *bazel.Label
+	Test_config    *bazel.Label
+	Dynamic_config *bazel.Label
 
 	Auto_generate_test_config *bool
 	Template_test_config      *bazel.Label
@@ -58,6 +59,11 @@
 	templateInstallBase *string) TestConfigAttributes {
 
 	attrs := TestConfigAttributes{}
+
+	dynamicConfig := "DynamicConfig.xml"
+	c, _ := android.BazelStringOrLabelFromProp(ctx, &dynamicConfig)
+	attrs.Dynamic_config = c.Value
+
 	attrs.Test_config = GetTestConfig(ctx, testConfig)
 	// do not generate a test config if
 	// 1) test config already found
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index 681ca77..efe7478 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -247,7 +247,6 @@
 		"DEFAULT_ERROR_BUILD_MODULE_TYPES",
 		"BUILD_BROKEN_PREBUILT_ELF_FILES",
 		"BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW",
-		"BUILD_BROKEN_VENDOR_SEAPP_USES_COREDOMAIN",
 		"BUILD_BROKEN_USES_BUILD_COPY_HEADERS",
 		"BUILD_BROKEN_USES_BUILD_EXECUTABLE",
 		"BUILD_BROKEN_USES_BUILD_FUZZ_TEST",