Add system_ext support to build_prop module

As some partitions have build.prop under etc/, this change adds
relative_install_path property to build_prop module. Also this change
adds system_ext related Soong variables and system_ext support in
gen_build_prop.py.

Bug: 322090587
Test: build and compare system_ext/etc/build.prop
Change-Id: I416662b8bae09383af0cdd3d8444a5c300006b7b
diff --git a/android/build_prop.go b/android/build_prop.go
index 14e5e23..d48d94d 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -37,6 +37,9 @@
 
 	// Path to a JSON file containing product configs.
 	Product_config *string `android:"path"`
+
+	// Optional subdirectory under which this file is installed into
+	Relative_install_path *string
 }
 
 type buildPropModule struct {
@@ -56,6 +59,8 @@
 	partition := p.PartitionTag(ctx.DeviceConfig())
 	if partition == "system" {
 		return ctx.Config().SystemPropFiles(ctx)
+	} else if partition == "system_ext" {
+		return ctx.Config().SystemExtPropFiles(ctx)
 	}
 	return nil
 }
@@ -84,8 +89,8 @@
 	}
 
 	partition := p.PartitionTag(ctx.DeviceConfig())
-	if partition != "system" {
-		ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" is supported", partition)
+	if partition != "system" && partition != "system_ext" {
+		ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" and \"system_ext\" are supported", partition)
 		return
 	}
 
@@ -134,7 +139,7 @@
 
 	rule.Build(ctx.ModuleName(), "generating build.prop")
 
-	p.installPath = PathForModuleInstall(ctx)
+	p.installPath = PathForModuleInstall(ctx, proptools.String(p.properties.Relative_install_path))
 	ctx.InstallFile(p.installPath, p.stem(), p.outputFilePath)
 
 	ctx.SetOutputFiles(Paths{p.outputFilePath}, "")