diff options
Diffstat (limited to 'libnativeloader/library_namespaces.cpp')
-rw-r--r-- | libnativeloader/library_namespaces.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libnativeloader/library_namespaces.cpp b/libnativeloader/library_namespaces.cpp index e0f3d6af8c..7aa14080ce 100644 --- a/libnativeloader/library_namespaces.cpp +++ b/libnativeloader/library_namespaces.cpp @@ -86,6 +86,8 @@ constexpr const char* kProductLibPath = "/product/" LIB ":/system/product/" LIB; const std::regex kVendorPathRegex("(/system)?/vendor/.*"); const std::regex kProductPathRegex("(/system)?/product/.*"); const std::regex kSystemPathRegex("/system(_ext)?/.*"); // MUST be tested last. +const std::regex kPartitionNativeLibPathRegex( + "/(system|(system/)?(system_ext|vendor|product))/lib(64)?/.*"); jobject GetParentClassLoader(JNIEnv* env, jobject class_loader) { jclass class_loader_class = env->FindClass("java/lang/ClassLoader"); @@ -138,6 +140,12 @@ Result<ApiDomain> GetApiDomainFromPathList(const std::string& path_list) { return result; } +// Returns true if the given path is in a partition-wide native library location, +// i.e. <partition root>/lib(64). +bool IsPartitionNativeLibPath(const std::string& path) { + return std::regex_match(path, kPartitionNativeLibPathRegex); +} + void LibraryNamespaces::Initialize() { // Once public namespace is initialized there is no // point in running this code - it will have no effect |