Merge libdexfile_external into libdexfile (reland 2).

To reduce the number of DSO's. libdexfile_external only adds a few
small functions on top of libdexfile, and it's still only those
functions that are available in the APEX stubs.

Also rename libdexfile_external_static to libdexfile_static, for
consistency.

Since libdexfile now has stubs, we need to add test_for properties to
avoid linking against the stubs in tests.

This relands https://r.android.com/1666119 that got submitted out of
order from https://r.android.com/1664026 - prerequisite changes now
submitted with https://r.android.com/1671709.

Test: Flash and boot with userdebug and eng to try both release and
  debug modules.
Test: art/tools/buildbot-build.sh {--target,--host}
Test: art/build/apex/runtests.sh
Test: mmm art
Bug: 143978909
Change-Id: I6de99052d6d8a9d01d748baabbbcecfe1f4509dc
diff --git a/test/Android.bp b/test/Android.bp
index 7df6ead..bc340bd 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -29,6 +29,12 @@
     name: "art_test_defaults",
     host_supported: true,
     target: {
+        android: {
+            test_for: [
+                "com.android.art",
+                "com.android.art.debug",
+            ],
+        },
         android_arm: {
             relative_install_path: "art/arm",
         },
@@ -48,6 +54,8 @@
     cflags: [
         "-Wno-frame-larger-than=",
     ],
+    // Tests aren't generally included in any APEX, but this is necessary to
+    // avoid duplicate install rules for them by making them unavailable to platform.
     apex_available: [
         "com.android.art.debug",
     ],
@@ -151,6 +159,10 @@
     },
     apex_available: [
         "com.android.art.debug",
+        // TODO(b/183882457): This lib doesn't go into com.android.art, but
+        // apex_available lists need to be the same for internal libs to avoid
+        // stubs, and this depends on libdexfiled and others.
+        "com.android.art",
     ],
 }
 
@@ -187,6 +199,10 @@
     },
     apex_available: [
         "com.android.art.debug",
+        // TODO(b/183882457): This lib doesn't go into com.android.art, but
+        // apex_available lists need to be the same for internal libs to avoid
+        // stubs, and this depends on libdexfiled and others.
+        "com.android.art",
     ],
 }
 
@@ -1035,6 +1051,10 @@
             suffix: "64",
         },
     },
+    test_for: [
+        "com.android.art",
+        "com.android.art.debug",
+    ],
 }
 
 art_cc_test {
@@ -1051,6 +1071,10 @@
     ],
     test_suites: ["general-tests"],
     test_config: "art-gtests-target-chroot.xml",
+    test_for: [
+        "com.android.art",
+        "com.android.art.debug",
+    ],
 }
 
 filegroup {