From c0e3ed3cbb1edbc61a8d86494b90352ddec637aa Mon Sep 17 00:00:00 2001 From: Kiyoung Kim Date: Fri, 11 Aug 2023 11:22:15 +0900 Subject: Use llndk.libraries.txt from system if VNDK is deprecated llndk.libraries.txt will be relocated into system when VNDK is deprecated. This change sets a new location to load llndk.libraries.txt when VNDK is deprecated. Bug: 290160925 Test: aosp_cf build and boot succeeded with llndk.libraries.txt in the system image Change-Id: I3022910a4e2c9852e2dfe520e1a6e06a9de21f76 --- libs/graphicsenv/GraphicsEnv.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'libs/graphicsenv/GraphicsEnv.cpp') diff --git a/libs/graphicsenv/GraphicsEnv.cpp b/libs/graphicsenv/GraphicsEnv.cpp index 5f5f85a2ad..64f8704094 100644 --- a/libs/graphicsenv/GraphicsEnv.cpp +++ b/libs/graphicsenv/GraphicsEnv.cpp @@ -60,6 +60,17 @@ typedef bool (*fpANGLEShouldBeUsedForApplication)(void* rulesHandle, int rulesVe typedef bool (*fpANGLEFreeRulesHandle)(void* handle); typedef bool (*fpANGLEFreeSystemInfoHandle)(void* handle); +namespace { +static bool isVndkEnabled() { +#ifdef __BIONIC__ + // TODO(b/290159430) Use ro.vndk.version to check if VNDK is enabled instead + static bool isVndkEnabled = !android::base::GetBoolProperty("ro.vndk.deprecate", false); + return isVndkEnabled; +#endif + return false; +} +} // namespace + namespace android { enum NativeLibrary { @@ -71,6 +82,8 @@ static constexpr const char* kNativeLibrariesSystemConfigPath[] = {"/apex/com.android.vndk.v{}/etc/llndk.libraries.{}.txt", "/apex/com.android.vndk.v{}/etc/vndksp.libraries.{}.txt"}; +static const char* kLlndkLibrariesTxtPath = "/system/etc/llndk.libraries.txt"; + static std::string vndkVersionStr() { #ifdef __BIONIC__ return base::GetProperty("ro.vndk.version", ""); @@ -108,8 +121,14 @@ static bool readConfig(const std::string& configFile, std::vector* } static const std::string getSystemNativeLibraries(NativeLibrary type) { - std::string nativeLibrariesSystemConfig = kNativeLibrariesSystemConfigPath[type]; - insertVndkVersionStr(&nativeLibrariesSystemConfig); + std::string nativeLibrariesSystemConfig = ""; + + if (!isVndkEnabled() && type == NativeLibrary::LLNDK) { + nativeLibrariesSystemConfig = kLlndkLibrariesTxtPath; + } else { + nativeLibrariesSystemConfig = kNativeLibrariesSystemConfigPath[type]; + insertVndkVersionStr(&nativeLibrariesSystemConfig); + } std::vector soNames; if (!readConfig(nativeLibrariesSystemConfig, &soNames)) { -- cgit v1.2.3-59-g8ed1b