Consider only preferred modules for jdeps

Bug: 263327259
Test: run atest and see modules to be built
Change-Id: I208a07e2453b924f8af25db340d970ec039c5f32
diff --git a/java/jdeps.go b/java/jdeps.go
index 3734335..a52b867 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -52,6 +52,11 @@
 			return
 		}
 
+		// Prevent including both prebuilts and matching source modules when one replaces the other.
+		if !android.IsModulePreferred(module) {
+			return
+		}
+
 		ideInfoProvider, ok := module.(android.IDEInfo)
 		if !ok {
 			return