Merge "Add sdk version workaround for libclang_rt"
diff --git a/android/config.go b/android/config.go
index cf4d6e5..393382b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -983,8 +983,8 @@
 	return c.productVariables.EnforceSystemCertificateWhitelist
 }
 
-func (c *config) HiddenAPIPublicList() string {
-	return String(c.productVariables.HiddenAPIPublicList)
+func (c *config) HiddenAPIStubFlags() string {
+	return String(c.productVariables.HiddenAPIStubFlags)
 }
 
 func (c *config) HiddenAPIFlags() string {
diff --git a/android/variable.go b/android/variable.go
index 46b1155..8333635 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -273,7 +273,7 @@
 	EnforceSystemCertificateWhitelist []string `json:",omitempty"`
 
 	// TODO(ccross): move these to a Singleton in Soong
-	HiddenAPIPublicList        *string  `json:",omitempty"`
+	HiddenAPIStubFlags         *string  `json:",omitempty"`
 	HiddenAPIFlags             *string  `json:",omitempty"`
 	HiddenAPIExtraAppUsageJars []string `json:",omitempty"`
 }
diff --git a/cc/config/x86_windows_host.go b/cc/config/x86_windows_host.go
index dfdd40c..0f500b6 100644
--- a/cc/config/x86_windows_host.go
+++ b/cc/config/x86_windows_host.go
@@ -100,7 +100,9 @@
 		"imagehlp",
 		"iphlpapi",
 		"netapi32",
+		"oleaut32",
 		"ole32",
+		"opengl32",
 		"powrprof",
 		"psapi",
 		"pthread",
@@ -108,6 +110,7 @@
 		"uuid",
 		"version",
 		"ws2_32",
+		"windowscodecs",
 	}, "-l")
 )
 
diff --git a/java/hiddenapi.go b/java/hiddenapi.go
index 29f23b1..6a603cf 100644
--- a/java/hiddenapi.go
+++ b/java/hiddenapi.go
@@ -25,24 +25,24 @@
 )
 
 var hiddenAPIGenerateCSVRule = pctx.AndroidStaticRule("hiddenAPIGenerateCSV", blueprint.RuleParams{
-	Command:     "${config.Class2Greylist} --public-api-list ${publicAPIList} $in $outFlag $out",
+	Command:     "${config.Class2Greylist} --stub-api-flags ${stubAPIFlags} $in $outFlag $out",
 	CommandDeps: []string{"${config.Class2Greylist}"},
-}, "outFlag", "publicAPIList")
+}, "outFlag", "stubAPIFlags")
 
 func hiddenAPIGenerateCSV(ctx android.ModuleContext, classesJar android.Path) {
 	flagsCSV := android.PathForModuleOut(ctx, "hiddenapi", "flags.csv")
 	metadataCSV := android.PathForModuleOut(ctx, "hiddenapi", "metadata.csv")
-	publicList := &bootImagePath{ctx.Config().HiddenAPIPublicList()}
+	stubFlagsCSV := &bootImagePath{ctx.Config().HiddenAPIStubFlags()}
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:        hiddenAPIGenerateCSVRule,
 		Description: "hiddenapi flags",
 		Input:       classesJar,
 		Output:      flagsCSV,
-		Implicit:    publicList,
+		Implicit:    stubFlagsCSV,
 		Args: map[string]string{
-			"outFlag":       "--write-flags-csv",
-			"publicAPIList": publicList.String(),
+			"outFlag":      "--write-flags-csv",
+			"stubAPIFlags": stubFlagsCSV.String(),
 		},
 	})
 
@@ -51,10 +51,10 @@
 		Description: "hiddenapi metadata",
 		Input:       classesJar,
 		Output:      metadataCSV,
-		Implicit:    publicList,
+		Implicit:    stubFlagsCSV,
 		Args: map[string]string{
-			"outFlag":       "--write-metadata-csv",
-			"publicAPIList": publicList.String(),
+			"outFlag":      "--write-metadata-csv",
+			"stubAPIFlags": stubFlagsCSV.String(),
 		},
 	})
 
diff --git a/java/sdk_library.go b/java/sdk_library.go
index d33149b..ca3131c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -396,7 +396,9 @@
 	props.Sdk_version = proptools.StringPtr(module.sdkVersion(apiScope))
 	props.Libs = module.sdkLibraryProperties.Stub_only_libs
 	// Unbundled apps will use the prebult one from /prebuilts/sdk
-	props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false)
+	if mctx.Config().UnbundledBuildPrebuiltSdks() {
+		props.Product_variables.Unbundled_build.Enabled = proptools.BoolPtr(false)
+	}
 	props.Product_variables.Pdk.Enabled = proptools.BoolPtr(false)
 	props.No_standard_libs = module.Library.Module.properties.No_standard_libs
 	props.System_modules = module.Library.Module.deviceProperties.System_modules
@@ -596,7 +598,7 @@
 // to satisfy SdkLibraryDependency interface
 func (module *sdkLibrary) HeaderJars(ctx android.BaseContext, sdkVersion string) android.Paths {
 	// This module is just a wrapper for the stubs.
-	if ctx.Config().UnbundledBuild() {
+	if ctx.Config().UnbundledBuildPrebuiltSdks() {
 		return module.PrebuiltJars(ctx, sdkVersion)
 	} else {
 		if strings.HasPrefix(sdkVersion, "system_") {
@@ -612,7 +614,7 @@
 // to satisfy SdkLibraryDependency interface
 func (module *sdkLibrary) ImplementationJars(ctx android.BaseContext, sdkVersion string) android.Paths {
 	// This module is just a wrapper for the stubs.
-	if ctx.Config().UnbundledBuild() {
+	if ctx.Config().UnbundledBuildPrebuiltSdks() {
 		return module.PrebuiltJars(ctx, sdkVersion)
 	} else {
 		if strings.HasPrefix(sdkVersion, "system_") {