Add custom SystemModules to bootclasspath to reduce duplication

Adds a library dependency to each of the dummy system modules created
by testing.go so that any changes in the behavior were detected by
the existing tests which were then fixed.

Bug: 141359858
Test: m checkbuild
Change-Id: Id4442f4aa3931ac93049f3367b96a5b49cc075e1
diff --git a/java/system_modules.go b/java/system_modules.go
index c616249..43e4e11 100644
--- a/java/system_modules.go
+++ b/java/system_modules.go
@@ -101,6 +101,9 @@
 
 	properties SystemModulesProperties
 
+	// The aggregated header jars from all jars specified in the libs property.
+	// Used when system module is added as a dependency to bootclasspath.
+	headerJars android.Paths
 	outputDir  android.Path
 	outputDeps android.Paths
 }
@@ -118,6 +121,8 @@
 		jars = append(jars, dep.HeaderJars()...)
 	})
 
+	system.headerJars = jars
+
 	system.outputDir, system.outputDeps = TransformJarsToSystemModules(ctx, "java.base", jars)
 }