Support using cc_prebuilt_library_shared with cc_library

Allow a cc_prebuilt_library_shared to share the same name as a
cc_library by always creating static and shared variants of
prebuilts so that the variants of the source module are always
a superset of the variants of the target module.

Bug: 131709055
Test: TestPrebuilts
Change-Id: I4afd6d37e6a986d08ad25aee69eca6d994febc6b
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 5ffeb32..48e4667 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -53,12 +53,19 @@
 	return p.properties.Srcs
 }
 
+type prebuiltLibraryInterface interface {
+	libraryInterface
+	prebuiltLinkerInterface
+	disablePrebuilt()
+}
+
 type prebuiltLibraryLinker struct {
 	*libraryDecorator
 	prebuiltLinker
 }
 
 var _ prebuiltLinkerInterface = (*prebuiltLibraryLinker)(nil)
+var _ prebuiltLibraryInterface = (*prebuiltLibraryLinker)(nil)
 
 func (p *prebuiltLibraryLinker) linkerInit(ctx BaseModuleContext) {}
 
@@ -116,6 +123,10 @@
 	return false
 }
 
+func (p *prebuiltLibraryLinker) disablePrebuilt() {
+	p.properties.Srcs = nil
+}
+
 // cc_prebuilt_library_shared installs a precompiled shared library that are
 // listed in the srcs property in the device's directory.
 func prebuiltSharedLibraryFactory() android.Module {