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/sdk_library.go b/java/sdk_library.go
index 2b71857..135981c 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1897,6 +1897,10 @@
 
 	// If set to true, compile dex files for the stubs. Defaults to false.
 	Compile_dex *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
 }
 
 type SdkLibraryImport struct {
@@ -2510,6 +2514,8 @@
 
 	// The paths to the doctag files to add to the prebuilt.
 	Doctag_paths android.Paths
+
+	Permitted_packages []string
 }
 
 type scopeProperties struct {
@@ -2550,6 +2556,7 @@
 	s.Shared_library = proptools.BoolPtr(sdk.sharedLibrary())
 	s.Compile_dex = sdk.dexProperties.Compile_dex
 	s.Doctag_paths = sdk.doctagPaths
+	s.Permitted_packages = sdk.PermittedPackagesForUpdatableBootJars()
 }
 
 func (s *sdkLibrarySdkMemberProperties) AddToPropertySet(ctx android.SdkMemberContext, propertySet android.BpPropertySet) {
@@ -2562,6 +2569,9 @@
 	if s.Compile_dex != nil {
 		propertySet.AddProperty("compile_dex", *s.Compile_dex)
 	}
+	if len(s.Permitted_packages) > 0 {
+		propertySet.AddProperty("permitted_packages", s.Permitted_packages)
+	}
 
 	for _, apiScope := range allApiScopes {
 		if properties, ok := s.Scopes[apiScope]; ok {