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

Commit ec41b5c2 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Disable VNDK apexes for unsupported API levels"

parents 31a8bd82 bb137a39
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -65,8 +65,23 @@ func apexVndkMutator(mctx android.TopDownMutatorContext) {
		}

		vndkVersion := ab.vndkVersion(mctx.DeviceConfig())

		// Ensure VNDK APEX mount point is formatted as com.android.vndk.v###
		ab.properties.Apex_name = proptools.StringPtr(vndkApexNamePrefix + vndkVersion)

		apiLevel, err := android.ApiLevelFromUser(mctx, vndkVersion)
		if err != nil {
			mctx.PropertyErrorf("vndk_version", "%s", err.Error())
			return
		}

		targets := mctx.MultiTargets()
		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.
			ab.Disable()
		}

	}
}

+4 −2
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@ import (
	"android/soong/android"
)

func minApiForArch(ctx android.EarlyModuleContext,
// MinApiLevelForArch returns the ApiLevel for the Android version that
// first supported the architecture.
func MinApiForArch(ctx android.EarlyModuleContext,
	arch android.ArchType) android.ApiLevel {

	switch arch {
@@ -38,7 +40,7 @@ func minApiForArch(ctx android.EarlyModuleContext,
func nativeApiLevelFromUser(ctx android.BaseModuleContext,
	raw string) (android.ApiLevel, error) {

	min := minApiForArch(ctx, ctx.Arch().ArchType)
	min := MinApiForArch(ctx, ctx.Arch().ArchType)
	if raw == "minimum" {
		return min, nil
	}
+2 −2
Original line number Diff line number Diff line
@@ -2220,7 +2220,7 @@ func GetCrtVariations(ctx android.BottomUpMutatorContext,
		}

		// Raise the minSdkVersion to the minimum supported for the architecture.
		minApiForArch := minApiForArch(ctx, m.Target().Arch.ArchType)
		minApiForArch := MinApiForArch(ctx, m.Target().Arch.ArchType)
		if apiLevel.LessThan(minApiForArch) {
			apiLevel = minApiForArch
		}
@@ -3706,7 +3706,7 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
	// This allows introducing new architectures in the platform that
	// need to be included in apexes that normally require an older
	// min_sdk_version.
	minApiForArch := minApiForArch(ctx, c.Target().Arch.ArchType)
	minApiForArch := MinApiForArch(ctx, c.Target().Arch.ArchType)
	if sdkVersion.LessThan(minApiForArch) {
		sdkVersion = minApiForArch
	}