ART: Clean up library loading

Retrieve the library path from the classloader before attempting to
load, instead of getting it passed down. This allows unifying said
loading behavior for follow-up changes.

Fix up test code to support the new required data in classloader
objects.

Bug: 70901841
Test: m test-art-host
Test: device boots
Change-Id: Iaccaeb56422877abac9f7fe6f5a17364c8adf4ca
diff --git a/runtime/java_vm_ext.h b/runtime/java_vm_ext.h
index 7c2755f..8c81c25 100644
--- a/runtime/java_vm_ext.h
+++ b/runtime/java_vm_ext.h
@@ -101,7 +101,6 @@
   bool LoadNativeLibrary(JNIEnv* env,
                          const std::string& path,
                          jobject class_loader,
-                         jstring library_path,
                          std::string* error_msg);
 
   // Unload native libraries with cleared class loaders.
@@ -200,6 +199,11 @@
 
   static bool IsBadJniVersion(int version);
 
+  // Return the library search path for the given classloader, if the classloader is of a
+  // well-known type. The jobject will be a local reference and is expected to be managed by the
+  // caller.
+  static jstring GetLibrarySearchPath(JNIEnv* env, jobject class_loader);
+
  private:
   // The constructor should not be called directly. It may leave the object in
   // an erroneous state, and the result needs to be checked.