Dedup checks for module being in versioned sdk snapshot

Previously, various places duplicated the logic to check whether a
module was part of a versioned snapshot. This change replaces that code
with a call to the existing IsModuleInVersionedSdk(Module) func.

This makes the code consistent in preparation for a change that will
remove all calls to IsModuleInVersionedSdk(Module). It is separated out
from that change as it is easier to see that the replaced code is
equivalent to the IsModuleInVersionedSdk(Module) func when it is not
mixed in with other changes. It also makes the following change easier
to review.

Bug: 260237150
Test: m nothing
Change-Id: I44d665bf02d2fc97632a03b5a3d2225ea3c2827d
This commit is contained in:
Paul Duffin 2022-11-25 12:11:40 +00:00
parent 80e7f7323d
commit e3ae3dd6f9
3 changed files with 3 additions and 3 deletions

View file

@ -3520,7 +3520,7 @@ func (c *Module) IsInstallableToApex() bool {
if lib := c.library; lib != nil {
// Stub libs and prebuilt libs in a versioned SDK are not
// installable to APEX even though they are shared libs.
return lib.shared() && !lib.buildStubs() && c.ContainingSdk().Unversioned()
return lib.shared() && !lib.buildStubs() && !android.IsModuleInVersionedSdk(c)
} else if _, ok := c.linker.(testPerSrc); ok {
return true
}

View file

@ -211,7 +211,7 @@ func IsValidSharedDependency(dependency android.Module) bool {
// Discard versioned members of SDK snapshots, because they will conflict with
// unversioned ones.
if sdkMember, ok := dependency.(android.SdkAware); ok && !sdkMember.ContainingSdk().Unversioned() {
if android.IsModuleInVersionedSdk(dependency) {
return false
}

View file

@ -200,7 +200,7 @@ func (prebuilt *Import) AndroidMkEntries() []android.AndroidMkEntries {
dexpreoptEntries := prebuilt.dexpreopter.AndroidMkEntriesForApex()
return append(dexpreoptEntries, android.AndroidMkEntries{Disabled: true})
}
if !prebuilt.ContainingSdk().Unversioned() {
if android.IsModuleInVersionedSdk(prebuilt) {
return []android.AndroidMkEntries{android.AndroidMkEntries{
Disabled: true,
}}