Remove cc.moduleContext override of android.ModuleContext.*Specific

Overriding android.ModuleContext's implementations of *Specific()
methods in cc.moduleContext and then passing that back to
android.PathForModuleInstall to affect the install path causes
problems if android.ModuleBase.GenerateBuildActions also tries
to call android.PathForModuleInstall directly with the
android.ModuleContext as it gets a different result.

Add InstallIn* methods to the android.Module interface, implement
default versions in android.ModuleBase, and override them in
cc.Module and rust.Module.  Use them in android.PathsForModuleInstall
to allow the module to customize the behavior directly.

Test: TestInstallPartition
Change-Id: I7840e07eae34ac4f4d3490b021143d5f33a83626
This commit is contained in:
Colin Cross
2023-11-29 16:00:16 -08:00
parent 51428c451a
commit ea30d85a65
6 changed files with 63 additions and 29 deletions

View File

@@ -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)
}