diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go index bd4a9d599..bc354790f 100644 --- a/apex/platform_bootclasspath_test.go +++ b/apex/platform_bootclasspath_test.go @@ -398,6 +398,7 @@ func TestPlatformBootclasspath_AlwaysUsePrebuiltSdks(t *testing.T) { name: "foo", prefer: false, shared_library: false, + permitted_packages: ["foo"], public: { jars: ["sdk_library/public/foo-stubs.jar"], stub_srcs: ["sdk_library/public/foo_stub_sources"], diff --git a/java/java.go b/java/java.go index 727cef5ee..bbed42def 100644 --- a/java/java.go +++ b/java/java.go @@ -1192,6 +1192,12 @@ type Import struct { minSdkVersion android.SdkSpec } +var _ PermittedPackagesForUpdatableBootJars = (*Import)(nil) + +func (j *Import) PermittedPackagesForUpdatableBootJars() []string { + return j.properties.Permitted_packages +} + func (j *Import) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec { return android.SdkSpecFrom(ctx, String(j.properties.Sdk_version)) } diff --git a/java/sdk_library.go b/java/sdk_library.go index c0e566283..8c664383d 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -1991,6 +1991,12 @@ func sdkLibraryImportFactory() android.Module { return module } +var _ PermittedPackagesForUpdatableBootJars = (*SdkLibraryImport)(nil) + +func (module *SdkLibraryImport) PermittedPackagesForUpdatableBootJars() []string { + return module.properties.Permitted_packages +} + func (module *SdkLibraryImport) Prebuilt() *android.Prebuilt { return &module.prebuilt } diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go index c30324a85..412e80682 100644 --- a/sdk/bootclasspath_fragment_sdk_test.go +++ b/sdk/bootclasspath_fragment_sdk_test.go @@ -532,6 +532,12 @@ sdk_snapshot { out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv snapshot/hiddenapi/index.csv `, rule) + + // Make sure that the permitted packages from the prebuilts end up in the + // updatable-bcp-packages.txt file. + rule = module.Output("updatable-bcp-packages.txt") + expectedContents := `'mybootlib\nmyothersdklibrary\n'` + android.AssertStringEquals(t, "updatable-bcp-packages.txt", expectedContents, rule.Args["content"]) }), snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot), snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),