Merge changes Ibaf383c4,I2b1c0736 am: 139fa4320f

Change-Id: I71377d3a6e5395732aee75e3e129d3684b523c13
This commit is contained in:
Automerger Merge Worker 2020-02-25 07:15:26 +00:00
commit e45d4d1612
2 changed files with 20 additions and 0 deletions

View file

@ -170,9 +170,21 @@ func hiddenAPIEncodeDex(ctx android.ModuleContext, output android.WritablePath,
tmpOutput = android.PathForModuleOut(ctx, "hiddenapi", "unaligned", "unaligned.jar")
tmpDir = android.PathForModuleOut(ctx, "hiddenapi", "unaligned")
}
enforceHiddenApiFlagsToAllMembers := true
// If frameworks/base doesn't exist we must be building with the 'master-art' manifest.
// Disable assertion that all methods/fields have hidden API flags assigned.
if !ctx.Config().FrameworksBaseDirExists(ctx) {
enforceHiddenApiFlagsToAllMembers = false
}
// b/149353192: when a module is instrumented, jacoco adds synthetic members
// $jacocoData and $jacocoInit. Since they don't exist when building the hidden API flags,
// don't complain when we don't find hidden API flags for the synthetic members.
if j, ok := ctx.Module().(*Library); ok && j.shouldInstrument(ctx) {
enforceHiddenApiFlagsToAllMembers = false
}
if !enforceHiddenApiFlagsToAllMembers {
hiddenapiFlags = "--no-force-assign-all"
}

View file

@ -1519,6 +1519,14 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.headerJarFile = j.implementationJarFile
}
// Force enable the instrumentation for java code that is built for APEXes ...
// except for the jacocoagent itself (because instrumenting jacocoagent using jacocoagent
// doesn't make sense)
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
if android.DirectlyInAnyApex(ctx, ctx.ModuleName()) && !isJacocoAgent && !j.IsForPlatform() {
j.properties.Instrument = true
}
if j.shouldInstrument(ctx) {
outputFile = j.instrument(ctx, flags, outputFile, jarName)
}