Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6954bd23 authored by Kiyoung Kim's avatar Kiyoung Kim Committed by Gerrit Code Review
Browse files

Merge "Remove PlatformVndkVersion property" into main

parents ff54ac08 fa13ff19
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1448,10 +1448,6 @@ func (c *deviceConfig) CurrentApiLevelForVendorModules() string {
	return StringDefault(c.config.productVariables.DeviceCurrentApiLevelForVendorModules, "current")
}

func (c *deviceConfig) PlatformVndkVersion() string {
	return String(c.config.productVariables.Platform_vndk_version)
}

func (c *deviceConfig) ExtraVndkVersions() []string {
	return c.config.productVariables.ExtraVndkVersions
}
+0 −2
Original line number Diff line number Diff line
@@ -209,7 +209,6 @@ type ProductVariables struct {
	Platform_base_sdk_extension_version       *int     `json:",omitempty"`
	Platform_version_active_codenames         []string `json:",omitempty"`
	Platform_version_all_preview_codenames    []string `json:",omitempty"`
	Platform_vndk_version                     *string  `json:",omitempty"`
	Platform_systemsdk_versions               []string `json:",omitempty"`
	Platform_security_patch                   *string  `json:",omitempty"`
	Platform_preview_sdk_version              *string  `json:",omitempty"`
@@ -597,7 +596,6 @@ func (v *ProductVariables) SetDefaultConfig() {
		Platform_sdk_final:                     boolPtr(false),
		Platform_version_active_codenames:      []string{"S"},
		Platform_version_all_preview_codenames: []string{"S"},
		Platform_vndk_version:                  stringPtr("S"),

		HostArch:                    stringPtr("x86_64"),
		HostSecondaryArch:           stringPtr("x86"),
+1 −7
Original line number Diff line number Diff line
@@ -739,7 +739,7 @@ func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {
// image variation name.
func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (string, string) {
	if a.vndkApex {
		return cc.VendorVariationPrefix, a.vndkVersion(deviceConfig)
		return cc.VendorVariationPrefix, a.vndkVersion()
	}

	prefix := android.CoreVariation
@@ -748,9 +748,6 @@ func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (s
		if a.SocSpecific() || a.DeviceSpecific() {
			prefix = cc.VendorVariationPrefix
			vndkVersion = deviceConfig.VndkVersion()
		} else if a.ProductSpecific() {
			prefix = cc.ProductVariationPrefix
			vndkVersion = deviceConfig.PlatformVndkVersion()
		}
	} else {
		if a.SocSpecific() || a.DeviceSpecific() {
@@ -759,9 +756,6 @@ func (a *apexBundle) getImageVariationPair(deviceConfig android.DeviceConfig) (s
			prefix = cc.ProductVariation
		}
	}
	if vndkVersion == "current" {
		vndkVersion = deviceConfig.PlatformVndkVersion()
	}

	return prefix, vndkVersion
}
+2 −2
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
	// VNDK APEX name is determined at runtime, so update "name" in apex_manifest
	optCommands := []string{}
	if a.vndkApex {
		apexName := vndkApexNamePrefix + a.vndkVersion(ctx.DeviceConfig())
		apexName := vndkApexNamePrefix + a.vndkVersion()
		optCommands = append(optCommands, "-v name "+apexName)
	}

@@ -1043,7 +1043,7 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
	if a.vndkApex {
		overrideName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(vndkApexName)
		if overridden {
			return overrideName + ".v" + a.vndkVersion(ctx.DeviceConfig())
			return overrideName + ".v" + a.vndkVersion()
		}
		return ""
	}
+7 −28
Original line number Diff line number Diff line
@@ -45,16 +45,12 @@ func vndkApexBundleFactory() android.Module {
	return bundle
}

func (a *apexBundle) vndkVersion(config android.DeviceConfig) string {
	vndkVersion := proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
	if vndkVersion == "current" {
		vndkVersion = config.PlatformVndkVersion()
	}
	return vndkVersion
func (a *apexBundle) vndkVersion() string {
	return proptools.StringDefault(a.vndkProperties.Vndk_version, "current")
}

type apexVndkProperties struct {
	// Indicates VNDK version of which this VNDK APEX bundles VNDK libs. Default is Platform VNDK Version.
	// Indicates VNDK version of which this VNDK APEX bundles VNDK libs.
	Vndk_version *string
}

@@ -64,7 +60,7 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
			mctx.PropertyErrorf("native_bridge_supported", "%q doesn't support native bridge binary.", mctx.ModuleType())
		}

		vndkVersion := ab.vndkVersion(mctx.DeviceConfig())
		vndkVersion := ab.vndkVersion()
		if vndkVersion != "" {
			apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
			if err != nil {
@@ -73,17 +69,9 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
			}

			targets := mctx.MultiTargets()
			if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) &&
				vndkVersion != mctx.DeviceConfig().PlatformVndkVersion() {
			if len(targets) > 0 && apiLevel.LessThan(cc.MinApiForArch(mctx, targets[0].Arch.ArchType)) {
				// Disable VNDK APEXes for VNDK versions less than the minimum supported API
				// level for the primary architecture. This validation is skipped if the VNDK
				// version matches the platform VNDK version, which can occur when the device
				// config targets the 'current' VNDK (see `vndkVersion`).
				ab.Disable()
			}
			if proptools.String(ab.vndkProperties.Vndk_version) != "" &&
				mctx.DeviceConfig().PlatformVndkVersion() != "" &&
				apiLevel.GreaterThanOrEqualTo(android.ApiLevelOrPanic(mctx, mctx.DeviceConfig().PlatformVndkVersion())) {
				// level for the primary architecture.
				ab.Disable()
			}
		}
@@ -93,20 +81,11 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
func apexVndkDepsMutator(mctx android.BottomUpMutatorContext) {
	if m, ok := mctx.Module().(*cc.Module); ok && cc.IsForVndkApex(mctx, m) {
		vndkVersion := m.VndkVersion()
		// For VNDK-Lite device, we gather core-variants of VNDK-Sp libraries, which doesn't have VNDK version defined
		if vndkVersion == "" {
			vndkVersion = mctx.DeviceConfig().PlatformVndkVersion()
		}

		if vndkVersion == "" {
			return
		}

		if vndkVersion == mctx.DeviceConfig().PlatformVndkVersion() {
			vndkVersion = "current"
		} else {
		vndkVersion = "v" + vndkVersion
		}

		vndkApexName := "com.android.vndk." + vndkVersion

Loading