summaryrefslogtreecommitdiffstats
path: root/luni
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-03-23 19:45:21 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-23 19:45:22 +0000
commit7cc1a6c4408549324ef9f35dcb57c947693987f0 (patch)
tree059353ecc6d06ea5d0460d31ba6a43f454faeadf /luni
parent8bed4516c2c7e71a0ad33e46d1524c8d232785df (diff)
parent7694b783f48e2cc57928b61c84fd90311cb0c35a (diff)
downloadlibcore-7cc1a6c4408549324ef9f35dcb57c947693987f0.zip
libcore-7cc1a6c4408549324ef9f35dcb57c947693987f0.tar.gz
libcore-7cc1a6c4408549324ef9f35dcb57c947693987f0.tar.bz2
Merge "Pass getDexPath to Runtime.nativeLoad"
Diffstat (limited to 'luni')
-rw-r--r--luni/src/main/java/java/lang/Runtime.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/luni/src/main/java/java/lang/Runtime.java b/luni/src/main/java/java/lang/Runtime.java
index a3cb83e..73820dc 100644
--- a/luni/src/main/java/java/lang/Runtime.java
+++ b/luni/src/main/java/java/lang/Runtime.java
@@ -357,14 +357,11 @@ public class Runtime {
*/
void loadLibrary(String libraryName, ClassLoader loader) {
if (loader != null) {
+ // TODO: We shouldn't assume that we know default linker search logic.
String filename = loader.findLibrary(libraryName);
if (filename == null) {
- // It's not necessarily true that the ClassLoader used
- // System.mapLibraryName, but the default setup does, and it's
- // misleading to say we didn't find "libMyLibrary.so" when we
- // actually searched for "liblibMyLibrary.so.so".
- throw new UnsatisfiedLinkError(loader + " couldn't find \"" +
- System.mapLibraryName(libraryName) + "\"");
+ // The dynamic linker might still find the library by name.
+ filename = System.mapLibraryName(libraryName);
}
String error = doLoad(filename, loader);
if (error != null) {
@@ -418,19 +415,23 @@ public class Runtime {
// So, find out what the native library search path is for the ClassLoader in question...
String ldLibraryPath = null;
+ String dexPath = null;
if (loader != null && loader instanceof BaseDexClassLoader) {
- ldLibraryPath = ((BaseDexClassLoader) loader).getLdLibraryPath();
+ BaseDexClassLoader dexClassLoader = (BaseDexClassLoader) loader;
+ ldLibraryPath = dexClassLoader.getLdLibraryPath();
+ dexPath = dexClassLoader.getDexPath();
}
// nativeLoad should be synchronized so there's only one LD_LIBRARY_PATH in use regardless
// of how many ClassLoaders are in the system, but dalvik doesn't support synchronized
// internal natives.
synchronized (this) {
- return nativeLoad(name, loader, ldLibraryPath);
+ return nativeLoad(name, loader, ldLibraryPath, dexPath);
}
}
// TODO: should be synchronized, but dalvik doesn't support synchronized internal natives.
- private static native String nativeLoad(String filename, ClassLoader loader, String ldLibraryPath);
+ private static native String nativeLoad(String filename, ClassLoader loader,
+ String ldLibraryPath, String dexPath);
/**
* Provides a hint to the VM that it would be useful to attempt