Disable test that depends on ART sources when prebuilts are used.

odsign_e2e_tests depends on test_com.android.art, which isn't available
when prebuilts are preferred.

Test: m droid SOONG_CONFIG_art_module_source_build=false
  with fresh ART prebuilts
Bug: 172480615
Bug: 184143265
Change-Id: Ibb53b1159d009eb834d671f3a8442e04f162484a
diff --git a/build/Android.bp b/build/Android.bp
index c846b72..97a1b4f 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -292,7 +292,10 @@
 
 soong_config_module_type_import {
     from: "art/build/SoongConfig.bp",
-    module_types: ["art_module_cc_defaults"],
+    module_types: [
+        "art_module_cc_defaults",
+        "art_module_java_defaults",
+    ],
 }
 
 // Use this to enable a cc_* module only when building ART from sources.
@@ -320,6 +323,31 @@
     },
 }
 
+// Use this to enable a java_* module only when building ART from sources.
+// TODO(b/172480617): Clean up when sources are gone from the platform tree and
+// we no longer need to support sources present when prebuilts are used.
+art_module_java_defaults {
+    name: "art_module_source_build_java_defaults",
+    defaults_visibility: [
+        "//art:__subpackages__",
+        "//libnativehelper:__subpackages__",
+    ],
+
+    enabled: false,
+    soong_config_variables: {
+        source_build: {
+            enabled: true,
+        },
+    },
+    target: {
+        windows: {
+            // Windows is disabled by default, but if we set enabled:true
+            // globally above we need to disable it explicitly.
+            enabled: false,
+        },
+    },
+}
+
 // A version of conscrypt only for enabling the "-hostdex" version to test ART on host.
 java_library {
     // We need our own name to not clash with the conscrypt library.
diff --git a/build/SoongConfig.bp b/build/SoongConfig.bp
index 71b2200..c466324 100644
--- a/build/SoongConfig.bp
+++ b/build/SoongConfig.bp
@@ -11,22 +11,6 @@
 }
 
 soong_config_module_type {
-    name: "art_module_sdk",
-    module_type: "sdk",
-    config_namespace: "art_module",
-    bool_variables: ["source_build"],
-    properties: ["enabled"],
-}
-
-soong_config_module_type {
-    name: "art_module_exports",
-    module_type: "module_exports",
-    config_namespace: "art_module",
-    bool_variables: ["source_build"],
-    properties: ["enabled"],
-}
-
-soong_config_module_type {
     name: "art_module_apex_defaults",
     module_type: "apex_defaults",
     config_namespace: "art_module",
@@ -43,9 +27,33 @@
 }
 
 soong_config_module_type {
+    name: "art_module_exports",
+    module_type: "module_exports",
+    config_namespace: "art_module",
+    bool_variables: ["source_build"],
+    properties: ["enabled"],
+}
+
+soong_config_module_type {
     name: "art_module_genrule_defaults",
     module_type: "genrule_defaults",
     config_namespace: "art_module",
     bool_variables: ["source_build"],
     properties: ["enabled"],
 }
+
+soong_config_module_type {
+    name: "art_module_java_defaults",
+    module_type: "java_defaults",
+    config_namespace: "art_module",
+    bool_variables: ["source_build"],
+    properties: ["enabled"],
+}
+
+soong_config_module_type {
+    name: "art_module_sdk",
+    module_type: "sdk",
+    config_namespace: "art_module",
+    bool_variables: ["source_build"],
+    properties: ["enabled"],
+}
diff --git a/test/odsign/Android.bp b/test/odsign/Android.bp
index 0df6687..3677a99 100644
--- a/test/odsign/Android.bp
+++ b/test/odsign/Android.bp
@@ -18,6 +18,7 @@
 
 java_test_host {
     name: "odsign_e2e_tests",
+    defaults: ["art_module_source_build_java_defaults"],
     srcs: ["test-src/**/*.java"],
     libs: ["tradefed"],
     static_libs: [