diff options
author | 2025-01-14 16:52:14 +0900 | |
---|---|---|
committer | 2025-01-14 16:56:53 +0900 | |
commit | 5f7fa509484a53b45c564a4068f67c89a5cc1bb5 (patch) | |
tree | 2613fe72dc400a3056b85ad9f683972b6dbcfe4f /apex/builder.go | |
parent | 9eb3f2e1779a6c925c7109636133a47cdf4b5d99 (diff) |
apex: use proper partition tag for validations
module.PartitionTag(DeviceConfig) doesn't work for validations because
it tells the physical partition where the apex is installed. It returns
"system" even for vendor APEXes when "VendorPath" is set to
"system/vendor".
For validations, we need logical partition tag. So, "vendor:true" apexes
should be "vendor" even when it's installed in /system/vendor.
Bug: 384988749
Test: m --no-skip-soong-tests
Change-Id: Ib478caa62c98808bc94fe350a2f182f1d2b42a46
Diffstat (limited to 'apex/builder.go')
-rw-r--r-- | apex/builder.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apex/builder.go b/apex/builder.go index d9348c562..daba6f19f 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -1202,6 +1202,22 @@ func runApexLinkerconfigValidation(ctx android.ModuleContext, apexFile android.P return timestamp } +// Can't use PartitionTag() because PartitionTag() returns the partition this module is actually +// installed (e.g. PartitionTag() may return "system" for vendor apex when vendor is linked to /system/vendor) +func (a *apexBundle) partition() string { + if a.SocSpecific() { + return "vendor" + } else if a.DeviceSpecific() { + return "odm" + } else if a.ProductSpecific() { + return "product" + } else if a.SystemExtSpecific() { + return "system_ext" + } else { + return "system" + } +} + // Runs apex_sepolicy_tests // // $ apex-ls -Z {apex_file} > {file_contexts} @@ -1213,7 +1229,7 @@ func runApexSepolicyTests(ctx android.ModuleContext, a *apexBundle, apexFile and Input: apexFile, Output: timestamp, Args: map[string]string{ - "partition_tag": a.PartitionTag(ctx.DeviceConfig()), + "partition_tag": a.partition(), }, }) return timestamp @@ -1240,7 +1256,7 @@ func runApexHostVerifier(ctx android.ModuleContext, a *apexBundle, apexFile andr Input: apexFile, Output: timestamp, Args: map[string]string{ - "partition_tag": a.PartitionTag(ctx.DeviceConfig()), + "partition_tag": a.partition(), }, }) return timestamp |