diff options
author | Jooyung Han <jooyung@google.com> | 2020-07-17 15:01:19 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2020-07-23 00:54:53 +0000 |
commit | c12f9b9aa5a87e996f5e69f3988f417aab8dd01b (patch) | |
tree | 67d5440b98b01c67f07cfebe5b0c56f2dd2f6de6 | |
parent | e282ce52a78891c1101c63ca118033671c20d999 (diff) | |
download | libhidl-android11-mainline-captiveportallogin-release.tar.gz |
Revert "Revert "libhidlbase supports API level(29)""android-mainline-11.0.0_r44android-mainline-11.0.0_r43android-mainline-11.0.0_r42android-mainline-11.0.0_r41android-mainline-11.0.0_r40android-mainline-11.0.0_r39android-mainline-11.0.0_r38android-mainline-11.0.0_r37android-mainline-11.0.0_r36android-mainline-11.0.0_r35android-mainline-11.0.0_r34android-mainline-11.0.0_r32android-mainline-11.0.0_r31android-mainline-11.0.0_r30android-mainline-11.0.0_r28android-mainline-11.0.0_r27android-mainline-11.0.0_r26android-mainline-11.0.0_r25android-mainline-11.0.0_r24android-mainline-11.0.0_r23android-mainline-11.0.0_r22android-mainline-11.0.0_r21android-mainline-11.0.0_r20android-mainline-11.0.0_r18android-mainline-11.0.0_r17android-mainline-11.0.0_r16android-mainline-11.0.0_r15android-mainline-11.0.0_r14android-mainline-11.0.0_r13android-mainline-11.0.0_r12android11-mainline-tethering-releaseandroid11-mainline-permission-releaseandroid11-mainline-os-statsd-releaseandroid11-mainline-networkstack-releaseandroid11-mainline-media-swcodec-releaseandroid11-mainline-media-releaseandroid11-mainline-extservices-releaseandroid11-mainline-documentsui-releaseandroid11-mainline-conscrypt-releaseandroid11-mainline-cellbroadcast-releaseandroid11-mainline-captiveportallogin-release
This reverts commit 91b5e43e2274dadeb22c393b56f01f022e5c888d.
-- copied from original --
libhidlbase supports API level(29)
libhidlbase searches impl libs of passthrough HALs from various paths
including VNDK-sp /hw. VNDK-sp path differs in R and Q.
Bug: 158564319
Test: install R-built media apex on Q device
atest android.media.cts.MediaDrmClearkeyTest
=> see logcat if there's an error to load libmpeg2extractor
Merged-In: I131d903c43aaaf1ba934933ac89aba5e09a34269
Change-Id: I131d903c43aaaf1ba934933ac89aba5e09a34269
(cherry picked from commit 219106c3719284c8621825a12add22c02e7cd2db)
-rw-r--r-- | base/HidlInternal.cpp | 19 | ||||
-rw-r--r-- | base/include/hidl/HidlInternal.h | 12 | ||||
-rw-r--r-- | transport/ServiceManagement.cpp | 9 |
3 files changed, 23 insertions, 17 deletions
diff --git a/base/HidlInternal.cpp b/base/HidlInternal.cpp index e38a664..e5c8f70 100644 --- a/base/HidlInternal.cpp +++ b/base/HidlInternal.cpp @@ -18,6 +18,9 @@ #include <hidl/HidlInternal.h> +#ifdef __ANDROID__ +#include <android/api-level.h> +#endif #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> @@ -50,9 +53,16 @@ void logAlwaysFatal(const char* message) { LOG(FATAL) << message; } -std::string getVndkVersionStr() { - static std::string vndkVersion = base::GetProperty("ro.vndk.version", ""); - return vndkVersion; +std::string getVndkSpHwPath(const char* lib) { + static std::string vndk_version = base::GetProperty("ro.vndk.version", ""); +#ifdef __ANDROID__ + static int api_level = android_get_device_api_level(); + if (api_level >= __ANDROID_API_R__) { + return android::base::StringPrintf("/apex/com.android.vndk.v%s/%s/hw/", + vndk_version.c_str(), lib); + } +#endif + return android::base::StringPrintf("/system/%s/vndk-sp-%s/hw/", lib, vndk_version.c_str()); } // ---------------------------------------------------------------------- @@ -133,8 +143,7 @@ void HidlInstrumentor::registerInstrumentationCallbacks( if (instrumentationLibPath.size() > 0) { instrumentationLibPaths.push_back(instrumentationLibPath); } else { - static std::string halLibPathVndkSp = android::base::StringPrintf( - HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION, getVndkVersionStr().c_str()); + static std::string halLibPathVndkSp = getVndkSpHwPath(); #ifndef __ANDROID_VNDK__ instrumentationLibPaths.push_back(HAL_LIBRARY_PATH_SYSTEM); #endif diff --git a/base/include/hidl/HidlInternal.h b/base/include/hidl/HidlInternal.h index ee87b87..3cd246a 100644 --- a/base/include/hidl/HidlInternal.h +++ b/base/include/hidl/HidlInternal.h @@ -44,8 +44,12 @@ struct bs_tag {}; //to avoid creating dependencies on liblog. void logAlwaysFatal(const char *message); -// Returns vndk version from "ro.vndk.version" -std::string getVndkVersionStr(); +// Returns VNDK-SP hw path according to "ro.vndk.version" +#if defined(__LP64__) +std::string getVndkSpHwPath(const char* lib = "lib64"); +#else +std::string getVndkSpHwPath(const char* lib = "lib"); +#endif // Explicitly invokes the parameterized element's destructor; // intended to be used alongside the placement new operator. @@ -114,22 +118,18 @@ private: }; #define HAL_LIBRARY_PATH_SYSTEM_64BIT "/system/lib64/hw/" -#define HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION "/apex/com.android.vndk.v%s/lib64/hw/" #define HAL_LIBRARY_PATH_VENDOR_64BIT "/vendor/lib64/hw/" #define HAL_LIBRARY_PATH_ODM_64BIT "/odm/lib64/hw/" #define HAL_LIBRARY_PATH_SYSTEM_32BIT "/system/lib/hw/" -#define HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION "/apex/com.android.vndk.v%s/lib/hw/" #define HAL_LIBRARY_PATH_VENDOR_32BIT "/vendor/lib/hw/" #define HAL_LIBRARY_PATH_ODM_32BIT "/odm/lib/hw/" #if defined(__LP64__) #define HAL_LIBRARY_PATH_SYSTEM HAL_LIBRARY_PATH_SYSTEM_64BIT -#define HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION #define HAL_LIBRARY_PATH_VENDOR HAL_LIBRARY_PATH_VENDOR_64BIT #define HAL_LIBRARY_PATH_ODM HAL_LIBRARY_PATH_ODM_64BIT #else #define HAL_LIBRARY_PATH_SYSTEM HAL_LIBRARY_PATH_SYSTEM_32BIT -#define HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION #define HAL_LIBRARY_PATH_VENDOR HAL_LIBRARY_PATH_VENDOR_32BIT #define HAL_LIBRARY_PATH_ODM HAL_LIBRARY_PATH_ODM_32BIT #endif diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index d7faa6d..8f59f38 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -363,8 +363,7 @@ struct PassthroughServiceManager : IServiceManager1_1 { dlerror(); // clear - static std::string halLibPathVndkSp = android::base::StringPrintf( - HAL_LIBRARY_PATH_VNDK_SP_FOR_VERSION, details::getVndkVersionStr().c_str()); + static std::string halLibPathVndkSp = details::getVndkSpHwPath(); std::vector<std::string> paths = { HAL_LIBRARY_PATH_ODM, HAL_LIBRARY_PATH_VENDOR, halLibPathVndkSp, #ifndef __ANDROID_VNDK__ @@ -485,10 +484,8 @@ struct PassthroughServiceManager : IServiceManager1_1 { Return<void> debugDump(debugDump_cb _hidl_cb) override { using Arch = ::android::hidl::base::V1_0::DebugInfo::Architecture; using std::literals::string_literals::operator""s; - static std::string halLibPathVndkSp64 = android::base::StringPrintf( - HAL_LIBRARY_PATH_VNDK_SP_64BIT_FOR_VERSION, details::getVndkVersionStr().c_str()); - static std::string halLibPathVndkSp32 = android::base::StringPrintf( - HAL_LIBRARY_PATH_VNDK_SP_32BIT_FOR_VERSION, details::getVndkVersionStr().c_str()); + static std::string halLibPathVndkSp64 = details::getVndkSpHwPath("lib64"); + static std::string halLibPathVndkSp32 = details::getVndkSpHwPath("lib"); static std::vector<std::pair<Arch, std::vector<const char*>>> sAllPaths{ {Arch::IS_64BIT, { |