Propagate permitted packages to sdk snapshot
Previously, permitted_packages were not copied to the sdk snapshot.
This change corrects that.
Bug: 193763688
Test: m nothing
- Added unit tests, which all failed and then fixed the tests.
Change-Id: I4560987f746f78c0ae706058195b6db4bea438aa
diff --git a/java/java.go b/java/java.go
index e74185e..ef2f510 100644
--- a/java/java.go
+++ b/java/java.go
@@ -580,6 +580,10 @@
JarToExport android.Path `android:"arch_variant"`
AidlIncludeDirs android.Paths
+
+ // The list of permitted packages that need to be passed to the prebuilts as they are used to
+ // create the updatable-bcp-packages.txt file.
+ PermittedPackages []string
}
func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberContext, variant android.Module) {
@@ -588,6 +592,8 @@
p.JarToExport = ctx.MemberType().(*librarySdkMemberType).jarToExportGetter(ctx, j)
p.AidlIncludeDirs = j.AidlIncludeDirs()
+
+ p.PermittedPackages = j.PermittedPackagesForUpdatableBootJars()
}
func (p *librarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
@@ -606,6 +612,10 @@
propertySet.AddProperty("jars", []string{snapshotRelativeJavaLibPath})
}
+ if len(p.PermittedPackages) > 0 {
+ propertySet.AddProperty("permitted_packages", p.PermittedPackages)
+ }
+
// Do not copy anything else to the snapshot.
if memberType.onlyCopyJarToSnapshot {
return
@@ -1126,6 +1136,10 @@
Installable *bool
+ // If not empty, classes are restricted to the specified packages and their sub-packages.
+ // This information is used to generate the updatable-bcp-packages.txt file.
+ Permitted_packages []string
+
// List of shared java libs that this module has dependencies to
Libs []string