Merge "Support Mac 10.14 SDK"
diff --git a/android/module.go b/android/module.go
index a058199..77765f1 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1067,6 +1067,16 @@
 	return a.kind == productServicesSpecificModule
 }
 
+// Makes this module a platform module, i.e. not specific to soc, device,
+// product, or product_services.
+func (a *ModuleBase) MakeAsPlatform() {
+	a.commonProperties.Vendor = boolPtr(false)
+	a.commonProperties.Proprietary = boolPtr(false)
+	a.commonProperties.Soc_specific = boolPtr(false)
+	a.commonProperties.Product_specific = boolPtr(false)
+	a.commonProperties.Product_services_specific = boolPtr(false)
+}
+
 func (a *androidModuleContext) InstallInData() bool {
 	return a.module.InstallInData()
 }
diff --git a/cc/builder.go b/cc/builder.go
index 7d207b0..be63fd7 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -150,12 +150,10 @@
 		},
 		"crossCompile")
 
-	_ = pctx.SourcePathVariable("tidyPath", "build/soong/scripts/clang-tidy.sh")
-
 	clangTidy = pctx.AndroidStaticRule("clangTidy",
 		blueprint.RuleParams{
-			Command:     "rm -f $out && CLANG_TIDY=${config.ClangBin}/clang-tidy $tidyPath $tidyFlags $in -- $cFlags && touch $out",
-			CommandDeps: []string{"${config.ClangBin}/clang-tidy", "$tidyPath"},
+			Command:     "rm -f $out && CLANG_TIDY=${config.ClangBin}/clang-tidy ${config.ClangTidyShellPath} $tidyFlags $in -- $cFlags && touch $out",
+			CommandDeps: []string{"${config.ClangBin}/clang-tidy", "${config.ClangTidyShellPath}"},
 		},
 		"cFlags", "tidyFlags")
 
diff --git a/cc/cc.go b/cc/cc.go
index 7f65640..07dd23c 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1741,6 +1741,7 @@
 		} else if v == recoveryMode {
 			m := mod[i].(*Module)
 			m.Properties.InRecovery = true
+			m.MakeAsPlatform()
 			squashRecoverySrcs(m)
 		}
 	}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 3d162e7..3d5dfb1 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -158,11 +158,13 @@
 		cc_object {
 			name: "crtbegin_so",
 			recovery_available: true,
+			vendor_available: true,
 		}
 
 		cc_object {
 			name: "crtend_so",
 			recovery_available: true,
+			vendor_available: true,
 		}
 
 		cc_library {
@@ -236,8 +238,9 @@
 }
 
 const (
-	coreVariant   = "android_arm64_armv8-a_core_shared"
-	vendorVariant = "android_arm64_armv8-a_vendor_shared"
+	coreVariant     = "android_arm64_armv8-a_core_shared"
+	vendorVariant   = "android_arm64_armv8-a_vendor_shared"
+	recoveryVariant = "android_arm64_armv8-a_recovery_shared"
 )
 
 func TestVendorSrc(t *testing.T) {
@@ -1674,6 +1677,11 @@
 			recovery: true,
 			compile_multilib:"32",
 		}
