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

Commit b07e7fd5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Instrument impl library belonging to apexes" into main

parents 5e79b167 690df2e3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -715,7 +715,12 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
	// doesn't make sense) or framework libraries (e.g. libraries found in the InstrumentFrameworkModules list) unless EMMA_INSTRUMENT_FRAMEWORK is true.
	apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
	isJacocoAgent := ctx.ModuleName() == "jacocoagent"
	if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {

	isApexVariantSdkLibImplLib := j.SdkLibraryName() != nil &&
		strings.HasSuffix(j.Name(), ".impl") &&
		len(apexInfo.InApexVariants) > 0

	if (j.DirectlyInAnyApex() || isApexVariantSdkLibImplLib) && !isJacocoAgent && !apexInfo.IsForPlatform() {
		if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
			return true
		} else if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") {