Fix dependency on APK used by test

Use data attribute to include the APK used for the test.

Bug: 138416078
Test: atest, forrest run tests/08c5ef8c-8aae-43fc-96e5-ea810ae947ba
Change-Id: I7c6e2cb4d9510f6ad032e2dd814751e604552fc8
diff --git a/hostsidetests/classloaders/splits/Android.bp b/hostsidetests/classloaders/splits/Android.bp
index 17f02a7..592bbc3 100644
--- a/hostsidetests/classloaders/splits/Android.bp
+++ b/hostsidetests/classloaders/splits/Android.bp
@@ -31,4 +31,9 @@
         "CtsClassloaderSplitAppFeatureA",
         "CtsClassloaderSplitAppFeatureB",
     ],
+    data: [
+        ":CtsClassloaderSplitApp",
+        ":CtsClassloaderSplitAppFeatureA",
+        ":CtsClassloaderSplitAppFeatureB",
+    ],
 }
diff --git a/hostsidetests/classloaders/splits/apps/Android.bp b/hostsidetests/classloaders/splits/apps/Android.bp
index 380182d..c0975ac 100644
--- a/hostsidetests/classloaders/splits/apps/Android.bp
+++ b/hostsidetests/classloaders/splits/apps/Android.bp
@@ -21,9 +21,4 @@
         "androidx.test.rules",
         "ctstestrunner-axt",
     ],
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }
diff --git a/hostsidetests/classloaders/splits/apps/feature_a/Android.bp b/hostsidetests/classloaders/splits/apps/feature_a/Android.bp
index 0fd70911..7dd21cf 100644
--- a/hostsidetests/classloaders/splits/apps/feature_a/Android.bp
+++ b/hostsidetests/classloaders/splits/apps/feature_a/Android.bp
@@ -24,9 +24,4 @@
         "--package-id",
         "0x80",
     ],
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }
diff --git a/hostsidetests/classloaders/splits/apps/feature_b/Android.bp b/hostsidetests/classloaders/splits/apps/feature_b/Android.bp
index 2643840..84c1f53 100644
--- a/hostsidetests/classloaders/splits/apps/feature_b/Android.bp
+++ b/hostsidetests/classloaders/splits/apps/feature_b/Android.bp
@@ -27,9 +27,4 @@
         "--package-id",
         "0x81",
     ],
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }
diff --git a/hostsidetests/classloaders/useslibrary/Android.bp b/hostsidetests/classloaders/useslibrary/Android.bp
index 603b2ec..970f93b 100644
--- a/hostsidetests/classloaders/useslibrary/Android.bp
+++ b/hostsidetests/classloaders/useslibrary/Android.bp
@@ -27,4 +27,5 @@
         "general-tests",
     ],
     required: [ "CtsUsesLibraryApp" ],
+    data: [ ":CtsUsesLibraryApp" ],
 }
diff --git a/hostsidetests/classloaders/useslibrary/app/Android.bp b/hostsidetests/classloaders/useslibrary/app/Android.bp
index 1d444c6..e69db51 100644
--- a/hostsidetests/classloaders/useslibrary/app/Android.bp
+++ b/hostsidetests/classloaders/useslibrary/app/Android.bp
@@ -24,9 +24,4 @@
         "androidx.test.rules",
         "ctstestrunner-axt",
     ],
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }
diff --git a/hostsidetests/dexmetadata/app/Android.bp b/hostsidetests/dexmetadata/app/Android.bp
index 904aa38..9be64e6 100644
--- a/hostsidetests/dexmetadata/app/Android.bp
+++ b/hostsidetests/dexmetadata/app/Android.bp
@@ -20,11 +20,5 @@
         "androidx.test.rules",
         "compatibility-device-util-axt",
     ],
-    // Tag this module as test artifact for cts,
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
     sdk_version: "test_current",
 }
diff --git a/hostsidetests/dexmetadata/host/Android.bp b/hostsidetests/dexmetadata/host/Android.bp
index 56d989f..d40cb6c 100644
--- a/hostsidetests/dexmetadata/host/Android.bp
+++ b/hostsidetests/dexmetadata/host/Android.bp
@@ -27,4 +27,5 @@
         "cts",
         "general-tests",
     ],
