Cleanup ImageInterface.SetImageVariation

This change modifies the interface method of
ImageInterface.SetImageVariation so that the image variation is set
directly at the caller image variation module, instead of passing the
pointer to set the image variation.

Test: m nothing
Change-Id: I8eadb5149365530243e19a8cd37eb49d335fbeef
This commit is contained in:
Jihoon Kang
2024-06-13 21:25:45 +00:00
parent 71825167e0
commit 7583e835f7
9 changed files with 30 additions and 35 deletions

View File

@@ -628,30 +628,29 @@ func squashRamdiskSrcs(m *Module) {
}
}
func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
m := module.(*Module)
func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string) {
if variant == android.RamdiskVariation {
m.MakeAsPlatform()
squashRamdiskSrcs(m)
c.MakeAsPlatform()
squashRamdiskSrcs(c)
} else if variant == android.VendorRamdiskVariation {
m.MakeAsPlatform()
squashVendorRamdiskSrcs(m)
c.MakeAsPlatform()
squashVendorRamdiskSrcs(c)
} else if variant == android.RecoveryVariation {
m.MakeAsPlatform()
squashRecoverySrcs(m)
c.MakeAsPlatform()
squashRecoverySrcs(c)
} else if strings.HasPrefix(variant, VendorVariation) {
m.Properties.ImageVariation = VendorVariation
c.Properties.ImageVariation = VendorVariation
if strings.HasPrefix(variant, VendorVariationPrefix) {
m.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
c.Properties.VndkVersion = strings.TrimPrefix(variant, VendorVariationPrefix)
}
squashVendorSrcs(m)
squashVendorSrcs(c)
} else if strings.HasPrefix(variant, ProductVariation) {
m.Properties.ImageVariation = ProductVariation
c.Properties.ImageVariation = ProductVariation
if strings.HasPrefix(variant, ProductVariationPrefix) {
m.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
c.Properties.VndkVersion = strings.TrimPrefix(variant, ProductVariationPrefix)
}
squashProductSrcs(m)
squashProductSrcs(c)
}
if c.NeedsVendorPublicLibraryVariants() &&