From 8a9b51e34f3769a5e3ea3a4383e3f00489088738 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Tue, 30 Jan 2024 21:33:09 +0000 Subject: Refactorings to make more logic available at the top level in native_loader.cpp. - Make the code that determines the partition from the dex path available to code in native_loader.cpp, and rename it since it'll be applied to arbitrary paths, not just APK's. - Move the linker namespace constants to a header file. - Various other minor code cleanups. To prepare for a later CL that needs to access these things from OpenNativeLibrary. No functional changes. Test: atest libnativeloader_e2e_tests libnativeloader_test Bug: 237577392 Change-Id: Ifc762bf6d4664b2d477c4ed3af58f149fb4c1189 --- libnativeloader/native_loader_namespace.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libnativeloader/native_loader_namespace.cpp') diff --git a/libnativeloader/native_loader_namespace.cpp b/libnativeloader/native_loader_namespace.cpp index 669fa74dc2..cfb84b7d9e 100644 --- a/libnativeloader/native_loader_namespace.cpp +++ b/libnativeloader/native_loader_namespace.cpp @@ -52,12 +52,12 @@ std::string GetLinkerError(bool is_bridged) { Result NativeLoaderNamespace::GetExportedNamespace(const std::string& name, bool is_bridged) { if (!is_bridged) { - auto raw = android_get_exported_namespace(name.c_str()); + android_namespace_t* raw = android_get_exported_namespace(name.c_str()); if (raw != nullptr) { return NativeLoaderNamespace(name, raw); } } else { - auto raw = NativeBridgeGetExportedNamespace(name.c_str()); + native_bridge_namespace_t* raw = NativeBridgeGetExportedNamespace(name.c_str()); if (raw != nullptr) { return NativeLoaderNamespace(name, raw); } @@ -69,7 +69,7 @@ Result NativeLoaderNamespace::GetExportedNamespace(const // "system" for those in the Runtime APEX. Try "system" first since // "default" always exists. Result NativeLoaderNamespace::GetSystemNamespace(bool is_bridged) { - auto ns = GetExportedNamespace(kSystemNamespaceName, is_bridged); + Result ns = GetExportedNamespace(kSystemNamespaceName, is_bridged); if (ns.ok()) return ns; ns = GetExportedNamespace(kDefaultNamespaceName, is_bridged); if (ns.ok()) return ns; @@ -96,7 +96,7 @@ Result NativeLoaderNamespace::Create( } // Fall back to the system namespace if no parent is set. - auto system_ns = GetSystemNamespace(is_bridged); + Result system_ns = GetSystemNamespace(is_bridged); if (!system_ns.ok()) { return system_ns.error(); } -- cgit v1.2.3-59-g8ed1b