Revert "Supports VNDK APEX with different versions"

This reverts commit 394951da73ec7a7a2b6353d75657dfd2d7c81ab8.

Reason for revert: some targets are broken

Bug: 142773030
Change-Id: I4ce2e4a4c683c71958bc4f73e45a5ddd4a4ae32a
diff --git a/cc/androidmk.go b/cc/androidmk.go
index f6b26d2..f1d329f 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -93,11 +93,6 @@
 					fmt.Fprintln(w, "LOCAL_USE_VNDK := true")
 					if c.isVndk() && !c.static() {
 						fmt.Fprintln(w, "LOCAL_SOONG_VNDK_VERSION := "+c.vndkVersion())
-						// VNDK libraries available to vendor are not installed because
-						// they are packaged in VNDK APEX and installed by APEX packages (apex/apex.go)
-						if !c.isVndkExt() {
-							fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
-						}
 					}
 				}
 			},
diff --git a/cc/cc.go b/cc/cc.go
index ae9b52f..9031afe 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -488,6 +488,15 @@
 	return ""
 }
 
+// IsVndkOnSystem returns true if a module is supposed to be a vndk library provided by system to vendor
+func (c *Module) IsVndkOnSystem() bool {
+	if linker, ok := c.linker.(libraryInterface); ok {
+		return linker.shared() && c.isVndk() && c.useVndk() && !c.isVndkExt()
+	}
+
+	return false
+}
+
 func (c *Module) VndkVersion() string {
 	return c.vndkVersion()
 }
diff --git a/cc/vndk.go b/cc/vndk.go
index 2c1856e..14bbf11 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -307,31 +307,6 @@
 	}
 }
 
-func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
-	if !m.Enabled() {
-		return false
-	}
-
-	if m.Target().NativeBridge == android.NativeBridgeEnabled {
-		return false
-	}
-
-	// prebuilt vndk modules should match with device
-	// TODO(b/142675459): Use enabled: to select target device in vndk_prebuilt_shared
-	// When b/142675459 is landed, remove following check
-	if p, ok := m.linker.(*vndkPrebuiltLibraryDecorator); ok && !p.matchesWithDevice(mctx.DeviceConfig()) {
-		return false
-	}
-
-	if lib, ok := m.linker.(libraryInterface); ok {
-		useCoreVariant := m.vndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
-			mctx.DeviceConfig().VndkUseCoreVariant() &&
-			!inList(m.BaseModuleName(), config.VndkMustUseVendorVariantList)
-		return lib.shared() && m.useVndk() && m.isVndk() && !m.isVndkExt() && !useCoreVariant
-	}
-	return false
-}
-
 // gather list of vndk-core, vndk-sp, and ll-ndk libs
 func VndkMutator(mctx android.BottomUpMutatorContext) {
 	m, ok := mctx.Module().(*Module)
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 8ed0afb..2cebb6d 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -130,7 +130,13 @@
 func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
 	flags Flags, deps PathDeps, objs Objects) android.Path {
 
-	if !p.matchesWithDevice(ctx.DeviceConfig()) {
+	arches := ctx.DeviceConfig().Arches()
+	if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
+		ctx.Module().SkipInstall()
+		return nil
+	}
+
+	if ctx.DeviceConfig().BinderBitness() != p.binderBit() {
 		ctx.Module().SkipInstall()
 		return nil
 	}
@@ -147,20 +153,6 @@
 	return nil
 }
 
-func (p *vndkPrebuiltLibraryDecorator) matchesWithDevice(config android.DeviceConfig) bool {
-	arches := config.Arches()
-	if len(arches) == 0 || arches[0].ArchType.String() != p.arch() {
-		return false
-	}
-	if config.BinderBitness() != p.binderBit() {
-		return false
-	}
-	if len(p.properties.Srcs) == 0 {
-		return false
-	}
-	return true
-}
-
 func (p *vndkPrebuiltLibraryDecorator) nativeCoverage() bool {
 	return false
 }