Generate META/dynamic_partitions_info.txt of target_files.zip

dynamic_partitions_info.txt is generated by
`dump-dynamic-partitions-info` in make, and its contents are similar to
misc_info.txt of the device's super_image.

This CL creates this file in target_files.zip. The common contents are
refactored to a helper function in super_image, and this helper function
will be used to generate misc_info.txt of the super_image, and
META/dynamic_partitions_info.txt

Bug: 399788100
Test: Built META/dynamic_partitions_info.txt
Test: diff between make and soong (after sort)
< build_super_empty_partition=true

Change-Id: Ifd8ef89008d8ce3a2baaa73466236325b635c6e5
---
>
> ab_update=true
3c4
< dynamic_partition_list=    product system system_ext system_dlkm odm vendor vendor_dlkm odm_dlkm
---
> dynamic_partition_list=odm odm_dlkm product system system_dlkm system_ext vendor vendor_dlkm
7c8
< super_google_system_dynamic_partitions_partition_list=    product system system_ext system_dlkm
---
> super_google_system_dynamic_partitions_partition_list=product system system_ext system_dlkm
9c10
< super_google_vendor_dynamic_partitions_partition_list=    odm vendor vendor_dlkm odm_dlkm
---
> super_google_vendor_dynamic_partitions_partition_list=odm vendor vendor_dlkm odm_dlkm

There are some formatting diffs. `build_super_empty_image` seems to be
main missing info. I have added a TODO to add that.

Change-Id: I68d0a43b0c3e53ea88246784392cd7706dd2a9e9
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index a2fa0f0..6718320 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -622,6 +622,17 @@
 	installedApexKeys = android.SortedUniquePaths(installedApexKeys) // Sort by keypath to match make
 	builder.Command().Text("cat").Inputs(installedApexKeys).Textf(" >> %s/META/apexkeys.txt", targetFilesDir.String())
 
+	if a.partitionProps.Super_partition_name != nil {
+		superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag)
+		if info, ok := android.OtherModuleProvider(ctx, superPartition, SuperImageProvider); ok {
+			// dynamic_partitions_info.txt
+			// TODO (b/390192334): Add `building_super_empty_partition=true`
+			builder.Command().Text("cp").Input(info.DynamicPartitionsInfo).Textf(" %s/META/", targetFilesDir.String())
+		} else {
+			ctx.ModuleErrorf("Super partition %s does set SuperImageProvider\n", superPartition.Name())
+		}
+	}
+
 }
 
 type ApexKeyPathInfo struct {