aconfig: harden dependency collection

To prevent errors, when we collect dependencies for a module, walk the
blueprint modules, and ignore blueprint and disabled modules.

This avoids errors in validateAndroidModule when a android.Module (such
as a genrule) depends on a blueprint.Module, and strict checking is
enabled.

Bug: 308625757
Test: manual

Change-Id: I11f0a0b504aa18d6d786cc91319b9d1d9497c04f
diff --git a/android/aconfig_providers.go b/android/aconfig_providers.go
index ddebec3..11fc660 100644
--- a/android/aconfig_providers.go
+++ b/android/aconfig_providers.go
@@ -49,7 +49,13 @@
 	if *mergedAconfigFiles == nil {
 		*mergedAconfigFiles = make(map[string]Paths)
 	}
-	ctx.VisitDirectDeps(func(module Module) {
+	ctx.VisitDirectDepsBlueprint(func(module blueprint.Module) {
+		// Walk our direct dependencies, ignoring blueprint Modules and disabled Android Modules.
+		aModule, _ := module.(Module)
+		if aModule == nil || !aModule.Enabled() {
+			return
+		}
+
 		if dep, _ := OtherModuleProvider(ctx, module, AconfigDeclarationsProviderKey); dep.IntermediateCacheOutputPath != nil {
 			(*mergedAconfigFiles)[dep.Container] = append((*mergedAconfigFiles)[dep.Container], dep.IntermediateCacheOutputPath)
 			return