clean up statsd public libraries

JNI library(libstat_jni) from statsd apex is handled via the build
system and linkerconfig.

Bug: 150767721
Test: presubmit
Test: atest libnativeloader_test
Change-Id: Ia7527f053508d5992c3eef209f77260f0d210e81
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp
index 47050ca..dcd2f65 100644
--- a/libnativeloader/library_namespaces.cpp
+++ b/libnativeloader/library_namespaces.cpp
@@ -50,7 +50,6 @@
 constexpr const char* kVendorNamespaceName = "sphal";
 constexpr const char* kVndkNamespaceName = "vndk";
 constexpr const char* kVndkProductNamespaceName = "vndk_product";
-constexpr const char* kStatsdNamespaceName = "com_android_os_statsd";
 
 // classloader-namespace is a linker namespace that is created for the loaded
 // app. To be specific, it is created for the app classloader. When
@@ -358,16 +357,6 @@
     }
   }
 
-  // Give access to StatsdAPI libraries
-  auto statsd_ns =
-      NativeLoaderNamespace::GetExportedNamespace(kStatsdNamespaceName, is_bridged);
-  if (statsd_ns.ok()) {
-    linked = app_ns->Link(*statsd_ns, statsd_public_libraries());
-    if (!linked.ok()) {
-      return linked.error();
-    }
-  }
-
   auto vendor_libs = filter_public_libraries(target_sdk_version, uses_libraries,
                                              vendor_public_libraries());
   if (!vendor_libs.empty()) {
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 146ab5a..43c3c15 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -99,7 +99,6 @@
 #define NAMESPACE_ENTRY(ns) {ns, TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE(ns))}
   NAMESPACE_ENTRY("com_android_i18n"),
   NAMESPACE_ENTRY("com_android_neuralnetworks"),
-  NAMESPACE_ENTRY("com_android_os_statsd"),
   NAMESPACE_ENTRY("com_android_art"),
   NAMESPACE_ENTRY("default"),
   NAMESPACE_ENTRY("sphal"),
@@ -367,7 +366,6 @@
   bool expected_link_with_vndk_product_ns = false;
   bool expected_link_with_default_ns = false;
   bool expected_link_with_neuralnetworks_ns = true;
-  bool expected_link_with_statsd_ns = true;
   std::string expected_shared_libs_to_platform_ns = default_public_libraries();
   std::string expected_shared_libs_to_art_ns = apex_public_libraries().at("com_android_art");
   std::string expected_shared_libs_to_i18n_ns = apex_public_libraries().at("com_android_i18n");
@@ -376,7 +374,6 @@
   std::string expected_shared_libs_to_vndk_product_ns = vndksp_libraries_product();
   std::string expected_shared_libs_to_default_ns = default_public_libraries();
   std::string expected_shared_libs_to_neuralnetworks_ns = apex_public_libraries().at("com_android_neuralnetworks");
-  std::string expected_shared_libs_to_statsd_ns = statsd_public_libraries();
 
   void SetExpectations() {
     NativeLoaderTest::SetExpectations();
@@ -431,11 +428,6 @@
                                               StrEq(expected_shared_libs_to_neuralnetworks_ns)))
           .WillOnce(Return(true));
     }
-    if (expected_link_with_statsd_ns) {
-      EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("com_android_os_statsd"),
-                                              StrEq(expected_shared_libs_to_statsd_ns)))
-          .WillOnce(Return(true));
-    }
   }
 
   void RunTest() {
diff --git a/libnativeloader/public_libraries.cpp b/libnativeloader/public_libraries.cpp
index c3f38f6..b565133 100644
--- a/libnativeloader/public_libraries.cpp
+++ b/libnativeloader/public_libraries.cpp
@@ -59,8 +59,6 @@
 constexpr const char* kVndkLibrariesFile = "/apex/com.android.vndk.v{}/etc/vndksp.libraries.{}.txt";
 
 
-constexpr const char* kStatsdApexPublicLibrary = "libstats_jni.so";
-
 // TODO(b/130388701): do we need this?
 std::string root_dir() {
   static const char* android_root_env = getenv("ANDROID_ROOT");
@@ -276,10 +274,6 @@
   return android::base::Join(*sonames, ':');
 }
 
-static std::string InitStatsdPublicLibraries() {
-  return kStatsdApexPublicLibrary;
-}
-
 static std::map<std::string, std::string> InitApexLibraries(const std::string& tag) {
   std::string file_content;
   if (!base::ReadFileToString(kApexLibrariesConfigFile, &file_content)) {
@@ -342,11 +336,6 @@
   return list;
 }
 
-const std::string& statsd_public_libraries() {
-  static std::string list = InitStatsdPublicLibraries();
-  return list;
-}
-
 const std::string& llndk_libraries_product() {
   static std::string list = InitLlndkLibrariesProduct();
   return list;
diff --git a/libnativeloader/public_libraries.h b/libnativeloader/public_libraries.h
index c1460db..71c1b8f 100644
--- a/libnativeloader/public_libraries.h
+++ b/libnativeloader/public_libraries.h
@@ -32,7 +32,6 @@
 // e.g., if it is a vendor app or not, different set of libraries are made available.
 const std::string& preloadable_public_libraries();
 const std::string& default_public_libraries();
-const std::string& statsd_public_libraries();
 const std::string& vendor_public_libraries();
 const std::string& extended_public_libraries();
 const std::string& llndk_libraries_product();