Add "updatable" property to ApexModule interface.

For a given variant of a module that implements ApexModule interface,
the "updatable" property tests if this variant comes from an updatable
apex. For platform variants it is always false.

Test: lunch aosp_walleye-userdebug && m nothing
Bug: 138994281
Change-Id: I2d4c54fb397e29dc9b3203be7fb17be4536529f7
This commit is contained in:
Ulya Trafimovich
2020-04-22 18:05:58 +01:00
parent acc5448f2b
commit 7c140d828a
4 changed files with 63 additions and 12 deletions

View File

@@ -32,6 +32,7 @@ type ApexInfo struct {
ApexName string
MinSdkVersion int
Updatable bool
}
// Extracted from ApexModule to make it easier to define custom subsets of the
@@ -104,6 +105,9 @@ type ApexModule interface {
// For example, with maxSdkVersion is 10 and versionList is [9,11]
// it returns 9 as string
ChooseSdkVersion(versionList []string, maxSdkVersion int) (string, error)
// Tests if the module comes from an updatable APEX.
Updatable() bool
}
type ApexProperties struct {
@@ -229,6 +233,10 @@ func (m *ApexModuleBase) checkApexAvailableProperty(mctx BaseModuleContext) {
}
}
func (m *ApexModuleBase) Updatable() bool {
return m.ApexProperties.Info.Updatable
}
type byApexName []ApexInfo
func (a byApexName) Len() int { return len(a) }