OSDN Git Service

Rename APEX Namespace
authorKiyoung Kim <kiyoungkim@google.com>
Wed, 19 Feb 2020 07:26:03 +0000 (16:26 +0900)
committerKiyoung Kim <kiyoungkim@google.com>
Wed, 19 Feb 2020 07:27:15 +0000 (16:27 +0900)
Current APEX Namespace is named with APEX name itself, which also uses
.(dot) so linker configuration can keep the syntax safe. Update name of
namespace from APEX by replacing '_' with '.' so keep configuration safe
for future syntax update.

Bug: 148826508
Test: m -j passed
Test: boot succeeded from cuttlefish and walleye
Change-Id: I9185c909678e2e39d539622d51d8f378b819b466

contents/namespace/apexartdefault.cc
contents/namespace/art.cc
modules/basecontext.cc
modules/include/linkerconfig/apex.h

index 8f4c7f2..2153bd4 100644 (file)
@@ -28,7 +28,7 @@ Namespace BuildApexArtDefaultNamespace([[maybe_unused]] const Context& ctx) {
   // The default namespace here only links to other namespaces, in particular
   // "art" where the real library loading takes place. Any outgoing links from
   // "art" also need to be present here.
-  ns.GetLink("com.android.art").AllowAllSharedLibs();
+  ns.GetLink("com_android_art").AllowAllSharedLibs();
   ns.GetLink("system").AllowAllSharedLibs();
   ns.AddRequires(std::vector{"libadbconnection_client.so"});
 
index d0bc869..0d0b982 100644 (file)
@@ -32,7 +32,7 @@ Namespace BuildArtNamespace([[maybe_unused]] const Context& ctx,
   // Make the namespace visible to allow links to be created at runtime, e.g.
   // through android_link_namespaces in libnativeloader. That is not applicable
   // to the vendor section.
-  Namespace ns(apex.name,
+  Namespace ns(apex.namespace_name,
                /*is_isolated=*/true,
                /*is_visible=*/!ctx.IsVendorSection());
 
index 0c85a31..997c86b 100644 (file)
@@ -40,7 +40,7 @@ bool BaseContext::IsStrictMode() const {
 
 Namespace BaseContext::BuildApexNamespace(const ApexInfo& apex_info,
                                           bool visible) const {
-  Namespace ns(apex_info.name,
+  Namespace ns(apex_info.namespace_name,
                /*is_isolated=*/true,
                visible);
   InitializeWithApex(ns, apex_info);
index 8b0838e..4e0a6dc 100644 (file)
@@ -15,6 +15,7 @@
  */
 #pragma once
 
+#include <algorithm>
 #include <map>
 #include <string>
 #include <vector>
@@ -24,6 +25,7 @@ namespace linkerconfig {
 namespace modules {
 struct ApexInfo {
   std::string name;
+  std::string namespace_name;
   std::string path;
   std::vector<std::string> provide_libs;
   std::vector<std::string> require_libs;
@@ -40,6 +42,9 @@ struct ApexInfo {
         require_libs(std::move(require_libs)),
         has_bin(has_bin),
         has_lib(has_lib) {
+    this->namespace_name = this->name;
+    std::replace(
+        this->namespace_name.begin(), this->namespace_name.end(), '.', '_');
   }
 };