Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
e.g. ctx.Config().BootJars().
Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().
Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.
Bug: 159683330
Test: m framework-tethering
dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
Verify that there are >0 hiddenapi entries.
Add java_sdk_library_import prefer=true for framework-tethering
and repeat the above to verify that there are 0 hiddenapi entries.
Apply this change, repeat above and verify that there are the same # of entries as before.
Remove the prebuilt for framework-tethering
Repeat the above and verify that there is no change to the # of entries
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
diff --git a/java/sdk_library.go b/java/sdk_library.go
index e64310f..679c075 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1088,15 +1088,22 @@
// Creates the implementation java library
func (module *SdkLibrary) createImplLibrary(mctx android.DefaultableHookContext) {
+
+ moduleNamePtr := proptools.StringPtr(module.BaseModuleName())
+
props := struct {
- Name *string
- Visibility []string
- Instrument bool
+ Name *string
+ Visibility []string
+ Instrument bool
+ ConfigurationName *string
}{
Name: proptools.StringPtr(module.implLibraryModuleName()),
Visibility: module.sdkLibraryProperties.Impl_library_visibility,
// Set the instrument property to ensure it is instrumented when instrumentation is required.
Instrument: true,
+
+ // Make the created library behave as if it had the same name as this module.
+ ConfigurationName: moduleNamePtr,
}
properties := []interface{}{