Convert OtherModuleProvider to generic providers API

Convert all of the callers of OtherModuleProvider/OtherModuleHasProvider
to use the type-safe android.OtherModuleProvider API.

Bug: 316410648
Test: builds
Change-Id: Id77f514d68761a262d9ea830a601dbed804bbbe5
This commit is contained in:
Colin Cross
2023-12-13 13:47:44 -08:00
parent ff694a8c88
commit 313aa5475f
43 changed files with 128 additions and 168 deletions

View File

@@ -461,8 +461,8 @@ func PrebuiltSelectModuleMutator(ctx BottomUpMutatorContext) {
// Propagate the provider received from `all_apex_contributions`
// to the source module
ctx.VisitDirectDepsWithTag(acDepTag, func(am Module) {
psi := ctx.OtherModuleProvider(am, PrebuiltSelectionInfoProvider).(PrebuiltSelectionInfoMap)
ctx.SetProvider(PrebuiltSelectionInfoProvider, psi)
psi, _ := OtherModuleProvider(ctx, am, PrebuiltSelectionInfoProvider)
SetProvider(ctx, PrebuiltSelectionInfoProvider, psi)
})
} else if s, ok := ctx.Module().(Module); ok {
@@ -548,9 +548,7 @@ func (p *Prebuilt) usePrebuilt(ctx BaseMutatorContext, source Module, prebuilt M
// Use `all_apex_contributions` for source vs prebuilt selection.
psi := PrebuiltSelectionInfoMap{}
ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(am Module) {
if ctx.OtherModuleHasProvider(am, PrebuiltSelectionInfoProvider) {
psi = ctx.OtherModuleProvider(am, PrebuiltSelectionInfoProvider).(PrebuiltSelectionInfoMap)
}
psi, _ = OtherModuleProvider(ctx, am, PrebuiltSelectionInfoProvider)
})
// If the source module is explicitly listed in the metadata module, use that