Remove 'core_interface' from 'hidl_interface'.

Moving this declaration into a hardcoded list.

This:
- will allow us to remove lookupInterface once b/111366989 is done
- centralizes this information and ensures the 'special' set remains
  small

Bug: 111366989
Test: 'm android.hidl.base@1.0' fails because the module doesn't exist
Test: run_all_host_tests.sh
Change-Id: I300e38f1f42329c9c126f1b50e6a31066a77ad50
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index 9f2be74..69d94d6 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -60,11 +60,6 @@
 	// Whether to generate a Java library containing constants
 	// expressed by @export annotations in the hal files.
 	Gen_java_constants bool
-
-	// Don't generate "android.hidl.foo@1.0" C library. Instead
-	// only generate the genrules so that this package can be
-	// included in libhidltransport.
-	Core_interface bool
 }
 
 type hidlInterface struct {
@@ -159,14 +154,7 @@
 	hasError := false
 
 	for _, i := range dependencies {
-		interfaceObject := lookupInterface(i)
-		if interfaceObject == nil {
-			mctx.PropertyErrorf("interfaces", "Cannot find interface "+i)
-			hasError = true
-			continue
-		}
-
-		if !interfaceObject.properties.Core_interface {
+		if !isCorePackage(i) {
 			ret = append(ret, i)
 		}
 	}
@@ -206,7 +194,7 @@
 		return
 	}
 
-	shouldGenerateLibrary := !i.properties.Core_interface
+	shouldGenerateLibrary := !isCorePackage(name.string())
 	// explicitly true if not specified to give early warning to devs
 	shouldGenerateJava := i.properties.Gen_java == nil || *i.properties.Gen_java
 	shouldGenerateJavaConstants := i.properties.Gen_java_constants
@@ -455,3 +443,18 @@
 	}
 	return false
 }
+
+// packages in libhidltransport
+var coreDependencyPackageNames = []string{
+	"android.hidl.base@",
+	"android.hidl.manager@",
+}
+
+func isCorePackage(name string) bool {
+	for _, pkgname := range coreDependencyPackageNames {
+		if strings.HasPrefix(name, pkgname) {
+			return true
+		}
+	}
+	return false
+}