Use RELEASE_CREATE_ACONFIG_STORAGE_FILE to create aconfig files

This matches the kati packaging system implementation

Test: verified that these files do not appear in `fileList` of
generic_system_image when building with a TARGET_RELEASE that is not
`trunk_staging` or `trunk`
Bug: 369678122

Change-Id: Ieb585a8e1d20bc939fddfad9bafcecaaf767fa4e
diff --git a/android/config.go b/android/config.go
index e519760..a2bf533 100644
--- a/android/config.go
+++ b/android/config.go
@@ -287,6 +287,10 @@
 	return c.config.productVariables.GetBuildFlagBool("RELEASE_READ_FROM_NEW_STORAGE")
 }
 
+func (c Config) ReleaseCreateAconfigStorageFile() bool {
+	return c.config.productVariables.GetBuildFlagBool("RELEASE_CREATE_ACONFIG_STORAGE_FILE")
+}
+
 // A DeviceConfig object represents the configuration for a particular device
 // being built. For now there will only be one of these, but in the future there
 // may be multiple devices being built.
diff --git a/filesystem/aconfig_files.go b/filesystem/aconfig_files.go
index 8af2ffa..608fccd 100644
--- a/filesystem/aconfig_files.go
+++ b/filesystem/aconfig_files.go
@@ -76,10 +76,13 @@
 		cmd.ImplicitOutput(outputPath)
 		f.appendToEntry(ctx, outputPath)
 	}
-	generatePartitionAconfigStorageFile("package_map", "package.map")
-	generatePartitionAconfigStorageFile("flag_map", "flag.map")
-	generatePartitionAconfigStorageFile("flag_val", "flag.val")
-	generatePartitionAconfigStorageFile("flag_info", "flag.info")
+
+	if ctx.Config().ReleaseCreateAconfigStorageFile() {
+		generatePartitionAconfigStorageFile("package_map", "package.map")
+		generatePartitionAconfigStorageFile("flag_map", "flag.map")
+		generatePartitionAconfigStorageFile("flag_val", "flag.val")
+		generatePartitionAconfigStorageFile("flag_info", "flag.info")
+	}
 
 	android.WriteExecutableFileRuleVerbatim(ctx, aconfigFlagsBuilderPath, sb.String())
 }