diff options
| author | Justin Yun <justinyun@google.com> | 2017-11-27 17:04:14 +0900 |
|---|---|---|
| committer | Justin Yun <justinyun@google.com> | 2017-12-13 10:27:28 +0900 |
| commit | 4a1d11038fb0ad0cdacb6a3276aa49ba1dd6ede0 (patch) | |
| tree | 6b3a7fb3b46113dd9cbbefb6ba42fefb9508953f /libnativeloader/native_loader.cpp | |
| parent | c034cd5d044e795d50d9884c0a962d4d1a63ad23 (diff) | |
| download | system_core-4a1d11038fb0ad0cdacb6a3276aa49ba1dd6ede0.tar.gz system_core-4a1d11038fb0ad0cdacb6a3276aa49ba1dd6ede0.tar.bz2 system_core-4a1d11038fb0ad0cdacb6a3276aa49ba1dd6ede0.zip | |
Load versioned llndk.libraries.txt and vndksp.libraries.txt
When ro.vndk.version has a specific VNDK version in it, use the
llndk.libraries.txt and vndksp.libraries.txt files with the version
suffix in the file names.
If ro.vndk.version is "current" or not set, the version suffix will
not be added.
This is to use a proper VNDK snapshot version configuration for a
vendor patition.
Bug: 69531793
Test: In system/etc directory of a Pixel2 device,
Change llndk.libraries.txt to llndk.libraries.27.txt
Change vndksp.libraries.txt to vndksp.libraries.27.txt
Set ro.vndk.version to 27 in vendor/default.prop
reboot and check if vendor apks work.
Change-Id: I82d83b6805799ea71cc88d1e0297d265a40c0061
Diffstat (limited to 'libnativeloader/native_loader.cpp')
| -rw-r--r-- | libnativeloader/native_loader.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 5d160eee7..f3c70de6c 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -35,6 +35,10 @@ #include <android-base/macros.h> #include <android-base/strings.h> +#ifdef __BIONIC__ +#include <android-base/properties.h> +#endif + #define CHECK(predicate) LOG_ALWAYS_FATAL_IF(!(predicate),\ "%s:%d: %s CHECK '" #predicate "' failed.",\ __FILE__, __LINE__, __FUNCTION__) @@ -110,6 +114,25 @@ static bool is_debuggable() { return std::string(debuggable) == "1"; } +static std::string vndk_version_str() { +#ifdef __BIONIC__ + std::string version = android::base::GetProperty("ro.vndk.version", ""); + if (version != "" && version != "current") { + return "." + version; + } +#endif + return ""; +} + +static void insert_vndk_version_str(std::string* file_name) { + CHECK(file_name != nullptr); + size_t insert_pos = file_name->find_last_of("."); + if (insert_pos == std::string::npos) { + insert_pos = file_name->length(); + } + file_name->insert(insert_pos, vndk_version_str()); +} + class LibraryNamespaces { public: LibraryNamespaces() : initialized_(false) { } @@ -318,6 +341,10 @@ class LibraryNamespaces { "Error reading public native library list from \"%s\": %s", public_native_libraries_system_config.c_str(), error_msg.c_str()); + // Insert VNDK version to llndk and vndksp config file names. + insert_vndk_version_str(&llndk_native_libraries_system_config); + insert_vndk_version_str(&vndksp_native_libraries_system_config); + // For debuggable platform builds use ANDROID_ADDITIONAL_PUBLIC_LIBRARIES environment // variable to add libraries to the list. This is intended for platform tests only. if (is_debuggable()) { @@ -347,11 +374,11 @@ class LibraryNamespaces { system_public_libraries_ = base::Join(sonames, ':'); sonames.clear(); - ReadConfig(kLlndkNativeLibrariesSystemConfigPathFromRoot, &sonames); + ReadConfig(llndk_native_libraries_system_config, &sonames); system_llndk_libraries_ = base::Join(sonames, ':'); sonames.clear(); - ReadConfig(kVndkspNativeLibrariesSystemConfigPathFromRoot, &sonames); + ReadConfig(vndksp_native_libraries_system_config, &sonames); system_vndksp_libraries_ = base::Join(sonames, ':'); sonames.clear(); |