+    data: [":CtsDexMetadataDeviceTestApp"],
 }
diff --git a/hostsidetests/jdwpsecurity/Android.bp b/hostsidetests/jdwpsecurity/Android.bp
index 0d16257..8e99529 100644
--- a/hostsidetests/jdwpsecurity/Android.bp
+++ b/hostsidetests/jdwpsecurity/Android.bp
@@ -26,4 +26,5 @@
         "vts",
         "general-tests",
     ],
+    data: [":CtsJdwpApp"],
 }
diff --git a/hostsidetests/jdwpsecurity/app/Android.bp b/hostsidetests/jdwpsecurity/app/Android.bp
index 0942d47..93761b6 100644
--- a/hostsidetests/jdwpsecurity/app/Android.bp
+++ b/hostsidetests/jdwpsecurity/app/Android.bp
@@ -15,10 +15,4 @@
 java_test_helper_library {
     name: "CtsJdwpApp",
     srcs: ["**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }
diff --git a/hostsidetests/jdwptunnel/Android.bp b/hostsidetests/jdwptunnel/Android.bp
index 291dbd3..fbc18fa 100644
--- a/hostsidetests/jdwptunnel/Android.bp
+++ b/hostsidetests/jdwptunnel/Android.bp
@@ -27,6 +27,7 @@
     data: [
         // Include the JDI classes in the testcases directory.
         ":jdi-support",
+        ":CtsJdwpTunnelSampleApp",
     ],
 
     // Tag this module as a cts test artifact
@@ -37,5 +38,4 @@
     ],
 
     // LOCAL_CTS_TEST_PACKAGE := android.host.jdwptunnel
-
 }
diff --git a/hostsidetests/jdwptunnel/sampleapp/Android.bp b/hostsidetests/jdwptunnel/sampleapp/Android.bp
index f932fa9..0ed8655 100644
--- a/hostsidetests/jdwptunnel/sampleapp/Android.bp
+++ b/hostsidetests/jdwptunnel/sampleapp/Android.bp
@@ -25,13 +25,6 @@
 
     srcs: ["src/**/*.java"],
 
-    // tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
-
     sdk_version: "current",
 
 }
diff --git a/hostsidetests/jvmti/attaching/Android.bp b/hostsidetests/jvmti/attaching/Android.bp
index 161c0bf..48b095e 100644
--- a/hostsidetests/jvmti/attaching/Android.bp
+++ b/hostsidetests/jvmti/attaching/Android.bp
@@ -22,11 +22,6 @@
     },
     srcs: ["app/src/**/*.java"],
     manifest: "app/AndroidManifest.xml",
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
     jni_libs: ["libctsjvmtiattachagent"],
     compile_multilib: "both",
     sdk_version: "test_current",
@@ -90,4 +85,5 @@
         "general-tests",
     ],
     test_config: "host/AndroidTest.xml",
+    data: [":CtsJvmtiAttachingDeviceApp"],
 }
diff --git a/hostsidetests/jvmti/redefining/Android.bp b/hostsidetests/jvmti/redefining/Android.bp
index 422292a..6de0131 100644
--- a/hostsidetests/jvmti/redefining/Android.bp
+++ b/hostsidetests/jvmti/redefining/Android.bp
@@ -21,4 +21,5 @@
         "vts",
         "general-tests",
     ],
+    data: [":CtsJvmtiRedefineClassesDeviceApp"],
 }
diff --git a/hostsidetests/jvmti/redefining/app/Android.bp b/hostsidetests/jvmti/redefining/app/Android.bp
index 7439a49..f6eaa91 100644
--- a/hostsidetests/jvmti/redefining/app/Android.bp
+++ b/hostsidetests/jvmti/redefining/app/Android.bp
@@ -16,11 +16,6 @@
     name: "CtsJvmtiRedefineClassesDeviceApp",
     srcs: ["src/**/*.java"],
     manifest: "AndroidManifest.xml",
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
     dex_preopt: {
         enabled: false,
     },
diff --git a/hostsidetests/jvmti/tagging/Android.bp b/hostsidetests/jvmti/tagging/Android.bp
index dcdec61..29b16d3 100644
--- a/hostsidetests/jvmti/tagging/Android.bp
+++ b/hostsidetests/jvmti/tagging/Android.bp
@@ -22,4 +22,5 @@
         "vts",
         "general-tests",
     ],
