Move autogenerated test config into Soong

Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
diff --git a/java/app.go b/java/app.go
index ef591b7..0ca7a2b 100644
--- a/java/app.go
+++ b/java/app.go
@@ -22,6 +22,7 @@
 	"github.com/google/blueprint/proptools"
 
 	"android/soong/android"
+	"android/soong/tradefed"
 )
 
 func init() {
@@ -221,6 +222,8 @@
 	appTestProperties appTestProperties
 
 	testProperties testProperties
+
+	testConfig android.Path
 }
 
 func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -231,6 +234,13 @@
 	}
 
 	a.generateAndroidBuildActions(ctx)
+
+	a.testConfig = tradefed.AutoGenInstrumentationTestConfig(ctx, a.testProperties.Test_config, a.manifestPath)
+}
+
+func (a *AndroidTest) DepsMutator(ctx android.BottomUpMutatorContext) {
+	android.ExtractSourceDeps(ctx, a.testProperties.Test_config)
+	a.AndroidApp.DepsMutator(ctx)
 }
 
 func AndroidTestFactory() android.Module {