+		cc_library_shared {
+			name: "libHalInRecovery",
+			recovery_available: true,
+			vendor: true,
+		}
 	`)
 
 	variants := ctx.ModuleVariantsForTests("librecovery")
@@ -1686,4 +1694,10 @@
 	if android.InList(arm64, variants) {
 		t.Errorf("multilib was set to 32 for librecovery32, but its variants has %s.", arm64)
 	}
+
+	recoveryModule := ctx.ModuleForTests("libHalInRecovery", recoveryVariant).Module().(*Module)
+	if !recoveryModule.Platform() {
+		t.Errorf("recovery variant of libHalInRecovery must not specific to device, soc, or product")
+	}
+
 }
diff --git a/cc/config/global.go b/cc/config/global.go
index a49e509..8b02f02 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -209,6 +209,7 @@
 	})
 	pctx.StaticVariable("ClangPath", "${ClangBase}/${HostPrebuiltTag}/${ClangVersion}")
 	pctx.StaticVariable("ClangBin", "${ClangPath}/bin")
+	pctx.StaticVariable("ClangTidyShellPath", "build/soong/scripts/clang-tidy.sh")
 
 	pctx.VariableFunc("ClangShortVersion", func(ctx android.PackageVarContext) string {
 		if override := ctx.Config().Getenv("LLVM_RELEASE_VERSION"); override != "" {
diff --git a/cc/makevars.go b/cc/makevars.go
index c3ff4ce..c4ef5f1 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -75,6 +75,7 @@
 	ctx.Strict("LLVM_OBJCOPY", "${config.ClangBin}/llvm-objcopy")
 	ctx.Strict("LLVM_STRIP", "${config.ClangBin}/llvm-strip")
 	ctx.Strict("PATH_TO_CLANG_TIDY", "${config.ClangBin}/clang-tidy")
+	ctx.Strict("PATH_TO_CLANG_TIDY_SHELL", "${config.ClangTidyShellPath}")
 	ctx.StrictSorted("CLANG_CONFIG_UNKNOWN_CFLAGS", strings.Join(config.ClangUnknownCflags, " "))
 
 	ctx.Strict("RS_LLVM_PREBUILTS_VERSION", "${config.RSClangVersion}")
@@ -126,6 +127,8 @@
 	ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_LDFLAGS", strings.Join(asanLdflags, " "))
 	ctx.Strict("ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES", strings.Join(asanLibs, " "))
 
+	ctx.Strict("HWADDRESS_SANITIZER_CONFIG_EXTRA_CFLAGS", strings.Join(hwasanCflags, " "))
+
 	ctx.Strict("CFI_EXTRA_CFLAGS", strings.Join(cfiCflags, " "))
 	ctx.Strict("CFI_EXTRA_LDFLAGS", strings.Join(cfiLdflags, " "))
 
diff --git a/cmd/multiproduct_kati/main.go b/cmd/multiproduct_kati/main.go
index a6bc8d5..813c060 100644
--- a/cmd/multiproduct_kati/main.go
+++ b/cmd/multiproduct_kati/main.go
@@ -307,7 +307,7 @@
 			}}
 			productCtx.Status.AddOutput(terminal.NewStatusOutput(productCtx.Writer, ""))
 
-			productConfig := build.NewConfig(productCtx)
+			productConfig := build.NewConfig(productCtx, flag.Args()...)
 			productConfig.Environment().Set("OUT_DIR", productOutDir)
 			build.FindSources(productCtx, productConfig, finder)
 			productConfig.Lunch(productCtx, product, *buildVariant)
diff --git a/java/config/config.go b/java/config/config.go
index fa8cb0f..6129349 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -27,7 +27,7 @@
 var (
 	pctx = android.NewPackageContext("android/soong/java/config")
 
-	DefaultBootclasspathLibraries = []string{"core-oj", "core-libart"}
+	DefaultBootclasspathLibraries = []string{"core-oj", "core-libart", "core-simple"}
 	DefaultSystemModules          = "core-system-modules"
 	DefaultLibraries              = []string{"ext", "framework", "okhttp"}
 	DefaultLambdaStubsLibrary     = "core-lambda-stubs"
@@ -43,6 +43,7 @@
 		"android.car7",
 		"core-oj",
 		"core-libart",
+		"core-simple",
 	}
 
 	ManifestMergerClasspath = []string{
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 52db705..070d5c1 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -904,6 +904,7 @@
 	if String(d.properties.Dex_api_filename) != "" {
 		d.dexApiFile = android.PathForModuleOut(ctx, String(d.properties.Dex_api_filename))
 		doclavaFlags += " -dexApi " + d.dexApiFile.String()
+		MetalavaFlags += " --dex-api " + d.dexApiFile.String()
 		*implicitOutputs = append(*implicitOutputs, d.dexApiFile)
 	}
 
diff --git a/java/java_test.go b/java/java_test.go
index 72341ee..c9f3dbf 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -101,6 +101,7 @@
 		"core-oj",
 		"core-libart",
 		"core-lambda-stubs",
+		"core-simple",
 		"framework",
 		"ext",
 		"okhttp",
@@ -353,14 +354,14 @@
 }{
 	{
 		name:          "default",
-		bootclasspath: []string{"core-oj", "core-libart"},
+		bootclasspath: []string{"core-oj", "core-libart", "core-simple"},
 		system:        "core-system-modules",
 		classpath:     []string{"ext", "framework", "okhttp"},
 	},
 	{
 		name:          "blank sdk version",
 		properties:    `sdk_version: "",`,
-		bootclasspath: []string{"core-oj", "core-libart"},
+		bootclasspath: []string{"core-oj", "core-libart", "core-simple"},
 		system:        "core-system-modules",
 		classpath:     []string{"ext", "framework", "okhttp"},
 	},
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 51fa8fe..610af17 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -129,6 +129,7 @@
 	"sum":       Allowed,
 	"tar":       Allowed,
 	"tail":      Allowed,
+	"todos":     Allowed,
 	"touch":     Allowed,
 	"tr":        Allowed,
 	"true":      Allowed,