summaryrefslogtreecommitdiff
path: root/java/rro.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2021-06-03 19:36:41 +0000
committer Spandan Das <spandandas@google.com> 2021-06-08 17:53:31 +0000
commit5d1b929f216513fa2c6b96d7d157289019018086 (patch)
tree4111b6f029013e2ce28b98815d65410b0576af52 /java/rro.go
parentad66593085509b7e1b1f3e9a61b7c7b05d832788 (diff)
Port module_partition logic for RRO from Make to Soong
The default partition for RRO is "product/" in Make, but it was "system/" in Soong. This CL ports the logic from Make to Soong To implement this, a new function PathForModuleInPartitionInstall is created that enables callers to provide the relevant partition Bug: 158407753 Test: from build/soong, ran go test ./java Change-Id: I05b02eae7fe57189aaad5109c26cccc5823518ef
Diffstat (limited to 'java/rro.go')
-rw-r--r--java/rro.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/java/rro.go b/java/rro.go
index 2e58c042f..0b4d0916a 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -90,6 +90,22 @@ type RuntimeResourceOverlayModule interface {
Theme() string
}
+// RRO's partition logic is different from the partition logic of other modules defined in soong/android/paths.go
+// The default partition for RRO is "/product" and not "/system"
+func rroPartition(ctx android.ModuleContext) string {
+ var partition string
+ if ctx.DeviceSpecific() {
+ partition = ctx.DeviceConfig().OdmPath()
+ } else if ctx.SocSpecific() {
+ partition = ctx.DeviceConfig().VendorPath()
+ } else if ctx.SystemExtSpecific() {
+ partition = ctx.DeviceConfig().SystemExtPath()
+ } else {
+ partition = ctx.DeviceConfig().ProductPath()
+ }
+ return partition
+}
+
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
sdkDep := decodeSdkDep(ctx, android.SdkContext(r))
if sdkDep.hasFrameworkLibs() {
@@ -137,7 +153,8 @@ func (r *RuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleC
r.certificate = certificates[0]
r.outputFile = signed
- r.installDir = android.PathForModuleInstall(ctx, "overlay", String(r.properties.Theme))
+ partition := rroPartition(ctx)
+ r.installDir = android.PathForModuleInPartitionInstall(ctx, partition, "overlay", String(r.properties.Theme))
ctx.InstallFile(r.installDir, r.outputFile.Base(), r.outputFile)
}