Build product/odm build.prop with Soong
Bug: 322090587
Test: compare build.prop before and after, boot
Change-Id: I7a7dc785030a0c17e5c09b7f65c978fe9bbcb7a7
diff --git a/android/build_prop.go b/android/build_prop.go
index d48d94d..b127755 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -61,6 +61,8 @@
return ctx.Config().SystemPropFiles(ctx)
} else if partition == "system_ext" {
return ctx.Config().SystemExtPropFiles(ctx)
+ } else if partition == "product" {
+ return ctx.Config().ProductPropFiles(ctx)
}
return nil
}
@@ -80,6 +82,28 @@
return false
}
+// Can't use PartitionTag() because PartitionTag() returns the partition this module is actually
+// installed (e.g. odm module's partition tag can be either "odm" or "vendor")
+func (p *buildPropModule) partition(config DeviceConfig) string {
+ if p.SocSpecific() {
+ return "vendor"
+ } else if p.DeviceSpecific() {
+ return "odm"
+ } else if p.ProductSpecific() {
+ return "product"
+ } else if p.SystemExtSpecific() {
+ return "system_ext"
+ }
+ return "system"
+}
+
+var validPartitions = []string{
+ "system",
+ "system_ext",
+ "product",
+ "odm",
+}
+
func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
p.outputFilePath = PathForModuleOut(ctx, "build.prop").OutputPath
if !ctx.Config().KatiEnabled() {
@@ -88,9 +112,9 @@
return
}
- partition := p.PartitionTag(ctx.DeviceConfig())
- if partition != "system" && partition != "system_ext" {
- ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" and \"system_ext\" are supported", partition)
+ partition := p.partition(ctx.DeviceConfig())
+ if !InList(partition, validPartitions) {
+ ctx.PropertyErrorf("partition", "unsupported partition %q: only %q are supported", partition, validPartitions)
return
}
@@ -118,7 +142,7 @@
cmd.FlagWithInput("--platform-preview-sdk-fingerprint-file=", ApiFingerprintPath(ctx))
cmd.FlagWithInput("--product-config=", PathForModuleSrc(ctx, proptools.String(p.properties.Product_config)))
cmd.FlagWithArg("--partition=", partition)
- cmd.FlagForEachInput("--prop-files=", ctx.Config().SystemPropFiles(ctx))
+ cmd.FlagForEachInput("--prop-files=", p.propFiles(ctx))
cmd.FlagWithOutput("--out=", p.outputFilePath)
postProcessCmd := rule.Command().BuiltTool("post_process_props")