Don't dlclose libperfetto_android_internal.so once loaded

Prior to this CL:
1) the internal .so was lazily loaded the first time a process
   needed to access a non-NDK function.
2) It was unloaded once done

2 turns out to be particularly problematic because causes all
sorts of FD leaks. Most libraries don't handle dlcose() proprely.
This CL cleans up a bit the dlopn mechanism, centralizing it in
one place and never dlcloses the opened library once loaded.


Test: manual (using android.power)
Bug: 137280403
Change-Id: I21006ebafb35a063c0ca5c9c2d370c049fb27eb8
diff --git a/src/android_internal/BUILD.gn b/src/android_internal/BUILD.gn
index 2b54d76..52e86e1 100644
--- a/src/android_internal/BUILD.gn
+++ b/src/android_internal/BUILD.gn
@@ -26,6 +26,21 @@
   ]
 }
 
+source_set("lazy_library_loader") {
+  public_deps = [
+    ":headers",
+  ]
+  deps = [
+    "../../gn:default_deps",
+    "../../src/base",
+  ]
+  sources = [
+    "lazy_library_loader.cc",
+    "lazy_library_loader.h",
+  ]
+  libs = [ "dl" ]
+}
+
 # This target proxies calls to Android internal libraries that are not part of
 # the NDK. See README.md.
 source_set("android_internal") {