Make java_sdk_library dependencies explicit

modules should specify the submodule of java_sdk_library that the module
actually depends on

Test: CI
Ignore-AOSP-First: resolving merge conflicts
Flag: EXEMPT build dependency cleanup
Bug: 358613520
Change-Id: I80af0b9efa88c668306f0ff1d51491a8180dc57f
diff --git a/tests/AppLaunch/Android.bp b/tests/AppLaunch/Android.bp
index f838c5a..90a00fe 100644
--- a/tests/AppLaunch/Android.bp
+++ b/tests/AppLaunch/Android.bp
@@ -14,11 +14,12 @@
     platform_apis: true,
     certificate: "platform",
     libs: [
-        "android.test.base",
-        "android.test.runner",
+        "android.test.base.stubs.system",
+        "android.test.runner.stubs.system",
     ],
     static_libs: [
         "androidx.test.rules",
-        "ub-uiautomator"],
+        "ub-uiautomator",
+    ],
     test_suites: ["device-tests"],
 }
diff --git a/tests/AttestationVerificationTest/Android.bp b/tests/AttestationVerificationTest/Android.bp
index b98f8cb..5f09089 100644
--- a/tests/AttestationVerificationTest/Android.bp
+++ b/tests/AttestationVerificationTest/Android.bp
@@ -32,8 +32,8 @@
     },
     test_suites: ["device-tests"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: [
         "compatibility-device-util-axt",
diff --git a/tests/BrowserPowerTest/Android.bp b/tests/BrowserPowerTest/Android.bp
index a8a9897..100e975 100644
--- a/tests/BrowserPowerTest/Android.bp
+++ b/tests/BrowserPowerTest/Android.bp
@@ -24,8 +24,8 @@
 android_test {
     name: "BrowserPowerTests",
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: ["junit"],
     // Include all test java files.
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp
index 5edb1de..4aeca5b 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/tests/Android.bp
@@ -24,7 +24,7 @@
     name: "SmartCamera-tests",
     platform_apis: true,
     srcs: ["src/**/*.java"],
-    libs: ["android.test.base"],
+    libs: ["android.test.base.stubs.system"],
     static_libs: [
         "guava",
         "junit",
diff --git a/tests/ChoreographerTests/Android.bp b/tests/ChoreographerTests/Android.bp
index 3f48d70..69a9d18 100644
--- a/tests/ChoreographerTests/Android.bp
+++ b/tests/ChoreographerTests/Android.bp
@@ -26,8 +26,8 @@
     name: "ChoreographerTests",
     srcs: ["src/**/*.java"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: [
         "androidx.test.core",
diff --git a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp
index 9994826..ce63fe8 100644
--- a/tests/CompanionDeviceMultiDeviceTests/client/Android.bp
+++ b/tests/CompanionDeviceMultiDeviceTests/client/Android.bp
@@ -40,8 +40,8 @@
         "mobly-snippet-lib",
     ],
     libs: [
-        "android.test.base",
-        "android.test.runner",
+        "android.test.base.stubs.system",
+        "android.test.runner.stubs.system",
     ],
 
     optimize: {
diff --git a/tests/CoreTests/android/Android.bp b/tests/CoreTests/android/Android.bp
index 97a6e5f..85e951e 100644
--- a/tests/CoreTests/android/Android.bp
+++ b/tests/CoreTests/android/Android.bp
@@ -12,7 +12,7 @@
     srcs: ["**/*.java"],
     libs: [
         "android.test.runner.stubs",
-        "org.apache.http.legacy",
+        "org.apache.http.legacy.stubs",
         "android.test.base.stubs",
     ],
     sdk_version: "current",
diff --git a/tests/CtsSurfaceControlTestsStaging/Android.bp b/tests/CtsSurfaceControlTestsStaging/Android.bp
index 1038c9e..8d93b28 100644
--- a/tests/CtsSurfaceControlTestsStaging/Android.bp
+++ b/tests/CtsSurfaceControlTestsStaging/Android.bp
@@ -28,8 +28,8 @@
     name: "CtsSurfaceControlTestsStaging",
     srcs: ["src/**/*.java"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: [
         "androidx.test.core",
diff --git a/tests/DataIdleTest/Android.bp b/tests/DataIdleTest/Android.bp
index f9509cc..8839df6 100644
--- a/tests/DataIdleTest/Android.bp
+++ b/tests/DataIdleTest/Android.bp
@@ -27,8 +27,8 @@
     name: "DataIdleTest",
     platform_apis: true,
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: ["junit"],
     srcs: ["src/**/*.java"],
diff --git a/tests/EnforcePermission/perf-app/Android.bp b/tests/EnforcePermission/perf-app/Android.bp
index 6d04fdc..dbafd73 100644
--- a/tests/EnforcePermission/perf-app/Android.bp
+++ b/tests/EnforcePermission/perf-app/Android.bp
@@ -32,8 +32,8 @@
         "androidx.test.rules",
     ],
     libs: [
-        "android.test.base",
-        "android.test.runner",
+        "android.test.base.stubs.system",
+        "android.test.runner.stubs.system",
     ],
     data: [
         ":EnforcePermissionTestHelper",
diff --git a/tests/EnforcePermission/test-app/Android.bp b/tests/EnforcePermission/test-app/Android.bp
index 065ab33..64f850b 100644
--- a/tests/EnforcePermission/test-app/Android.bp
+++ b/tests/EnforcePermission/test-app/Android.bp
@@ -27,8 +27,8 @@
         "androidx.test.rules",
     ],
     libs: [
-        "android.test.base",
-        "android.test.runner",
+        "android.test.base.stubs.system",
+        "android.test.runner.stubs.system",
     ],
     data: [
         ":EnforcePermissionTestHelper",
diff --git a/tests/FlickerTests/Android.bp b/tests/FlickerTests/Android.bp
index d658d59..27e9ffa 100644
--- a/tests/FlickerTests/Android.bp
+++ b/tests/FlickerTests/Android.bp
@@ -31,7 +31,7 @@
         enabled: false,
     },
     test_suites: ["device-tests"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs.system"],
     static_libs: [
         "androidx.test.ext.junit",
         "flickertestapplib",
diff --git a/tests/FrameworkPerf/Android.bp b/tests/FrameworkPerf/Android.bp
index 9be3ab7..4e39fe1 100644
--- a/tests/FrameworkPerf/Android.bp
+++ b/tests/FrameworkPerf/Android.bp
@@ -12,8 +12,8 @@
     srcs: ["**/*.java"],
     platform_apis: true,
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: ["junit"],
     aaptflags: [
diff --git a/tests/GamePerformance/Android.bp b/tests/GamePerformance/Android.bp
index f250a1b..964f0b9 100644
--- a/tests/GamePerformance/Android.bp
+++ b/tests/GamePerformance/Android.bp
@@ -33,8 +33,8 @@
     srcs: ["src/**/*.java"],
     static_libs: ["androidx.test.rules"],
     libs: [
-        "android.test.base",
-        "android.test.runner",
+        "android.test.base.stubs.system",
+        "android.test.runner.stubs.system",
     ],
     platform_apis: true,
     certificate: "platform",
diff --git a/tests/Input/Android.bp b/tests/Input/Android.bp
index 06c2651..cf42a34 100644
--- a/tests/Input/Android.bp
+++ b/tests/Input/Android.bp
@@ -51,8 +51,8 @@
         "ui-trace-collector",
     ],
     libs: [
-        "android.test.mock",
-        "android.test.base",
+        "android.test.mock.stubs.system",
+        "android.test.base.stubs.system",
     ],
     test_suites: ["device-tests"],
 }
diff --git a/tests/InputMethodStressTest/Android.bp b/tests/InputMethodStressTest/Android.bp
index 5ed8d8d..2697d32 100644
--- a/tests/InputMethodStressTest/Android.bp
+++ b/tests/InputMethodStressTest/Android.bp
@@ -20,7 +20,7 @@
 android_test {
     name: "InputMethodStressTest",
     srcs: ["src/**/*.java"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs"],
     static_libs: [
         "androidx.test.ext.junit",
         "androidx.test.uiautomator_uiautomator",
diff --git a/tests/InputScreenshotTest/Android.bp b/tests/InputScreenshotTest/Android.bp
index 927b101..12ab550 100644
--- a/tests/InputScreenshotTest/Android.bp
+++ b/tests/InputScreenshotTest/Android.bp
@@ -67,8 +67,8 @@
         "truth",
     ],
     libs: [
-        "android.test.mock",
-        "android.test.base",
+        "android.test.mock.stubs.system",
+        "android.test.base.stubs.system",
     ],
     test_suites: ["device-tests"],
     compile_multilib: "both",
diff --git a/tests/InputScreenshotTest/robotests/Android.bp b/tests/InputScreenshotTest/robotests/Android.bp
index d63fd69..b2414a8 100644
--- a/tests/InputScreenshotTest/robotests/Android.bp
+++ b/tests/InputScreenshotTest/robotests/Android.bp
@@ -61,9 +61,9 @@
         "uiautomator-helpers",
     ],
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
         "truth",
     ],
     upstream: true,
diff --git a/tests/Internal/Android.bp b/tests/Internal/Android.bp
index ad98e47..3e58517 100644
--- a/tests/Internal/Android.bp
+++ b/tests/Internal/Android.bp
@@ -14,7 +14,7 @@
     },
     // Include some source files directly to be able to access package members
     srcs: ["src/**/*.java"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs.system"],
     static_libs: [
         "junit",
         "androidx.test.rules",
diff --git a/tests/LocalizationTest/Android.bp b/tests/LocalizationTest/Android.bp
index 909ca59..5d9901b 100644
--- a/tests/LocalizationTest/Android.bp
+++ b/tests/LocalizationTest/Android.bp
@@ -25,9 +25,9 @@
     name: "LocalizationTest",
     srcs: ["java/**/*.kt"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
     ],
     static_libs: [
         "androidx.test.core",
diff --git a/tests/MemoryUsage/Android.bp b/tests/MemoryUsage/Android.bp
index e30a0a7..deb4663 100644
--- a/tests/MemoryUsage/Android.bp
+++ b/tests/MemoryUsage/Android.bp
@@ -14,8 +14,8 @@
     platform_apis: true,
     certificate: "platform",
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: ["junit"],
 }
diff --git a/tests/MultiUser/Android.bp b/tests/MultiUser/Android.bp
index bde309f..e4d9f02 100644
--- a/tests/MultiUser/Android.bp
+++ b/tests/MultiUser/Android.bp
@@ -18,9 +18,9 @@
         "services.core",
     ],
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
     ],
     certificate: "platform",
     test_suites: ["device-tests"],
diff --git a/tests/NetworkSecurityConfigTest/Android.bp b/tests/NetworkSecurityConfigTest/Android.bp
index 473eadb..4c48eaa 100644
--- a/tests/NetworkSecurityConfigTest/Android.bp
+++ b/tests/NetworkSecurityConfigTest/Android.bp
@@ -11,8 +11,8 @@
     name: "NetworkSecurityConfigTests",
     certificate: "platform",
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     static_libs: ["junit"],
     // Include all test java files.
diff --git a/tests/OneMedia/Android.bp b/tests/OneMedia/Android.bp
index a43cd39..a1817cc 100644
--- a/tests/OneMedia/Android.bp
+++ b/tests/OneMedia/Android.bp
@@ -15,7 +15,7 @@
     ],
     platform_apis: true,
     certificate: "platform",
-    libs: ["org.apache.http.legacy"],
+    libs: ["org.apache.http.legacy.stubs.system"],
     optional_uses_libs: ["org.apache.http.legacy"],
     optimize: {
         enabled: false,
diff --git a/tests/PackageWatchdog/Android.bp b/tests/PackageWatchdog/Android.bp
index 2c5fdd3..096555e 100644
--- a/tests/PackageWatchdog/Android.bp
+++ b/tests/PackageWatchdog/Android.bp
@@ -36,7 +36,7 @@
         "services.net",
         "truth",
     ],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs.system"],
     jni_libs: [
         // mockito-target-extended dependencies
         "libdexmakerjvmtiagent",
diff --git a/tests/ProtoInputStreamTests/Android.bp b/tests/ProtoInputStreamTests/Android.bp
index 0029080..40ab257 100644
--- a/tests/ProtoInputStreamTests/Android.bp
+++ b/tests/ProtoInputStreamTests/Android.bp
@@ -33,7 +33,7 @@
     platform_apis: true,
     certificate: "platform",
     test_suites: ["device-tests"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs.system"],
     static_libs: [
         "androidx.test.rules",
         "frameworks-base-testutils",
diff --git a/tests/RemoteDisplayProvider/Android.bp b/tests/RemoteDisplayProvider/Android.bp
index 55732d1..468bdda 100644
--- a/tests/RemoteDisplayProvider/Android.bp
+++ b/tests/RemoteDisplayProvider/Android.bp
@@ -27,6 +27,6 @@
     sdk_version: "system_current",
     srcs: ["src/**/*.java"],
     resource_dirs: ["res"],
-    libs: ["com.android.media.remotedisplay"],
+    libs: ["com.android.media.remotedisplay.stubs.system"],
     certificate: "platform",
 }
diff --git a/tests/ServiceCrashTest/Android.bp b/tests/ServiceCrashTest/Android.bp
index fb98b763..82f397f 100644
--- a/tests/ServiceCrashTest/Android.bp
+++ b/tests/ServiceCrashTest/Android.bp
@@ -13,7 +13,7 @@
     srcs: ["src/**/*.java"],
     platform_apis: true,
     certificate: "platform",
-    libs: ["android.test.base"],
+    libs: ["android.test.base.stubs.system"],
     static_libs: [
         "compatibility-device-util-axt",
         "androidx.test.rules",
diff --git a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp
index 0d20497..c0ac50c 100644
--- a/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp
+++ b/tests/SharedLibraryLoadingTest/test-apps/SharedLibraryClientTests/Android.bp
@@ -23,7 +23,7 @@
     libs: [
         "SharedLibraryLoadingTests_StandardSharedLibrary",
         "SharedLibraryLoadingTests_SharedLibraryLoadedAfter",
-        "android.test.base",
+        "android.test.base.stubs.system",
     ],
     static_libs: [
         "androidx.test.ext.junit",
diff --git a/tests/TelephonyCommonTests/Android.bp b/tests/TelephonyCommonTests/Android.bp
index b968e5d..b1af6ae 100644
--- a/tests/TelephonyCommonTests/Android.bp
+++ b/tests/TelephonyCommonTests/Android.bp
@@ -50,9 +50,9 @@
     platform_apis: true,
 
     libs: [
-        "android.test.runner",
-        "android.test.mock",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.mock.stubs.system",
+        "android.test.base.stubs.system",
         "unsupportedappusage",
     ],
 }
diff --git a/tests/TrustTests/Android.bp b/tests/TrustTests/Android.bp
index 4e75a1d..361c0cd 100644
--- a/tests/TrustTests/Android.bp
+++ b/tests/TrustTests/Android.bp
@@ -31,8 +31,8 @@
         "truth",
     ],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     test_suites: [
         "device-tests",
diff --git a/tests/TtsTests/Android.bp b/tests/TtsTests/Android.bp
index b7aa5d4..e28f69b 100644
--- a/tests/TtsTests/Android.bp
+++ b/tests/TtsTests/Android.bp
@@ -28,8 +28,8 @@
     srcs: ["**/*.java"],
     static_libs: ["mockito-target"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
     ],
     platform_apis: true,
 }
diff --git a/tests/UpdatableSystemFontTest/Android.bp b/tests/UpdatableSystemFontTest/Android.bp
index 12d4338..34eff4f 100644
--- a/tests/UpdatableSystemFontTest/Android.bp
+++ b/tests/UpdatableSystemFontTest/Android.bp
@@ -25,7 +25,7 @@
 android_test {
     name: "UpdatableSystemFontTest",
     srcs: ["src/**/*.java"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs.test"],
     static_libs: [
         "androidx.test.ext.junit",
         "androidx.test.uiautomator_uiautomator",
diff --git a/tests/UsbManagerTests/lib/Android.bp b/tests/UsbManagerTests/lib/Android.bp
index 4e5a70fe..506de5c 100644
--- a/tests/UsbManagerTests/lib/Android.bp
+++ b/tests/UsbManagerTests/lib/Android.bp
@@ -38,6 +38,6 @@
         "androidx.core_core",
     ],
     libs: [
-        "android.test.mock",
+        "android.test.mock.stubs.system",
     ],
 }
diff --git a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp
index a4085e5..44aa402 100644
--- a/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp
+++ b/tests/inputmethod/ConcurrentMultiSessionImeTest/Android.bp
@@ -21,7 +21,7 @@
     name: "ConcurrentMultiSessionImeTest",
     srcs: ["src/**/*.java"],
     resource_dirs: ["res"],
-    libs: ["android.test.runner"],
+    libs: ["android.test.runner.stubs"],
     static_libs: [
         "androidx.core_core",
         "androidx.test.ext.junit",
diff --git a/tests/permission/Android.bp b/tests/permission/Android.bp
index b02f410..d80eaeb 100644
--- a/tests/permission/Android.bp
+++ b/tests/permission/Android.bp
@@ -12,8 +12,8 @@
     // Include all test java files.
     srcs: ["src/**/*.java"],
     libs: [
-        "android.test.runner",
-        "android.test.base",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
         "telephony-common",
     ],
     static_libs: [
diff --git a/tests/testables/Android.bp b/tests/testables/Android.bp
index c0e3d63..7596ee7 100644
--- a/tests/testables/Android.bp
+++ b/tests/testables/Android.bp
@@ -27,8 +27,8 @@
     name: "testables",
     srcs: ["src/**/*.java"],
     libs: [
-        "android.test.runner",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.mock.stubs.system",
         "androidx.test.rules",
         "mockito-target-inline-minus-junit4",
     ],
diff --git a/tests/testables/tests/Android.bp b/tests/testables/tests/Android.bp
index d6a4754..1eb36fa 100644
--- a/tests/testables/tests/Android.bp
+++ b/tests/testables/tests/Android.bp
@@ -45,9 +45,9 @@
         "libmultiplejvmtiagentsinterferenceagent",
     ],
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
     ],
     certificate: "platform",
     test_suites: [
diff --git a/tests/utils/testutils/Android.bp b/tests/utils/testutils/Android.bp
index deff42a..35fd5b1 100644
--- a/tests/utils/testutils/Android.bp
+++ b/tests/utils/testutils/Android.bp
@@ -35,9 +35,9 @@
     ],
 
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
         "mockito-target-extended-minus-junit4",
     ],
 }
diff --git a/tests/utils/testutils/tests/Android.bp b/tests/utils/testutils/tests/Android.bp
index 8104280..3bb02e4 100644
--- a/tests/utils/testutils/tests/Android.bp
+++ b/tests/utils/testutils/tests/Android.bp
@@ -35,9 +35,9 @@
     ],
 
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs.system",
+        "android.test.base.stubs.system",
+        "android.test.mock.stubs.system",
     ],
 
     certificate: "platform",
diff --git a/tests/vcn/Android.bp b/tests/vcn/Android.bp
index ee2e7cf..b16ba15 100644
--- a/tests/vcn/Android.bp
+++ b/tests/vcn/Android.bp
@@ -34,8 +34,8 @@
         "flag-junit",
     ],
     libs: [
-        "android.test.runner",
-        "android.test.base",
-        "android.test.mock",
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+        "android.test.mock.stubs",
     ],
 }