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

Commit 003452ff authored by Spandan Das's avatar Spandan Das
Browse files

Disable source apex variant using apex_available_name

There are two versions of aosp extservices - one for Tplus and one for
Sminus. When prebuilts are active, the `contents` validation of both
variants of extservices bootclasspath fragments should be disabled to
account for BCP jar skew.

This CL adds ApexAvailableName to ApexInfo to achive that. If an
api_domain matching the ApexAvailableName has been selected in
`all_apex_contributions`, the source apex variants will be disabled.

Bug: 361771739

Test: lunch cf_x86_64_phone-next-userdebug
Test: m nothing with ag/28851886
Change-Id: I505a7ad8295c258e2eeef7f183669f7a75a1c88e
parent 1679192d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ type ApexInfo struct {

	// Returns the name of the overridden apex (com.android.foo)
	BaseApexName string

	// Returns the value of `apex_available_name`
	ApexAvailableName string
}

// AllApexInfo holds the ApexInfo of all apexes that include this module.
+1 −0
Original line number Diff line number Diff line
@@ -1073,6 +1073,7 @@ func (a *apexBundle) ApexInfoMutator(mctx android.TopDownMutatorContext) {
		ApexContents:      []*android.ApexContents{apexContents},
		TestApexes:        testApexes,
		BaseApexName:      mctx.ModuleName(),
		ApexAvailableName: proptools.String(a.properties.Apex_available_name),
	}
	mctx.WalkDeps(func(child, parent android.Module) bool {
		if !continueApexDepsWalk(child, parent) {
+8 −3
Original line number Diff line number Diff line
@@ -209,13 +209,18 @@ func disableSourceApexVariant(ctx android.BaseModuleContext) bool {
			psi = prebuiltSelectionInfo
		}
	})

	// Find the apex variant for this module
	var apexVariantsWithoutTestApexes []string
	apexVariantsWithoutTestApexes := []string{}
	if apexInfo.BaseApexName != "" {
		// This is a transitive dependency of an override_apex
		apexVariantsWithoutTestApexes = []string{apexInfo.BaseApexName}
		apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.BaseApexName)
	} else {
		_, apexVariantsWithoutTestApexes, _ = android.ListSetDifference(apexInfo.InApexVariants, apexInfo.TestApexes)
		_, variants, _ := android.ListSetDifference(apexInfo.InApexVariants, apexInfo.TestApexes)
		apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, variants...)
	}
	if apexInfo.ApexAvailableName != "" {
		apexVariantsWithoutTestApexes = append(apexVariantsWithoutTestApexes, apexInfo.ApexAvailableName)
	}
	disableSource := false
	// find the selected apexes