diff options
Diffstat (limited to 'libnativeloader/library_namespaces.h')
-rw-r--r-- | libnativeloader/library_namespaces.h | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/libnativeloader/library_namespaces.h b/libnativeloader/library_namespaces.h index 4871528f47..25edf4faf7 100644 --- a/libnativeloader/library_namespaces.h +++ b/libnativeloader/library_namespaces.h @@ -21,20 +21,40 @@ #error "Not available for host or linux target" #endif -#define LOG_TAG "nativeloader" - -#include "native_loader_namespace.h" - #include <list> #include <string> -#include <android-base/result.h> -#include <jni.h> +#include "android-base/result.h" +#include "jni.h" +#include "native_loader_namespace.h" namespace android::nativeloader { using android::base::Result; +// The device may be configured to have the vendor libraries loaded to a separate namespace. +// For historical reasons this namespace was named sphal but effectively it is intended +// to use to load vendor libraries to separate namespace with controlled interface between +// vendor and system namespaces. +constexpr const char* kVendorNamespaceName = "sphal"; +// Similar to sphal namespace, product namespace provides some product libraries. +constexpr const char* kProductNamespaceName = "product"; + +// vndk namespace for unbundled vendor apps +constexpr const char* kVndkNamespaceName = "vndk"; +// vndk_product namespace for unbundled product apps +constexpr const char* kVndkProductNamespaceName = "vndk_product"; + +// API domains, roughly corresponding to partitions. Interdependencies between +// these must follow API restrictions, while intradependencies do not. +using ApiDomain = enum { + API_DOMAIN_DEFAULT = 0, // Locations other than those below, in particular for ordinary apps + API_DOMAIN_VENDOR = 1, // Vendor partition + API_DOMAIN_PRODUCT = 2, // Product partition +}; + +nativeloader::ApiDomain GetApiDomainFromPath(const std::string& path); + // LibraryNamespaces is a singleton object that manages NativeLoaderNamespace // objects for an app process. Its main job is to create (and configure) a new // NativeLoaderNamespace object for a Java ClassLoader, and to find an existing @@ -53,10 +73,15 @@ class LibraryNamespaces { initialized_ = false; app_main_namespace_ = nullptr; } - Result<NativeLoaderNamespace*> Create(JNIEnv* env, uint32_t target_sdk_version, - jobject class_loader, bool is_shared, jstring dex_path, - jstring java_library_path, jstring java_permitted_path, - jstring uses_library_list); + Result<NativeLoaderNamespace*> Create(JNIEnv* env, + uint32_t target_sdk_version, + jobject class_loader, + ApiDomain api_domain, + bool is_shared, + const std::string& dex_path, + jstring library_path_j, + jstring permitted_path_j, + jstring uses_library_list_j); NativeLoaderNamespace* FindNamespaceByClassLoader(JNIEnv* env, jobject class_loader); private: |