Package META/system_other_filesystem_config.txt

The build rule will be created in `GenerateAndroidBuildActions` of
systemOtherImage module and will be provided to android_device via a
provider.

system/ will be used as prefix in fsConfigRule to match make behavior

Test: Verified that the file is identical between make and soong
Bug: 388633394
Change-Id: I7a09fcd3a961c3977165ad12e90869e1ad3e16fa
diff --git a/filesystem/system_other.go b/filesystem/system_other.go
index 5309e90..cbfd78b 100644
--- a/filesystem/system_other.go
+++ b/filesystem/system_other.go
@@ -172,9 +172,10 @@
 	builder.Build("build_system_other_hermetic", "build system other")
 
 	fsInfo := FilesystemInfo{
-		Output:         output,
-		OutputHermetic: outputHermetic,
-		RootDir:        stagingDir,
+		Output:           output,
+		OutputHermetic:   outputHermetic,
+		RootDir:          stagingDir,
+		FilesystemConfig: m.generateFilesystemConfig(ctx, stagingDir, stagingDirTimestamp),
 	}
 
 	android.SetProvider(ctx, FilesystemProvider, fsInfo)
@@ -183,6 +184,20 @@
 	ctx.CheckbuildFile(output)
 }
 
+func (s *systemOtherImage) generateFilesystemConfig(ctx android.ModuleContext, stagingDir, stagingDirTimestamp android.Path) android.Path {
+	out := android.PathForModuleOut(ctx, "filesystem_config.txt")
+	ctx.Build(pctx, android.BuildParams{
+		Rule:   fsConfigRule,
+		Input:  stagingDirTimestamp, // assemble the staging directory
+		Output: out,
+		Args: map[string]string{
+			"rootDir": stagingDir.String(),
+			"prefix":  "system/",
+		},
+	})
+	return out
+}
+
 func (f *systemOtherImage) propFileForHermeticImg(ctx android.ModuleContext, builder *android.RuleBuilder, inputPropFile android.Path) android.Path {
 	propFilePinnedTimestamp := android.PathForModuleOut(ctx, "for_target_files", "prop")
 	builder.Command().Textf("cat").Input(inputPropFile).Flag(">").Output(propFilePinnedTimestamp).