Remove PlatformVndkVersion property

Platform VNDK version is no longer available based on VNDK deprecation.
Remove all code using Platform VNDK version.

Bug: 330100430
Test: AOSP CF build succeeded
Change-Id: I7d0f7e23eff5d153346890f242a94b78bad6736b
diff --git a/cc/cc.go b/cc/cc.go
index 90185ea..88ebca2 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1896,9 +1896,6 @@
 		vndkVersion = ctx.DeviceConfig().VndkVersion()
 		nameSuffix = VendorSuffix
 	}
-	if vndkVersion == "current" {
-		vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
-	}
 	if c.VndkVersion() != vndkVersion && c.VndkVersion() != "" {
 		// add version suffix only if the module is using different vndk version than the
 		// version in product or vendor partition.
diff --git a/cc/genrule.go b/cc/genrule.go
index 0fb3e2d..23e97d0 100644
--- a/cc/genrule.go
+++ b/cc/genrule.go
@@ -121,18 +121,7 @@
 		}
 	} else {
 		if vendorVariantRequired {
-			// If vndkVersion is current, we can always use PlatformVndkVersion.
-			// If not, we assume modules under proprietary paths are compatible for
-			// BOARD_VNDK_VERSION. The other modules are regarded as AOSP, that is
-			// PLATFORM_VNDK_VERSION.
-			if vndkVersion == "current" || !snapshot.IsVendorProprietaryModule(ctx) {
-				variants = append(variants, VendorVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
-			} else {
-				variants = append(variants, VendorVariationPrefix+vndkVersion)
-			}
-		}
-		if productVariantRequired {
-			variants = append(variants, ProductVariationPrefix+ctx.DeviceConfig().PlatformVndkVersion())
+			variants = append(variants, VendorVariationPrefix+vndkVersion)
 		}
 	}
 
diff --git a/cc/image.go b/cc/image.go
index d02a2f3..50d1b23 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -429,7 +429,6 @@
 	var vendorVariants []string
 	var productVariants []string
 
-	platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
 	boardVndkVersion := mctx.DeviceConfig().VndkVersion()
 	recoverySnapshotVersion := mctx.DeviceConfig().RecoverySnapshotVersion()
 	usingRecoverySnapshot := recoverySnapshotVersion != "current" &&
@@ -444,17 +443,13 @@
 			needVndkVersionVendorVariantForLlndk = boardVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, "30"))
 		}
 	}
