Introduce prebuilt_any module type

prebuilt_any is a "wildcard" module type that allows installing the
files in any subdirectories within the partition. This module is only
used for converting the PRODUCT_COPY_FILES in fsgen, and should not be
written in the bp files.

Test: m nothing --no-skip-soong-tests
Bug: 375053752
Change-Id: Ic0839b0dbbfa6b012c6b920eecf4ebc6fed8d51f
diff --git a/fsgen/prebuilt_etc_modules_gen.go b/fsgen/prebuilt_etc_modules_gen.go
index e028b1d..0adf7a1 100644
--- a/fsgen/prebuilt_etc_modules_gen.go
+++ b/fsgen/prebuilt_etc_modules_gen.go
@@ -299,6 +299,7 @@
 			etcInstallPathKey = etcInstallPath
 		}
 	}
+	moduleFactory := etcInstallPathToFactoryList[etcInstallPathKey]
 	relDestDirFromInstallDirBase, _ := filepath.Rel(etcInstallPathKey, destDir)
 
 	for fileIndex := range maxLen {
@@ -348,6 +349,11 @@
 				})
 			}
 		} else {
+			// If dsts property has to be set and the selected module type is prebuilt_root,
+			// use prebuilt_any instead.
+			if etcInstallPathKey == "" {
+				moduleFactory = etc.PrebuiltAnyFactory
+			}
 			modulePropsPtr.Srcs = srcBaseFiles
 			dsts := []string{}
 			for _, installBaseFile := range installBaseFiles {
@@ -356,7 +362,7 @@
 			modulePropsPtr.Dsts = dsts
 		}
 
-		ctx.CreateModuleInDirectory(etcInstallPathToFactoryList[etcInstallPathKey], srcDir, propsList...)
+		ctx.CreateModuleInDirectory(moduleFactory, srcDir, propsList...)
 		moduleNames = append(moduleNames, moduleName)
 	}