Move libz from VNDKSP to LLNDK in case of VNDK Lite am: 14530493f6
Change-Id: Iaad65474633d1cb054638fb1def5d42fa466e3b0
diff --git a/contents/namespace/sphal.cc b/contents/namespace/sphal.cc
index 71f41a7..07bf2a8 100644
--- a/contents/namespace/sphal.cc
+++ b/contents/namespace/sphal.cc
@@ -50,10 +50,10 @@
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
diff --git a/generator/librarylistloader.cc b/generator/librarylistloader.cc
index 7ee7262..7481e8d 100644
--- a/generator/librarylistloader.cc
+++ b/generator/librarylistloader.cc
@@ -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 @@
}
}
+ // 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;