Autogenerate a vendor/ partition
If BUILDING_VENDOR_IMAGE is true
Bug: 374371755
Test: verified that vendor module is not created for aosp_x86_64
Test: verified that vendor module is created for aosp_cf_x86_64_phone
Change-Id: Idb9c017b933be966e3aa4f863d15e837346a1f82
diff --git a/android/config.go b/android/config.go
index 5132c62..b70f6ac 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1524,6 +1524,10 @@
return "vendor"
}
+func (c *deviceConfig) BuildingVendorImage() bool {
+ return proptools.Bool(c.config.productVariables.BuildingVendorImage)
+}
+
func (c *deviceConfig) CurrentApiLevelForVendorModules() string {
return StringDefault(c.config.productVariables.DeviceCurrentApiLevelForVendorModules, "current")
}
diff --git a/android/variable.go b/android/variable.go
index 73c0d0e..f7392d1 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -337,10 +337,11 @@
HWASanIncludePaths []string `json:",omitempty"`
HWASanExcludePaths []string `json:",omitempty"`
- VendorPath *string `json:",omitempty"`
- OdmPath *string `json:",omitempty"`
- ProductPath *string `json:",omitempty"`
- SystemExtPath *string `json:",omitempty"`
+ VendorPath *string `json:",omitempty"`
+ BuildingVendorImage *bool `json:",omitempty"`
+ OdmPath *string `json:",omitempty"`
+ ProductPath *string `json:",omitempty"`
+ SystemExtPath *string `json:",omitempty"`
ClangTidy *bool `json:",omitempty"`
TidyChecks *string `json:",omitempty"`
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 6ff9645..8fcaa20 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -101,6 +101,9 @@
if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
generatedPartitions = append(generatedPartitions, "system_ext")
}
+ if ctx.DeviceConfig().BuildingVendorImage() && ctx.DeviceConfig().VendorPath() == "vendor" {
+ generatedPartitions = append(generatedPartitions, "vendor")
+ }
return &FsGenState{
depCandidates: candidates,
@@ -340,6 +343,9 @@
if android.InList("system_ext", f.properties.Generated_partition_types) {
partitionProps.System_ext_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "system_ext"))
}
+ if android.InList("vendor", f.properties.Generated_partition_types) {
+ partitionProps.Vendor_partition_name = proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "vendor"))
+ }
ctx.CreateModule(filesystem.AndroidDeviceFactory, baseProps, partitionProps)
}