Merge "Disable VTS builds for product" am: d3b8a7698f

Original change: https://android-review.googlesource.com/c/platform/system/tools/hidl/+/1510911

Change-Id: Ia1497e95bb64bc1c2690fb5fe9123eb20f37e122
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index 53b8b42..62b665e 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -627,6 +627,10 @@
 	shouldGenerateJavaConstants := i.properties.Gen_java_constants
 	shouldGenerateVts := shouldGenerateLibrary && proptools.BoolDefault(i.properties.Gen_vts, true)
 
+	// To generate VTS, hidl_interface must have a core variant.
+	// A module with 'product_specific: true' does not create a core variant.
+	shouldGenerateVts = shouldGenerateVts && !mctx.ProductSpecific()
+
 	var productAvailable *bool
 	if !mctx.ProductSpecific() {
 		productAvailable = proptools.BoolPtr(true)
@@ -861,7 +865,6 @@
 		})
 		mctx.CreateModule(cc.LibraryFactory, &ccProperties{
 			Name:                      proptools.StringPtr(name.vtsDriverName()),
-			Product_available:         productAvailable,
 			Defaults:                  []string{"VtsHalDriverDefaults"},
 			Generated_sources:         []string{name.vtsDriverSourcesName()},
 			Generated_headers:         []string{name.vtsDriverHeadersName()},
@@ -894,7 +897,6 @@
 		})
 		mctx.CreateModule(cc.LibraryFactory, &ccProperties{
 			Name:                      proptools.StringPtr(name.vtsProfilerName()),
-			Product_available:         productAvailable,
 			Defaults:                  []string{"VtsHalProfilerDefaults"},
 			Generated_sources:         []string{name.vtsProfilerSourcesName()},
 			Generated_headers:         []string{name.vtsProfilerHeadersName()},