Convert Provider to generic providers API
Convert all of the callers of Provider/HasProvider to use the type-safe
android.ModuleProvider API.
Bug: 316410648
Test: builds
Change-Id: I73479de1625fa2865b6c73444cd477e50d56dc5a
diff --git a/java/base.go b/java/base.go
index 8838b01..108b854 100644
--- a/java/base.go
+++ b/java/base.go
@@ -685,7 +685,7 @@
// Force enable the instrumentation for java code that is built for APEXes ...
// except for the jacocoagent itself (because instrumenting jacocoagent using jacocoagent
// doesn't make sense) or framework libraries (e.g. libraries found in the InstrumentFrameworkModules list) unless EMMA_INSTRUMENT_FRAMEWORK is true.
- apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
+ apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
isJacocoAgent := ctx.ModuleName() == "jacocoagent"
if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) {
@@ -1572,7 +1572,7 @@
// Enable dex compilation for the APEX variants, unless it is disabled explicitly
compileDex := j.dexProperties.Compile_dex
- apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
+ apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() {
if compileDex == nil {
compileDex = proptools.BoolPtr(true)