OSDN Git Service

Move libz from VNDKSP to LLNDK in case of VNDK Lite
authorKiyoung Kim <kiyoungkim@google.com>
Tue, 31 Mar 2020 05:47:32 +0000 (14:47 +0900)
committerKiyoung Kim <kiyoungkim@google.com>
Tue, 31 Mar 2020 08:33:45 +0000 (17:33 +0900)
In case of VNDK Lite libz should be listed in LLNDK rather than VNDKSP.
This process has been missed while we move the logic to linkerconfig.
This change updates library list based on the library file name in case
of VNDK lite device.

Bug: 141908078
Test: m -j passed
Change-Id: I22eb76619c1242ab26c1d611a08b98177b08285c

contents/namespace/sphal.cc
generator/librarylistloader.cc

index 71f41a7..07bf2a8 100644 (file)
@@ -50,10 +50,10 @@ Namespace BuildSphalNamespace([[maybe_unused]] const Context& ctx) {
           Var("VNDK_SAMEPROCESS_LIBRARIES_VENDOR", ""));
       ns.GetLink(ctx.GetSystemNamespaceName())
           .AddSharedLib(Var("LLNDK_LIBRARIES_VENDOR", ""));
+    } else {
+      // Add a link for libz.so which is llndk on devices where VNDK is not enforced.
+      ns.GetLink(ctx.GetSystemNamespaceName()).AddSharedLib("libz.so");
     }
-
-    // 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 7ee7262..7481e8d 100644 (file)
@@ -25,6 +25,7 @@
 #include <sstream>
 #include <unordered_map>
 
+#include "linkerconfig/environment.h"
 #include "linkerconfig/log.h"
 
 using LibraryList = std::set<std::string>;
@@ -54,6 +55,17 @@ Result<LibraryList> GetLibrariesFromFile(std::string file_path) {
     }
   }
 
+  // TODO (b/122954981) : Remove this part when VNDK Lite is deprecated
+  // In case of VNDK-lite devices, libz should be included in LLNDK rather than
+  // VNDK-SP libraries
+  if (android::linkerconfig::modules::IsVndkLiteDevice()) {
+    if (file_path.find("llndk") != std::string::npos) {
+      library_list.insert("libz.so");
+    } else if (file_path.find("vndksp") != std::string::npos) {
+      library_list.erase("libz.so");
+    }
+  }
+
   library_file_cache.insert({file_path, library_list});
 
   return library_list;