-	if boardVndkVersion == "current" {
-		boardVndkVersion = platformVndkVersion
-	}
-
 	if m.NeedsLlndkVariants() {
 		// This is an LLNDK library.  The implementation of the library will be on /system,
 		// and vendor and product variants will be created with LLNDK stubs.
 		// The LLNDK libraries need vendor variants even if there is no VNDK.
 		coreVariantNeeded = true
-		vendorVariants = append(vendorVariants, platformVndkVersion)
-		productVariants = append(productVariants, platformVndkVersion)
+		vendorVariants = append(vendorVariants, "")
+		productVariants = append(productVariants, "")
 		// Generate vendor variants for boardVndkVersion only if the VNDK snapshot does not
 		// provide the LLNDK stub libraries.
 		if needVndkVersionVendorVariantForLlndk {
@@ -465,7 +460,7 @@
 		// for system and product.
 		coreVariantNeeded = true
 		vendorVariants = append(vendorVariants, boardVndkVersion)
-		productVariants = append(productVariants, platformVndkVersion)
+		productVariants = append(productVariants, "")
 	} else if m.IsSnapshotPrebuilt() {
 		// Make vendor variants only for the versions in BOARD_VNDK_VERSION and
 		// PRODUCT_EXTRA_VNDK_VERSIONS.
@@ -486,13 +481,13 @@
 			if snapshot.IsVendorProprietaryModule(mctx) {
 				vendorVariants = append(vendorVariants, boardVndkVersion)
 			} else {
-				vendorVariants = append(vendorVariants, platformVndkVersion)
+				vendorVariants = append(vendorVariants, "")
 			}
 		}
 
 		// product_available modules are available to /product.
 		if m.HasProductVariant() {
-			productVariants = append(productVariants, platformVndkVersion)
+			productVariants = append(productVariants, "")
 		}
 	} else if vendorSpecific && m.SdkVersion() == "" {
 		// This will be available in /vendor (or /odm) only
@@ -505,13 +500,13 @@
 		// are regarded as AOSP, which is PLATFORM_VNDK_VERSION.
 		if m.KernelHeadersDecorator() {
 			vendorVariants = append(vendorVariants,
-				platformVndkVersion,
+				"",
 				boardVndkVersion,
 			)
 		} else if snapshot.IsVendorProprietaryModule(mctx) {
 			vendorVariants = append(vendorVariants, boardVndkVersion)
 		} else {
-			vendorVariants = append(vendorVariants, platformVndkVersion)
+			vendorVariants = append(vendorVariants, "")
 		}
 	} else {
 		// This is either in /system (or similar: /data), or is a
@@ -523,7 +518,7 @@
 	if coreVariantNeeded && productSpecific && m.SdkVersion() == "" {
 		// The module has "product_specific: true" that does not create core variant.
 		coreVariantNeeded = false
-		productVariants = append(productVariants, platformVndkVersion)
+		productVariants = append(productVariants, "")
 	}
 
 	if m.RamdiskAvailable() {
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index e769fe9..7d003a9 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -324,7 +324,7 @@
 
 	variations = append(ctx.Target().Variations(), blueprint.Variation{
 		Mutator:   "image",
-		Variation: ProductVariationPrefix + ctx.DeviceConfig().PlatformVndkVersion()})
+		Variation: ProductVariation})
 
 	if ctx.OtherModuleFarDependencyVariantExists(variations, ctx.Module().(LinkableInterface).BaseModuleName()) {
 		p.baseProperties.Androidmk_suffix = p.Image.moduleNameSuffix()
diff --git a/cc/vndk.go b/cc/vndk.go
index 2b2ea64..ad0dcf3 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -42,28 +42,6 @@
 )
 
 func VndkLibrariesTxtModules(vndkVersion string, ctx android.BaseModuleContext) []string {
-	// Return the list of vndk txt files for the vndk apex of the vndkVersion.
-	if vndkVersion == "current" {
-		// We can assume all txt files are snapshotted if we find one of them.
-		currentVndkSnapshotted := ctx.OtherModuleExists(insertVndkVersion(llndkLibrariesTxt, ctx.DeviceConfig().PlatformVndkVersion()))
-		if currentVndkSnapshotted {
-			// If the current VNDK is already snapshotted (which can happen with
-			// the `next` config), use the prebuilt txt files in the snapshot.
-			// This is because the txt files built from source are probably be
-			// for the in-development version.
-			vndkVersion = ctx.DeviceConfig().PlatformVndkVersion()
-		} else {
-			// Use the txt files generated from the source
-			return []string{
-				llndkLibrariesTxtForApex,
-				vndkCoreLibrariesTxt,
-				vndkSpLibrariesTxt,
-				vndkPrivateLibrariesTxt,
-				vndkProductLibrariesTxt,
-			}
-		}
-	}
-
 	// Snapshot vndks have their own *.libraries.VER.txt files.
 	// Note that snapshots don't have "vndkcorevariant.libraries.VER.txt"
 	result := []string{
@@ -376,15 +354,6 @@
 		if !p.MatchesWithDevice(mctx.DeviceConfig()) {
 			return false
 		}
-
-		platformVndkVersion := mctx.DeviceConfig().PlatformVndkVersion()
-		if platformVndkVersion != "" {
-			// ignore prebuilt vndk modules that are newer than or equal to the platform vndk version
-			platformVndkApiLevel := android.ApiLevelOrPanic(mctx, platformVndkVersion)
-			if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(mctx, p.Version())) {
-				return false
-			}
-		}
 	}
 
 	if lib, ok := m.linker.(libraryInterface); ok {
@@ -392,8 +361,7 @@
 		if lib.buildStubs() {
 			return false
 		}
-		useCoreVariant := m.VndkVersion() == mctx.DeviceConfig().PlatformVndkVersion() &&
-			mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
+		useCoreVariant := mctx.DeviceConfig().VndkUseCoreVariant() && !m.MustUseVendorVariant()
 		return lib.shared() && m.InVendor() && m.IsVndk() && !m.IsVndkExt() && !useCoreVariant
 	}
 	return false
