Create avbpubkey module in filesystem_creator

And add the generated module to the deps of the product partition
filesystem module.

Test: m soong_generated_product_filesystem_test
Bug: 376505372
Change-Id: Ib3fed01339d2f748d5f3c8445afbea67fc9ef576
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index e9fd513..1253f0d 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -110,13 +110,13 @@
 	return generatedPartitions
 }
 
-func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNames []string) *FsGenState {
+func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNames []string, avbpubkeyGenerated bool) *FsGenState {
 	return ctx.Config().Once(fsGenStateOnceKey, func() interface{} {
 		partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
 		candidates := android.FirstUniqueStrings(android.Concat(partitionVars.ProductPackages, partitionVars.ProductPackagesDebug))
 		candidates = android.Concat(candidates, generatedPrebuiltEtcModuleNames)
 
-		return &FsGenState{
+		fsGenState := FsGenState{
 			depCandidates: candidates,
 			fsDeps: map[string]*multilibDeps{
 				// These additional deps are added according to the cuttlefish system image bp.
@@ -177,6 +177,12 @@
 			fsDepsMutex:               sync.Mutex{},
 			moduleToInstallationProps: map[string]installationProperties{},
 		}
+
+		if avbpubkeyGenerated {
+			(*fsGenState.fsDeps["product"])["system_other_avbpubkey"] = defaultDepCandidateProps(ctx.Config())
+		}
+
+		return &fsGenState
 	}).(*FsGenState)
 }