From 8701bf5f321ccad60ee948833fc3208ae6ea51df Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Tue, 13 Feb 2024 16:38:49 +0000 Subject: Separate handling of a single path and a list of paths when determining API domains. Becomes necessary in a later CL where it gets used on more or less arbitrary paths where we shouldn't treat colons specially. The old code crashed with a fatal if a list of paths had both vendor and product directories in it. This changes that to a more appropriate error that gets propagated to the java level and becomes an exception where the classloader is created. Test: atest libnativeloader_test Bug: 237577392 Change-Id: I783af87a03de18c65fadcd1fd5a71423ec0c786b --- libnativeloader/library_namespaces.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libnativeloader/library_namespaces.h') diff --git a/libnativeloader/library_namespaces.h b/libnativeloader/library_namespaces.h index 741d4116b8..ae1cd88f20 100644 --- a/libnativeloader/library_namespaces.h +++ b/libnativeloader/library_namespaces.h @@ -24,6 +24,7 @@ #include #include #include +#include #include "android-base/result.h" #include "jni.h" @@ -54,7 +55,8 @@ using ApiDomain = enum { API_DOMAIN_PRODUCT = 2, // Product partition }; -nativeloader::ApiDomain GetApiDomainFromPath(const std::string& path); +ApiDomain GetApiDomainFromPath(const std::string_view path); +Result GetApiDomainFromPathList(const std::string& path_list); // LibraryNamespaces is a singleton object that manages NativeLoaderNamespace // objects for an app process. Its main job is to create (and configure) a new -- cgit v1.2.3-59-g8ed1b