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
This commit is contained in:
Paul Duffin
2021-07-15 14:14:41 +01:00
parent bd14f9a952
commit 869de147ab
4 changed files with 40 additions and 0 deletions

View File

@@ -580,6 +580,10 @@ type librarySdkMemberProperties struct {
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 @@ func (p *librarySdkMemberProperties) PopulateFromVariant(ctx android.SdkMemberCo
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 @@ func (p *librarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberConte
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 @@ type ImportProperties struct {
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