+    data: [":CtsJvmtiTaggingDeviceApp"],
 }
diff --git a/hostsidetests/jvmti/tagging/app/Android.bp b/hostsidetests/jvmti/tagging/app/Android.bp
index 02f8e30..45e4d78 100644
--- a/hostsidetests/jvmti/tagging/app/Android.bp
+++ b/hostsidetests/jvmti/tagging/app/Android.bp
@@ -22,11 +22,6 @@
     },
     srcs: ["src/**/*.java"],
     manifest: "AndroidManifest.xml",
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
     static_libs: ["CtsJvmtiDeviceAppBase"],
     jni_libs: ["libctsjvmtiagent"],
     compile_multilib: "both",
diff --git a/hostsidetests/sample/Android.bp b/hostsidetests/sample/Android.bp
index 33158cd..489bedc 100644
--- a/hostsidetests/sample/Android.bp
+++ b/hostsidetests/sample/Android.bp
@@ -28,4 +28,8 @@
         "tradefed",
         "compatibility-host-util",
     ],
+    data: [
+        ":CtsSampleDeviceApp",
+        ":CtsSampleDeviceApp2",
+    ],
 }
diff --git a/hostsidetests/sample/app/Android.bp b/hostsidetests/sample/app/Android.bp
index e942c64..2597717 100644
--- a/hostsidetests/sample/app/Android.bp
+++ b/hostsidetests/sample/app/Android.bp
@@ -16,12 +16,5 @@
     name: "CtsSampleDeviceApp",
     defaults: ["cts_defaults"],
     srcs: ["src/**/*.java"],
-    // tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-        "cts_instant",
-    ],
     sdk_version: "current",
 }
diff --git a/hostsidetests/sample/app2/Android.bp b/hostsidetests/sample/app2/Android.bp
index 3acdeb5..1fc25ed 100644
--- a/hostsidetests/sample/app2/Android.bp
+++ b/hostsidetests/sample/app2/Android.bp
@@ -17,12 +17,5 @@
     defaults: ["cts_defaults"],
     static_libs: ["androidx.test.rules"],
     srcs: ["src/**/*.java"],
-    // tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-        "cts_instant",
-    ],
     sdk_version: "current",
 }
diff --git a/tests/accessibilityservice/Android.bp b/tests/accessibilityservice/Android.bp
index 837dc4a..d551c44 100644
--- a/tests/accessibilityservice/Android.bp
+++ b/tests/accessibilityservice/Android.bp
@@ -35,4 +35,5 @@
         "cts_instant",
     ],
     sdk_version: "test_current",
+    data: [":CtsAccessibilityWidgetProvider"],
 }
diff --git a/tests/accessibilityservice/test-apps/WidgetProvider/Android.bp b/tests/accessibilityservice/test-apps/WidgetProvider/Android.bp
index c594ace..960d96b 100644
--- a/tests/accessibilityservice/test-apps/WidgetProvider/Android.bp
+++ b/tests/accessibilityservice/test-apps/WidgetProvider/Android.bp
@@ -16,12 +16,5 @@
     name: "CtsAccessibilityWidgetProvider",
     defaults: ["cts_support_defaults"],
     srcs: ["src/**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-        "cts_instant",
-    ],
     sdk_version: "test_current",
 }
diff --git a/tests/jdwp/Android.bp b/tests/jdwp/Android.bp
index c51958a..d7d748c 100644
--- a/tests/jdwp/Android.bp
+++ b/tests/jdwp/Android.bp
@@ -31,4 +31,5 @@
     optimize: {
         enabled: false,
     },
+    data: [":cts-dalvik-device-test-runner"],
 }
diff --git a/tests/jdwp/runner/device-side/Android.bp b/tests/jdwp/runner/device-side/Android.bp
index b3f370c..98edcf8 100644
--- a/tests/jdwp/runner/device-side/Android.bp
+++ b/tests/jdwp/runner/device-side/Android.bp
@@ -27,11 +27,4 @@
     },
 
     static_libs: ["junit"],
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "vts",
-        "general-tests",
-    ],
 }