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
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 12201a3..83eb56a 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -4526,9 +4526,10 @@
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkBootDexJarPath(t, ctx, ".intermediates/myapex.deapexer/android_common/deapexer/javalib/libfoo.jar")
- // Make sure that the dex file from the prebuilt_apex does NOT contribute to the hiddenapi index
- // file.
- checkHiddenAPIIndexInputs(t, ctx, ``)
+ // Make sure that the dex file from the prebuilt_apex contributes to the hiddenapi index file.
+ checkHiddenAPIIndexInputs(t, ctx, `
+.intermediates/libfoo/android_common_myapex/hiddenapi/index.csv
+`)
})
t.Run("prebuilt with source library preferred", func(t *testing.T) {
@@ -4599,9 +4600,10 @@
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkBootDexJarPath(t, ctx, ".intermediates/myapex.deapexer/android_common/deapexer/javalib/libfoo.jar")
- // Make sure that the dex file from the prebuilt_apex does NOT contribute to the hiddenapi index
- // file.
- checkHiddenAPIIndexInputs(t, ctx, ``)
+ // Make sure that the dex file from the prebuilt_apex contributes to the hiddenapi index file.
+ checkHiddenAPIIndexInputs(t, ctx, `
+.intermediates/prebuilt_libfoo/android_common_myapex/hiddenapi/index.csv
+`)
})
t.Run("prebuilt with source apex preferred", func(t *testing.T) {
@@ -4698,9 +4700,10 @@
ctx := testDexpreoptWithApexes(t, bp, "", transform)
checkBootDexJarPath(t, ctx, ".intermediates/myapex.deapexer/android_common/deapexer/javalib/libfoo.jar")
- // Make sure that the dex file from the prebuilt_apex does NOT contribute to the hiddenapi index
- // file.
- checkHiddenAPIIndexInputs(t, ctx, ``)
+ // Make sure that the dex file from the prebuilt_apex contributes to the hiddenapi index file.
+ checkHiddenAPIIndexInputs(t, ctx, `
+.intermediates/prebuilt_libfoo/android_common_prebuilt_myapex/hiddenapi/index.csv
+`)
})
}