Merge "Add libc++.so as install dependencies for hermetic Python."
diff --git a/android/config.go b/android/config.go
index 7f2a3ac..bc3d4f5 100644
--- a/android/config.go
+++ b/android/config.go
@@ -811,12 +811,12 @@
 	return c.config.productVariables.BoardOdmSepolicyDirs
 }
 
-func (c *deviceConfig) PlatPublicSepolicyDir() string {
-	return c.config.productVariables.BoardPlatPublicSepolicyDir
+func (c *deviceConfig) PlatPublicSepolicyDirs() []string {
+	return c.config.productVariables.BoardPlatPublicSepolicyDirs
 }
 
-func (c *deviceConfig) PlatPrivateSepolicyDir() string {
-	return c.config.productVariables.BoardPlatPrivateSepolicyDir
+func (c *deviceConfig) PlatPrivateSepolicyDirs() []string {
+	return c.config.productVariables.BoardPlatPrivateSepolicyDirs
 }
 
 func (c *config) IntegerOverflowDisabledForPath(path string) bool {
diff --git a/android/variable.go b/android/variable.go
index 6599ca3..af414cb 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -210,10 +210,10 @@
 
 	PgoAdditionalProfileDirs []string `json:",omitempty"`
 
-	BoardVendorSepolicyDirs     []string `json:",omitempty"`
-	BoardOdmSepolicyDirs        []string `json:",omitempty"`
-	BoardPlatPublicSepolicyDir  string   `json:",omitempty"`
-	BoardPlatPrivateSepolicyDir string   `json:",omitempty"`
+	BoardVendorSepolicyDirs      []string `json:",omitempty"`
+	BoardOdmSepolicyDirs         []string `json:",omitempty"`
+	BoardPlatPublicSepolicyDirs  []string `json:",omitempty"`
+	BoardPlatPrivateSepolicyDirs []string `json:",omitempty"`
 
 	VendorVars map[string]map[string]string `json:",omitempty"`
 }
diff --git a/cc/builder.go b/cc/builder.go
index cb09d09..dd1fc05 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -200,8 +200,8 @@
 
 	sAbiDiff = pctx.AndroidRuleFunc("sAbiDiff",
 		func(ctx android.PackageRuleContext) blueprint.RuleParams {
-
-			commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -check-all-apis -o ${out} -new $in -old $referenceDump)"
+			// TODO(b/78139997): Add -check-all-apis back
+			commandStr := "($sAbiDiffer $allowFlags -lib $libName -arch $arch -o ${out} -new $in -old $referenceDump)"
 			distAbiDiffDir := android.PathForDist(ctx, "abidiffs")
 			commandStr += "|| (echo ' ---- Please update abi references by running $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l ${libName} ----'"
 			if distAbiDiffDir.Valid() {
diff --git a/cc/config/arm64_device.go b/cc/config/arm64_device.go
index 73d9e3b..73cee5c 100644
--- a/cc/config/arm64_device.go
+++ b/cc/config/arm64_device.go
@@ -39,7 +39,6 @@
 	arm64Ldflags = []string{
 		"-Wl,-m,aarch64_elf64_le_vec",
 		"-Wl,--hash-style=gnu",
-		"-Wl,--fix-cortex-a53-843419",
 		"-fuse-ld=gold",
 		"-Wl,--icf=safe",
 	}
@@ -177,6 +176,8 @@
 type toolchainArm64 struct {
 	toolchain64Bit
 
+	ldflags              string
+	lldflags             string
 	toolchainCflags      string
 	toolchainClangCflags string
 }
@@ -210,7 +211,7 @@
 }
 
 func (t *toolchainArm64) Ldflags() string {
-	return "${config.Arm64Ldflags}"
+	return t.ldflags
 }
 
 func (t *toolchainArm64) IncludeFlags() string {
@@ -230,11 +231,11 @@
 }
 
 func (t *toolchainArm64) ClangLdflags() string {
-	return "${config.Arm64Ldflags}"
+	return t.ldflags
 }
 
 func (t *toolchainArm64) ClangLldflags() string {
-	return "${config.Arm64Lldflags}"
+	return t.lldflags
 }
 
 func (t *toolchainArm64) ToolchainClangCflags() string {
@@ -258,7 +259,24 @@
 	toolchainClangCflags = append(toolchainClangCflags,
 		variantOrDefault(arm64ClangCpuVariantCflagsVar, arch.CpuVariant))
 
+	var extraLdflags string
+	switch arch.CpuVariant {
+	case "cortex-a53", "cortex-a73", "kryo", "exynos-m1", "exynos-m2",
+		// This variant might not need the workaround but leave it
+		// in the list since it has had the workaround on before.
+		"denver64":
+		extraLdflags = "-Wl,--fix-cortex-a53-843419"
+	}
+
 	return &toolchainArm64{
+		ldflags: strings.Join([]string{
+			"${config.Arm64Ldflags}",
+			extraLdflags,
+		}, " "),
+		lldflags: strings.Join([]string{
+			"${config.Arm64Lldflags}",
+			extraLdflags,
+		}, " "),
 		toolchainCflags:      variantOrDefault(arm64CpuVariantCflagsVar, arch.CpuVariant),
 		toolchainClangCflags: strings.Join(toolchainClangCflags, " "),
 	}
diff --git a/cc/tidy.go b/cc/tidy.go
index 8ca94ef..491cc22 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -83,9 +83,21 @@
 		flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-fno-caret-diagnostics")
 	}
 
-	// We might be using the static analyzer through clang tidy.
-	// https://bugs.llvm.org/show_bug.cgi?id=32914
-	flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-D__clang_analyzer__")
+	extraArgFlags := []string{
+		// We might be using the static analyzer through clang tidy.
+		// https://bugs.llvm.org/show_bug.cgi?id=32914
+		"-D__clang_analyzer__",
+
+		// A recent change in clang-tidy (r328258) enabled destructor inlining, which
+		// appears to cause a number of false positives. Until that's resolved, this turns
+		// off the effects of r328258.
+		// https://bugs.llvm.org/show_bug.cgi?id=37459
+		"-Xclang", "-analyzer-config", "-Xclang", "c++-temp-dtor-inlining=false",
+	}
+
+	for _, f := range extraArgFlags {
+		flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before="+f)
+	}
 
 	tidyChecks := "-checks="
 	if checks := ctx.Config().TidyChecks(); len(checks) > 0 {
diff --git a/java/dex.go b/java/dex.go
index 66e71b5..642dee4 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -238,14 +238,16 @@
 	if useR8 {
 		// TODO(ccross): if this is an instrumentation test of an obfuscated app, use the
 		// dictionary of the app and move the app from libraryjars to injars.
-		j.proguardDictionary = android.PathForModuleOut(ctx, "proguard_dictionary")
+		proguardDictionary := android.PathForModuleOut(ctx, "proguard_dictionary")
+		j.proguardDictionary = proguardDictionary
 		r8Flags, r8Deps := j.r8Flags(ctx, flags)
 		ctx.Build(pctx, android.BuildParams{
-			Rule:        r8,
-			Description: "r8",
-			Output:      javalibJar,
-			Input:       classesJar,
-			Implicits:   r8Deps,
+			Rule:           r8,
+			Description:    "r8",
+			Output:         javalibJar,
+			ImplicitOutput: proguardDictionary,
+			Input:          classesJar,
+			Implicits:      r8Deps,
 			Args: map[string]string{
 				"dxFlags": strings.Join(dxFlags, " "),
 				"r8Flags": strings.Join(r8Flags, " "),
diff --git a/java/proto.go b/java/proto.go
index 3ec2e8a..58b039e 100644
--- a/java/proto.go
+++ b/java/proto.go
@@ -24,6 +24,7 @@
 
 func init() {
 	pctx.HostBinToolVariable("protocCmd", "aprotoc")
+	pctx.HostBinToolVariable("depFixCmd", "dep_fixer")
 }
 
 var (
@@ -31,9 +32,11 @@
 		blueprint.RuleParams{
 			Command: `rm -rf $out.tmp && mkdir -p $out.tmp && ` +
 				`$protocCmd $protoOut=$protoOutParams:$out.tmp --dependency_out=$out.d -I $protoBase $protoFlags $in && ` +
+				`$depFixCmd $out.d && ` +
 				`${config.SoongZipCmd} -jar -o $out -C $out.tmp -D $out.tmp && rm -rf $out.tmp`,
 			CommandDeps: []string{
 				"$protocCmd",
+				"$depFixCmd",
 				"${config.SoongZipCmd}",
 			},
 			Depfile: "${out}.d",
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index f2de2cd..24a8c7a 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -107,6 +107,7 @@
 		productOut("system"),
 		productOut("system_other"),
 		productOut("vendor"),
+		productOut("product"),
 		productOut("oem"),
 		productOut("obj/FAKE"),
 		productOut("breakpad"),