Install test deps and configs in soong-only

Test: set PRODUCT_SOONG_ONLY locally
Test: rm -rf out/target/product/vsoc_x86_64 && atest CtsHealthConnectControllerTestCases
(one test fails, I will verify if this is specific to soong-only in
followup work)

Bug: 391924360
Change-Id: I72a05c0762d124dd0a8e4dd6b59eda6266cd2cf6
diff --git a/java/app.go b/java/app.go
index 17c7b22..da7eb02 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1616,6 +1616,19 @@
 	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...)
 	a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...)
 
+	// Install test deps
+	if !ctx.Config().KatiEnabled() {
+		pathInTestCases := android.PathForModuleInstall(ctx, ctx.Module().Name())
+		if a.testConfig != nil {
+			ctx.InstallFile(pathInTestCases, ctx.Module().Name()+".config", a.testConfig)
+		}
+		testDeps := append(a.data, a.extraTestConfigs...)
+		for _, data := range android.SortedUniquePaths(testDeps) {
+			dataPath := android.DataPath{SrcPath: data}
+			ctx.InstallTestData(pathInTestCases, []android.DataPath{dataPath})
+		}
+	}
+
 	android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
 		TestcaseRelDataFiles:    testcaseRel(a.data),
 		OutputFile:              a.OutputFile(),