Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 225ad7e8 authored by Colin Cross's avatar Colin Cross Committed by Gerrit Code Review
Browse files

Merge "Remove cc.moduleContext override of android.ModuleContext.*Specific" into main

parents 4daed5a0 ea30d85a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ type Module interface {
	InstallInDebugRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallInOdm() bool
	InstallInProduct() bool
	InstallInVendor() bool
	InstallForceOS() (*OsType, *ArchType)
	PartitionTag(DeviceConfig) string
@@ -1399,6 +1401,14 @@ func (m *ModuleBase) InstallInRecovery() bool {
	return Bool(m.commonProperties.Recovery)
}

func (m *ModuleBase) InstallInOdm() bool {
	return false
}

func (m *ModuleBase) InstallInProduct() bool {
	return false
}

func (m *ModuleBase) InstallInVendor() bool {
	return Bool(m.commonProperties.Vendor) || Bool(m.commonProperties.Soc_specific) || Bool(m.commonProperties.Proprietary)
}
+10 −0
Original line number Diff line number Diff line
@@ -181,6 +181,8 @@ type ModuleContext interface {
	InstallInDebugRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallInOdm() bool
	InstallInProduct() bool
	InstallInVendor() bool
	InstallForceOS() (*OsType, *ArchType)

@@ -438,6 +440,14 @@ func (m *moduleContext) InstallForceOS() (*OsType, *ArchType) {
	return m.module.InstallForceOS()
}

func (m *moduleContext) InstallInOdm() bool {
	return m.module.InstallInOdm()
}

func (m *moduleContext) InstallInProduct() bool {
	return m.module.InstallInProduct()
}

func (m *moduleContext) InstallInVendor() bool {
	return m.module.InstallInVendor()
}
+33 −3
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ type ModuleInstallPathContext interface {
	InstallInDebugRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallInOdm() bool
	InstallInProduct() bool
	InstallInVendor() bool
	InstallForceOS() (*OsType, *ArchType)
}

@@ -152,6 +155,18 @@ func (ctx *baseModuleContextToModuleInstallPathContext) InstallInRoot() bool {
	return ctx.Module().InstallInRoot()
}

func (ctx *baseModuleContextToModuleInstallPathContext) InstallInOdm() bool {
	return ctx.Module().InstallInOdm()
}

func (ctx *baseModuleContextToModuleInstallPathContext) InstallInProduct() bool {
	return ctx.Module().InstallInProduct()
}

func (ctx *baseModuleContextToModuleInstallPathContext) InstallInVendor() bool {
	return ctx.Module().InstallInVendor()
}

func (ctx *baseModuleContextToModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) {
	return ctx.Module().InstallForceOS()
}
@@ -1866,11 +1881,11 @@ func modulePartition(ctx ModuleInstallPathContext, device bool) string {
				// the layout of recovery partion is the same as that of system partition
				partition = "recovery/root/system"
			}
		} else if ctx.SocSpecific() {
		} else if ctx.SocSpecific() || ctx.InstallInVendor() {
			partition = ctx.DeviceConfig().VendorPath()
		} else if ctx.DeviceSpecific() {
		} else if ctx.DeviceSpecific() || ctx.InstallInOdm() {
			partition = ctx.DeviceConfig().OdmPath()
		} else if ctx.ProductSpecific() {
		} else if ctx.ProductSpecific() || ctx.InstallInProduct() {
			partition = ctx.DeviceConfig().ProductPath()
		} else if ctx.SystemExtSpecific() {
			partition = ctx.DeviceConfig().SystemExtPath()
@@ -2066,6 +2081,9 @@ type testModuleInstallPathContext struct {
	inDebugRamdisk  bool
	inRecovery      bool
	inRoot          bool
	inOdm           bool
	inProduct       bool
	inVendor        bool
	forceOS         *OsType
	forceArch       *ArchType
}
@@ -2108,6 +2126,18 @@ func (m testModuleInstallPathContext) InstallInRoot() bool {
	return m.inRoot
}

func (m testModuleInstallPathContext) InstallInOdm() bool {
	return m.inOdm
}

func (m testModuleInstallPathContext) InstallInProduct() bool {
	return m.inProduct
}

func (m testModuleInstallPathContext) InstallInVendor() bool {
	return m.inVendor
}

func (m testModuleInstallPathContext) InstallForceOS() (*OsType, *ArchType) {
	return m.forceOS, m.forceArch
}
+3 −3
Original line number Diff line number Diff line
@@ -194,13 +194,13 @@ func checkInstallPartition(t *testing.T, ctx *android.TestContext, name, variant
		}
	}
	socSpecific := func(m *Module) bool {
		return m.SocSpecific() || m.socSpecificModuleContext()
		return m.SocSpecific() || m.InstallInVendor()
	}
	deviceSpecific := func(m *Module) bool {
		return m.DeviceSpecific() || m.deviceSpecificModuleContext()
		return m.DeviceSpecific() || m.InstallInOdm()
	}
	productSpecific := func(m *Module) bool {
		return m.ProductSpecific() || m.productSpecificModuleContext()
		return m.ProductSpecific() || m.InstallInProduct()
	}
	systemExtSpecific := func(m *Module) bool {
		return m.SystemExtSpecific()
+3 −15
Original line number Diff line number Diff line
@@ -51,18 +51,6 @@ const (
	ProductVariationPrefix = "product."
)

func (ctx *moduleContext) ProductSpecific() bool {
	return ctx.ModuleContext.ProductSpecific() || ctx.mod.productSpecificModuleContext()
}

func (ctx *moduleContext) SocSpecific() bool {
	return ctx.ModuleContext.SocSpecific() || ctx.mod.socSpecificModuleContext()
}

func (ctx *moduleContext) DeviceSpecific() bool {
	return ctx.ModuleContext.DeviceSpecific() || ctx.mod.deviceSpecificModuleContext()
}

func (ctx *moduleContextImpl) inProduct() bool {
	return ctx.mod.InProduct()
}
@@ -83,20 +71,20 @@ func (ctx *moduleContextImpl) inRecovery() bool {
	return ctx.mod.InRecovery()
}

func (c *Module) productSpecificModuleContext() bool {
func (c *Module) InstallInProduct() bool {
	// Additionally check if this module is inProduct() that means it is a "product" variant of a
	// module. As well as product specific modules, product variants must be installed to /product.
	return c.InProduct()
}

func (c *Module) socSpecificModuleContext() bool {
func (c *Module) InstallInVendor() bool {
	// Additionally check if this module is inVendor() that means it is a "vendor" variant of a
	// module. As well as SoC specific modules, vendor variants must be installed to /vendor
	// unless they have "odm_available: true".
	return c.HasVendorVariant() && c.InVendor() && !c.VendorVariantToOdm()
}

func (c *Module) deviceSpecificModuleContext() bool {
func (c *Module) InstallInOdm() bool {
	// Some vendor variants want to be installed to /odm by setting "odm_available: true".
	return c.InVendor() && c.VendorVariantToOdm()
}
Loading