@@ -548,22 +516,9 @@
 	return filename
 }
 
-func (txt *vndkLibrariesTxt) DepsMutator(mctx android.BottomUpMutatorContext) {
-	versionedName := insertVndkVersion(txt.Name(), mctx.DeviceConfig().PlatformVndkVersion())
-	if mctx.OtherModuleExists(versionedName) {
-		// If the prebuilt vndk libraries txt files exist, install them instead.
-		txt.HideFromMake()
-		mctx.AddDependency(txt, nil, versionedName)
-	}
-}
-
 func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
 	filename := proptools.StringDefault(txt.properties.Stem, txt.Name())
 
-	if Bool(txt.properties.Insert_vndk_version) {
-		filename = insertVndkVersion(filename, ctx.DeviceConfig().PlatformVndkVersion())
-	}
-
 	txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
 
 	installPath := android.PathForModuleInstall(ctx, "etc")
@@ -639,34 +594,6 @@
 
 func isVndkSnapshotAware(config android.DeviceConfig, m LinkableInterface,
 	apexInfo android.ApexInfo) (vndkType string, isVndkSnapshotLib bool) {
-
-	if m.Target().NativeBridge == android.NativeBridgeEnabled {
-		return "", false
-	}
-	// !inVendor: There's product/vendor variants for VNDK libs. We only care about vendor variants.
-	// !installable: Snapshot only cares about "installable" modules.
-	// !m.IsLlndk: llndk stubs are required for building against snapshots.
-	// IsSnapshotPrebuilt: Snapshotting a snapshot doesn't make sense.
-	// !outputFile.Valid: Snapshot requires valid output file.
-	if !m.InVendor() || (!installable(m, apexInfo) && !m.IsLlndk()) || m.IsSnapshotPrebuilt() || !m.OutputFile().Valid() {
-		return "", false
-	}
-	if !m.IsSnapshotLibrary() || !m.Shared() {
-		return "", false
-	}
-	if m.VndkVersion() == config.PlatformVndkVersion() {
-		if m.IsVndk() && !m.IsVndkExt() {
-			if m.IsVndkSp() {
-				return "vndk-sp", true
-			} else {
-				return "vndk-core", true
-			}
-		} else if m.HasLlndkStubs() && m.StubsVersion() == "" {
-			// Use default version for the snapshot.
-			return "llndk-stub", true
-		}
-	}
-
 	return "", false
 }
 
@@ -679,10 +606,6 @@
 		return
 	}
 
-	if ctx.DeviceConfig().PlatformVndkVersion() == "" {
-		return
-	}
-
 	var snapshotOutputs android.Paths
 
 	/*
diff --git a/cc/vndk_prebuilt.go b/cc/vndk_prebuilt.go
index 43030b8..f4ba163 100644
--- a/cc/vndk_prebuilt.go
+++ b/cc/vndk_prebuilt.go
@@ -131,16 +131,6 @@
 
 func (p *vndkPrebuiltLibraryDecorator) link(ctx ModuleContext,
 	flags Flags, deps PathDeps, objs Objects) android.Path {
-	platformVndkVersion := ctx.DeviceConfig().PlatformVndkVersion()
-	if platformVndkVersion != "" {
-		platformVndkApiLevel := android.ApiLevelOrPanic(ctx, platformVndkVersion)
-		if platformVndkApiLevel.LessThanOrEqualTo(android.ApiLevelOrPanic(ctx, p.Version())) {
-			// This prebuilt VNDK module is not required for the current build
-			ctx.Module().HideFromMake()
-			return nil
-		}
-	}
-
 	if !p.MatchesWithDevice(ctx.DeviceConfig()) {
 		ctx.Module().HideFromMake()
 		return nil