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/libdexfile/external/dex_file_ext.cc b/libdexfile/external/dex_file_ext.cc
index 4432f6a..302e188 100644
--- a/libdexfile/external/dex_file_ext.cc
+++ b/libdexfile/external/dex_file_ext.cc
@@ -18,7 +18,6 @@
 
 #include <inttypes.h>
 #include <stdint.h>
-#include <sys/mman.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -43,6 +42,7 @@
 #include <dex/dex_file_loader.h>
 
 extern "C" {
+
 // Wraps DexFile to add the caching needed by the external interface. This is
 // what gets passed over as ExtDexFile*.
 struct ExtDexFile {
diff --git a/libdexfile/external/dex_file_supp.cc b/libdexfile/external/dex_file_supp.cc
index 63dec1c..6313afe 100644
--- a/libdexfile/external/dex_file_supp.cc
+++ b/libdexfile/external/dex_file_supp.cc
@@ -65,10 +65,10 @@
     // Check which version is already loaded to avoid loading both debug and
     // release builds. We might also be backtracing from separate process, in
     // which case neither is loaded.
-    const char* so_name = "libdexfiled_external.so";
+    const char* so_name = "libdexfiled.so";
     void* handle = dlopen(so_name, RTLD_NOLOAD | RTLD_NOW | RTLD_NODELETE);
     if (handle == nullptr) {
-      so_name = "libdexfile_external.so";
+      so_name = "libdexfile.so";
       handle = dlopen(so_name, RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
     }
     if (handle == nullptr) {