summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-02-03 20:06:33 +0000
committerPaul Duffin <paulduffin@google.com>2021-02-08 19:10:50 +0000
commit9d67ca6ab7cbc3874b51d7a434a8b0c1506f7ecf (patch)
treed9f264223851cf4bc8e4183778ce670b7550343d /java/java.go
parent4fd997bc137e31ce66d6ef4ad64d166d72692187 (diff)
Allow dex jars from prebuilt_apex to be used by hiddenapi
Invokes hiddenAPIExtractInformation() on the dex jar provided by the deapexer (on behalf of prebuilt_apex) so that hiddenAPI can extract the information it needs, if anything, from the dex file (and accompanying classes implementation file). The dex file provided by deapexer has already had the hiddenapi information encoded into it so it does not need to do that again. This change adds the primary parameter to hiddenAPIExtractInformation() and checks it (and also the hiddenAPI.active property) before it does anything. That ensures that it behaves correctly when called directly as well as when called from hiddenAPIExtractAndEncode(). Bug: 178361284 Test: m droid Verified that hiddenapi files (both aggregated ones and for the individual modules) are not affected by this change. Also verified that the hiddenapi files created when using the prebuilts (using SOONG_CONFIG_art_module_source_build=false) are the same as when using the source. There is a slight difference in the order but otherwise identical. Change-Id: I7abb63fd310bb94787ab7f4821e5fd283dc03046
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/java/java.go b/java/java.go
index dfbcd6f54..d194ff7d9 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2917,6 +2917,9 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.properties.Aidl.Export_include_dirs)
if ctx.Device() {
+ configurationName := j.BaseModuleName()
+ primary := j.Prebuilt().UsePrebuilt()
+
// If this is a variant created for a prebuilt_apex then use the dex implementation jar
// obtained from the associated deapexer module.
ai := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
@@ -2930,8 +2933,10 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Get the path of the dex implementation jar from the `deapexer` module.
di := ctx.OtherModuleProvider(deapexerModule, android.DeapexerProvider).(android.DeapexerInfo)
- j.dexJarFile = di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar")
- if j.dexJarFile == nil {
+ if dexOutputPath := di.PrebuiltExportPath(j.BaseModuleName(), ".dexjar"); dexOutputPath != nil {
+ j.dexJarFile = dexOutputPath
+ j.hiddenAPI.hiddenAPIExtractInformation(ctx, dexOutputPath, outputFile, primary)
+ } else {
// This should never happen as a variant for a prebuilt_apex is only created if the
// prebuilt_apex has been configured to export the java library dex file.
ctx.ModuleErrorf("internal error: no dex implementation jar available from prebuilt_apex %q", deapexerModule.Name())
@@ -2961,9 +2966,6 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
return
}
- configurationName := j.BaseModuleName()
- primary := j.Prebuilt().UsePrebuilt()
-
// Hidden API CSV generation and dex encoding
dexOutputFile = j.hiddenAPIExtractAndEncode(ctx, configurationName, primary, dexOutputFile, outputFile,
proptools.Bool(j.dexProperties.Uncompress_dex))