Don't include disabled modules in linker config files.

Bug: 377723687
Test: Unit tests and compare the ninja and mk files generated.
Change-Id: Ie327e03418e8762771fdbf290a35293aa5fb8e17
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 6dfbfd1..bd8018b 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -1081,7 +1081,10 @@
 	modulesInPackageByName := make(map[string]bool)
 
 	deps := f.gatherFilteredPackagingSpecs(ctx)
-	ctx.WalkDeps(func(child, parent android.Module) bool {
+	ctx.WalkDeps(func(child, _ android.Module) bool {
+		if !child.Enabled(ctx) {
+			return false
+		}
 		for _, ps := range android.OtherModuleProviderOrDefault(
 			ctx, child, android.InstallFilesProvider).PackagingSpecs {
 			if _, ok := deps[ps.RelPathInPackage()]; ok && ps.Partition() == f.PartitionType() {
@@ -1100,6 +1103,9 @@
 
 	var requireModules []android.Module
 	ctx.WalkDeps(func(child, parent android.Module) bool {
+		if !child.Enabled(ctx) {
+			return false
+		}
 		_, parentInPackage := modulesInPackageByModule[parent]
 		_, childInPackageName := modulesInPackageByName[child.Name()]