Make art modules apex_available to test_broken_com.android.art

libart-broken needs to compile against the source of its dependencies,
not stubs. The stubs/source logic is complicated, but one of the ways it
can be affected is that if both modules have identical apex_available
lists, they will be allowed to depend on the source of each other.
libart-broken needs to be apex_available to test_broken_com.android.art,
so test_broken_com.android.art needs to be added to libdexfile as well.
This change then propagates virally though most of the art modules.

This is needed now because we're making a change to allow building the
non-apex variants of apex dependencies. The apex variant of
libart-broken did not have this issue because the stubs/source rules
are different for apex variants.

Bug: 254205429
Test: cd art && mm with aosp/2462194
Test: art/libnativebridge/tests/runtests.sh --skip-target
Change-Id: Ia3517b70808d64ed2b33d68e2280b514bdfef6b6
diff --git a/compiler/Android.bp b/compiler/Android.bp
index cab7fbe..f5939fe 100644
--- a/compiler/Android.bp
+++ b/compiler/Android.bp
@@ -244,6 +244,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/dex2oat/Android.bp b/dex2oat/Android.bp
index d04a8f6..7341774 100644
--- a/dex2oat/Android.bp
+++ b/dex2oat/Android.bp
@@ -337,6 +337,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/dexdump/Android.bp b/dexdump/Android.bp
index 1bc6334..da43fbe 100644
--- a/dexdump/Android.bp
+++ b/dexdump/Android.bp
@@ -69,6 +69,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/dexlayout/Android.bp b/dexlayout/Android.bp
index 922e134..ec7fdf6 100644
--- a/dexlayout/Android.bp
+++ b/dexlayout/Android.bp
@@ -106,6 +106,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
@@ -191,6 +192,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/dexlist/Android.bp b/dexlist/Android.bp
index 6a65ef4..918fc68 100644
--- a/dexlist/Android.bp
+++ b/dexlist/Android.bp
@@ -34,6 +34,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index 0f021bc..79dd10c 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -214,6 +214,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
     stubs: {
         symbol_file: "libdexfile.map.txt",
diff --git a/libnativebridge/Android.bp b/libnativebridge/Android.bp
index 356a1f4..dc19f07 100644
--- a/libnativebridge/Android.bp
+++ b/libnativebridge/Android.bp
@@ -45,6 +45,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 
     host_supported: true,
diff --git a/libnativeloader/Android.bp b/libnativeloader/Android.bp
index f1ef32d..ac1e944 100644
--- a/libnativeloader/Android.bp
+++ b/libnativeloader/Android.bp
@@ -27,6 +27,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
     host_supported: true,
     srcs: [
diff --git a/libprofile/Android.bp b/libprofile/Android.bp
index cb9aa95..beae8a9 100644
--- a/libprofile/Android.bp
+++ b/libprofile/Android.bp
@@ -134,6 +134,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
@@ -169,6 +170,7 @@
         // apex_available lists need to be the same for internal libs to avoid
         // stubs, and libartd depends on this.
         "com.android.art",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/oatdump/Android.bp b/oatdump/Android.bp
index ba7ceb5..dacd647 100644
--- a/oatdump/Android.bp
+++ b/oatdump/Android.bp
@@ -84,6 +84,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp
index 3e8cf30..809e18d 100644
--- a/odrefresh/Android.bp
+++ b/odrefresh/Android.bp
@@ -112,6 +112,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
@@ -147,6 +148,7 @@
         // apex_available lists need to be the same for internal libs to avoid
         // stubs, and this depends on libartd.
         "com.android.art",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/openjdkjvmti/Android.bp b/openjdkjvmti/Android.bp
index d2ac9b6..98cb466 100644
--- a/openjdkjvmti/Android.bp
+++ b/openjdkjvmti/Android.bp
@@ -117,6 +117,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/perfetto_hprof/Android.bp b/perfetto_hprof/Android.bp
index f5ae042..8cfc7d4 100644
--- a/perfetto_hprof/Android.bp
+++ b/perfetto_hprof/Android.bp
@@ -88,6 +88,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/profman/Android.bp b/profman/Android.bp
index 8e76bc2..ac80641 100644
--- a/profman/Android.bp
+++ b/profman/Android.bp
@@ -110,6 +110,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/runtime/Android.bp b/runtime/Android.bp
index a039878..beccf27 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -668,6 +668,12 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        // libart doesn't go into test_broken_com.android.art, but the libart-broken
+        // needs to have the same apex_available list as its dependencies in order
+        // to compile against their sources. Then that change comes back up to affect
+        // libart as well, because it also needs to have the same apex_available as its
+        // dependencies.
+        "test_broken_com.android.art",
     ],
     afdo: true,
 }
@@ -680,6 +686,11 @@
     gtest: false,
     cflags: ["-DART_CRASH_RUNTIME_DELIBERATELY"],
     apex_available: [
+        // libart-broken only goes into test_broken_com.android.art, but the libart-broken
+        // needs to have the same apex_available list as its dependencies in order
+        // to compile against their sources.
+        "com.android.art",
+        "com.android.art.debug",
         "test_broken_com.android.art",
     ],
 }
@@ -710,6 +721,7 @@
         // apex_available lists need to be the same for internal libs to avoid
         // stubs, and this depends on libsigchain.
         "com.android.art",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/sigchainlib/Android.bp b/sigchainlib/Android.bp
index ee874dc..68dec35 100644
--- a/sigchainlib/Android.bp
+++ b/sigchainlib/Android.bp
@@ -62,6 +62,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
     stubs: {
         symbol_file: "libsigchain.map.txt",
diff --git a/test/Android.bp b/test/Android.bp
index 651541c..300f09f 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -387,6 +387,7 @@
         // apex_available lists need to be the same for internal libs to avoid
         // stubs, and this depends on libdexfiled and others.
         "com.android.art",
+        "test_broken_com.android.art",
     ],
 }
 
@@ -453,6 +454,7 @@
         // apex_available lists need to be the same for internal libs to avoid
         // stubs, and this depends on libdexfiled and others.
         "com.android.art",
+        "test_broken_com.android.art",
     ],
 }
 
diff --git a/tools/dexanalyze/Android.bp b/tools/dexanalyze/Android.bp
index 2a625d6..5b87559 100644
--- a/tools/dexanalyze/Android.bp
+++ b/tools/dexanalyze/Android.bp
@@ -49,6 +49,7 @@
     apex_available: [
         "com.android.art",
         "com.android.art.debug",
+        "test_broken_com.android.art",
     ],
 }