Merge "Make system partition import system_ext's aconfig flags" into main
diff --git a/filesystem/aconfig_files.go b/filesystem/aconfig_files.go
index c80ae03..492ec69 100644
--- a/filesystem/aconfig_files.go
+++ b/filesystem/aconfig_files.go
@@ -17,26 +17,55 @@
import (
"android/soong/android"
+ "github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
-func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, dir android.OutputPath) {
- if !proptools.Bool(f.properties.Gen_aconfig_flags_pb) {
- return
- }
+type installedAconfigFlagsInfo struct {
+ aconfigFiles android.Paths
+}
+var installedAconfigFlagsProvider = blueprint.NewProvider[installedAconfigFlagsInfo]()
+
+type importAconfigDepDag struct {
+ blueprint.BaseDependencyTag
+}
+
+var importAconfigDependencyTag = interPartitionDepTag{}
+
+func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, dir android.OutputPath) {
var caches []android.Path
for _, ps := range specs {
caches = append(caches, ps.GetAconfigPaths()...)
}
+
+ ctx.VisitDirectDepsWithTag(importAconfigDependencyTag, func(m android.Module) {
+ info, ok := android.OtherModuleProvider(ctx, m, installedAconfigFlagsProvider)
+ if !ok {
+ ctx.ModuleErrorf("expected dependency %s to have an installedAconfigFlagsProvider", m.Name())
+ return
+ }
+ caches = append(caches, info.aconfigFiles...)
+ })
caches = android.SortedUniquePaths(caches)
+ android.SetProvider(ctx, installedAconfigFlagsProvider, installedAconfigFlagsInfo{
+ aconfigFiles: caches,
+ })
+
+ if !proptools.Bool(f.properties.Gen_aconfig_flags_pb) {
+ return
+ }
+
+ container := f.PartitionType()
+
installAconfigFlagsPath := dir.Join(ctx, "etc", "aconfig_flags.pb")
cmd := builder.Command().
BuiltTool("aconfig").
Text(" dump-cache --dedup --format protobuf --out").
Output(installAconfigFlagsPath).
- Textf("--filter container:%s", f.PartitionType())
+ Textf("--filter container:%s+state:ENABLED", container).
+ Textf("--filter container:%s+permission:READ_WRITE", container)
for _, cache := range caches {
cmd.FlagWithInput("--cache ", cache)
}
@@ -49,7 +78,7 @@
outputPath := installAconfigStorageDir.Join(ctx, fileName)
builder.Command().
BuiltTool("aconfig").
- FlagWithArg("create-storage --container ", f.PartitionType()).
+ FlagWithArg("create-storage --container ", container).
FlagWithArg("--file ", fileType).
FlagWithOutput("--out ", outputPath).
FlagWithArg("--cache ", installAconfigFlagsPath.String())
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index eb39a78..4799d0d 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -181,6 +181,11 @@
// Install aconfig_flags.pb file for the modules installed in this partition.
Gen_aconfig_flags_pb *bool
+ // List of names of other filesystem partitions to import their aconfig flags from.
+ // This is used for the system partition to import system_ext's aconfig flags, as currently
+ // those are considered one "container": aosp/3261300
+ Import_aconfig_flags_from []string
+
Fsverity fsverityProperties
// If this property is set to true, the filesystem will call ctx.UncheckedModule(), causing
@@ -309,6 +314,9 @@
if f.properties.Android_filesystem_deps.System_ext != nil {
ctx.AddDependency(ctx.Module(), interPartitionDependencyTag, proptools.String(f.properties.Android_filesystem_deps.System_ext))
}
+ for _, partition := range f.properties.Import_aconfig_flags_from {
+ ctx.AddDependency(ctx.Module(), importAconfigDependencyTag, partition)
+ }
}
type fsType int
@@ -1079,6 +1087,12 @@
}
thisPartition := f.PartitionType()
if thisPartition != "vendor" && thisPartition != "product" {
+ if f.properties.Android_filesystem_deps.System != nil {
+ ctx.PropertyErrorf("android_filesystem_deps.system", "only vendor or product partitions can use android_filesystem_deps")
+ }
+ if f.properties.Android_filesystem_deps.System_ext != nil {
+ ctx.PropertyErrorf("android_filesystem_deps.system_ext", "only vendor or product partitions can use android_filesystem_deps")
+ }
return
}
ctx.WalkDeps(func(child, parent android.Module) bool {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 4f1a34f..4e1ca9e 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -267,6 +267,10 @@
fsProps.Base_dir = proptools.StringPtr("system")
fsProps.Dirs = proptools.NewSimpleConfigurable(commonPartitionDirs)
fsProps.Security_patch = proptools.StringPtr(ctx.Config().PlatformSecurityPatch())
+
+ if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
+ fsProps.Import_aconfig_flags_from = []string{generatedModuleNameForPartition(ctx.Config(), "system_ext")}
+ }
case "system_ext":
if partitionVars.ProductFsverityGenerateMetadata {
fsProps.Fsverity.Inputs = []string{