Include partition tag in apexkeys.txt.
The partition tag helps merge_target_files.py determine
which apexkeys.txt to select from the framework partial
target files and which to select from the vendor partial
target files. The partition tag is the pysical partition
name, for example, a system_ext module on a device where
system_ext is at system/system_ext has a system
partition tag.
Bug: 138942268
Change-Id: Ia07887b34f1aa77dae94ef23610dfef83c1a5849
diff --git a/android/module.go b/android/module.go
index 057a5c7..d57abd1 100644
--- a/android/module.go
+++ b/android/module.go
@@ -894,6 +894,40 @@
return Bool(m.commonProperties.System_ext_specific)
}
+func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
+ partition := "system"
+ if m.SocSpecific() {
+ // A SoC-specific module could be on the vendor partition at
+ // "vendor" or the system partition at "system/vendor".
+ if config.VendorPath() == "vendor" {
+ partition = "vendor"
+ }
+ } else if m.DeviceSpecific() {
+ // A device-specific module could be on the odm partition at
+ // "odm", the vendor partition at "vendor/odm", or the system
+ // partition at "system/vendor/odm".
+ if config.OdmPath() == "odm" {
+ partition = "odm"
+ } else if strings.HasPrefix(config.OdmPath (), "vendor/") {
+ partition = "vendor"
+ }
+ } else if m.ProductSpecific() {
+ // A product-specific module could be on the product partition
+ // at "product" or the system partition at "system/product".
+ if config.ProductPath() == "product" {
+ partition = "product"
+ }
+ } else if m.SystemExtSpecific() {
+ // A system_ext-specific module could be on the system_ext
+ // partition at "system_ext" or the system partition at
+ // "system/system_ext".
+ if config.SystemExtPath() == "system_ext" {
+ partition = "system_ext"
+ }
+ }
+ return partition
+}
+
func (m *ModuleBase) Enabled() bool {
if m.commonProperties.Enabled == nil {
return !m.Os().DefaultDisabled