Generate apex_info.pb,care_map.pb,vbmeta_digest.txt in target_files

These files are implicit outputs created by `add_img_to_target_files`

Bug: 399788207
Test: Built soong and make target_files.zip
Test: apex_info.pb is bit-identical
Test: care_map.pb is _not_ bit-identical (likely because of notice
files)
Test: vbmeta_digest.txt is _not_ bit-identical (vbmeta.img is not
bit-identical)

Change-Id: I1bfc1a738895dc23fef41e0e6aa08d42295b0bfe
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 78afbf5..5911a4e 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -652,6 +652,8 @@
 	if a.miscInfo != nil {
 		builder.Command().Textf("cp").Input(a.miscInfo).Textf(" %s/META/", targetFilesDir.String())
 	}
+	// apex_info.pb, care_map.pb, vbmeta_digest.txt
+	a.addImgToTargetFiles(ctx, builder, targetFilesDir.String())
 
 	if a.partitionProps.Super_partition_name != nil {
 		superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag)
@@ -703,6 +705,22 @@
 	return miscInfo
 }
 
+// addImgToTargetFiles invokes `add_img_to_target_files` and creates the following files in META/
+// - apex_info.pb
+// - care_map.pb
+// - vbmeta_digest.txt
+func (a *androidDevice) addImgToTargetFiles(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir string) {
+	mkbootimg := ctx.Config().HostToolPath(ctx, "mkbootimg")
+	builder.Command().
+		Textf("PATH=%s:$PATH", ctx.Config().HostToolDir()).
+		Textf("MKBOOTIMG=%s", mkbootimg).
+		Implicit(mkbootimg).
+		BuiltTool("add_img_to_target_files").
+		Flag("-a -v -p").
+		Flag(ctx.Config().HostToolDir()).
+		Text(targetFilesDir)
+}
+
 type ApexKeyPathInfo struct {
 	ApexKeyPath android.Path
 }