diff options
author | Dmitriy Ivanov <dimitry@google.com> | 2015-06-05 22:06:06 -0700 |
---|---|---|
committer | Dmitriy Ivanov <dimitry@google.com> | 2015-06-11 10:26:06 -0700 |
commit | f38cae4f22e46c49f5fba94e6e0579dedd2d8fd1 (patch) | |
tree | f0b1200e0e68942afafb6b1543c84707fe7004d2 /luni | |
parent | eb80877fdf508af478bf59b338cab127abc54d9a (diff) | |
download | libcore-f38cae4f22e46c49f5fba94e6e0579dedd2d8fd1.zip libcore-f38cae4f22e46c49f5fba94e6e0579dedd2d8fd1.tar.gz libcore-f38cae4f22e46c49f5fba94e6e0579dedd2d8fd1.tar.bz2 |
Fix lookup order when opening directly from APK
The order should be as follows:
1. Uncompressed native library dir (if any)
2. Directly from apk (<apk>!/lib/<abi>)
3. vendor/lib:/system/lib
Bug: http://b/21647354
Bug: http://b/21667767
Bug: http://b/21726698
Bug: http://b/8076853
Change-Id: I62cd76b7e4ae927d865d7d0ee81ceb91caa54e99
Diffstat (limited to 'luni')
-rw-r--r-- | luni/src/main/java/java/lang/Runtime.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/luni/src/main/java/java/lang/Runtime.java b/luni/src/main/java/java/lang/Runtime.java index ad549f2..f1f6438 100644 --- a/luni/src/main/java/java/lang/Runtime.java +++ b/luni/src/main/java/java/lang/Runtime.java @@ -358,11 +358,14 @@ 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) { - // The dynamic linker might still find the library by name. - filename = System.mapLibraryName(libraryName); + // 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) + "\""); } String error = doLoad(filename, loader); if (error != null) { @@ -424,19 +427,18 @@ public class Runtime { } else if (loader instanceof BaseDexClassLoader) { 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, dexPath); + return nativeLoad(name, loader, ldLibraryPath); } } // TODO: should be synchronized, but dalvik doesn't support synchronized internal natives. private static native String nativeLoad(String filename, ClassLoader loader, - String ldLibraryPath, String dexPath); + String ldLibraryPath); /** * Provides a hint to the runtime that it would be useful to attempt |