OSDN Git Service

Make sphal and vndk namespace available from legacy devices
authorKiyoung Kim <kiyoungkim@google.com>
Wed, 26 Feb 2020 04:36:48 +0000 (13:36 +0900)
committerGarfield Tan <xutan@google.com>
Thu, 27 Feb 2020 01:07:42 +0000 (17:07 -0800)
linkerconfig failed to complete the execution from ARC++ which was
caused by missing vndk variables because ARC++ is legacy device. This
change allows linkerconfig to generate ld.config.txt for SWCodec by
allowing SPHal and VNDK namespaces even from legacy devices

Bug: 149914078
Test: m -j passed
Test: Tested from ARC++ w/ betty
Change-Id: I5412434f0d2b3b69b916ca512828498a7eba72a3

contents/namespace/sphal.cc
contents/section/apexdefault.cc

index 74858fb..71f41a7 100644 (file)
@@ -45,13 +45,15 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) {
   ns.AddPermittedPath("/system/vendor/${LIB}", AsanPath::NONE);
 
   if (ctx.IsApexBinaryConfig()) {
-    ns.GetLink("vndk").AddSharedLib(
-        Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", ""));
-    ns.GetLink(ctx.GetSystemNamespaceName())
-        .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", ""),
-                      // Add a link for libz.so which is llndk on
-                      // devices where VNDK is not enforced.
-                      "libz.so");
+    if (ctx.IsVndkAvailable()) {
+      ns.GetLink("vndk").AddSharedLib(
+          Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", ""));
+      ns.GetLink(ctx.GetSystemNamespaceName())
+          .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", ""));
+    }
+
+    // Add a link for libz.so which is llndk on devices where VNDK is not enforced.
+    ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("libz.so");
   } else {
     // Once in this namespace, access to libraries in /system/lib is restricted.
     // Only libs listed here can be used. Order is important here as the
index 041fe80..24b2834 100644 (file)
@@ -43,7 +43,10 @@ Section BuildApexDefaultSection(Context& ctx, const ApexInfo& apex_info) {
   // namespace(s)
   if (apex_info.name == "com.android.media.swcodec") {
     namespaces.emplace_back(BuildSphalNamespace(ctx));
-    namespaces.emplace_back(BuildVndkNamespace(ctx, VndkUserPartition::Vendor));
+    if (ctx.IsVndkAvailable()) {
+      namespaces.emplace_back(
+          BuildVndkNamespace(ctx, VndkUserPartition::Vendor));
+    }
   }
 
   return BuildSection(ctx, apex_info.name, std::move(namespaces), {});