summaryrefslogtreecommitdiff
path: root/libs/graphicsenv/GraphicsEnv.cpp
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2020-02-23 03:02:43 +0900
committer Jooyung Han <jooyung@google.com> 2020-02-23 03:02:43 +0900
commit78396804770bf3c3a1143f823a466cc0c6849104 (patch)
treebfb65ef15a5d9a95d77d5e3c96463c4f0043fb53 /libs/graphicsenv/GraphicsEnv.cpp
parent61addf0da3ec9645c47279e11394d346f98093e5 (diff)
Use {llndk,vndksp}.libraries.txt from VNDK APEX
/system/etc/{llndk,vndksp}.libraries.txt files will be deprecated. These files can be read from VNDK APEX. Bug: 145184886 Test: build / boot Change-Id: Ic6f46033bd525325562e04ef9e8bcb8ebb5b5d41
Diffstat (limited to 'libs/graphicsenv/GraphicsEnv.cpp')
-rw-r--r--libs/graphicsenv/GraphicsEnv.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp
index bb9e263ac4..5cb2bec08f 100644
--- a/libs/graphicsenv/GraphicsEnv.cpp
+++ b/libs/graphicsenv/GraphicsEnv.cpp
@@ -76,26 +76,25 @@ enum NativeLibrary {
VNDKSP = 1,
};
-static constexpr const char* kNativeLibrariesSystemConfigPath[] = {"/etc/llndk.libraries.txt",
- "/etc/vndksp.libraries.txt"};
+static constexpr const char* kNativeLibrariesSystemConfigPath[] =
+ {"/apex/com.android.vndk.v{}/etc/llndk.libraries.{}.txt",
+ "/apex/com.android.vndk.v{}/etc/vndksp.libraries.{}.txt"};
static std::string vndkVersionStr() {
#ifdef __BIONIC__
- std::string version = android::base::GetProperty("ro.vndk.version", "");
- if (version != "" && version != "current") {
- return "." + version;
- }
+ return android::base::GetProperty("ro.vndk.version", "");
#endif
return "";
}
static void insertVndkVersionStr(std::string* fileName) {
LOG_ALWAYS_FATAL_IF(!fileName, "fileName should never be nullptr");
- size_t insertPos = fileName->find_last_of(".");
- if (insertPos == std::string::npos) {
- insertPos = fileName->length();
+ std::string version = vndkVersionStr();
+ size_t pos = fileName->find("{}");
+ while (pos != std::string::npos) {
+ fileName->replace(pos, 2, version);
+ pos = fileName->find("{}", pos + version.size());
}
- fileName->insert(insertPos, vndkVersionStr());
}
static bool readConfig(const std::string& configFile, std::vector<std::string>* soNames) {
@@ -118,11 +117,7 @@ static bool readConfig(const std::string& configFile, std::vector<std::string>*
}
static const std::string getSystemNativeLibraries(NativeLibrary type) {
- static const char* androidRootEnv = getenv("ANDROID_ROOT");
- static const std::string rootDir = androidRootEnv != nullptr ? androidRootEnv : "/system";
-
- std::string nativeLibrariesSystemConfig = rootDir + kNativeLibrariesSystemConfigPath[type];
-
+ std::string nativeLibrariesSystemConfig = kNativeLibrariesSystemConfigPath[type];
insertVndkVersionStr(&nativeLibrariesSystemConfig);
std::vector<std::string> soNames;