Add getLdLibraryPath (#812)
This commit is contained in:
parent
2c34372803
commit
bfe31837ad
|
|
@ -114,6 +114,18 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLdLibraryPath() {
|
||||
var result = new StringBuilder();
|
||||
for (var directory : nativeLibraryDirs) {
|
||||
if (result.length() > 0) {
|
||||
result.append(':');
|
||||
}
|
||||
result.append(directory);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected URL findResource(String name) {
|
||||
try {
|
||||
|
|
@ -152,12 +164,14 @@ public final class InMemoryDelegateLastClassLoader extends ByteBufferDexClassLoa
|
|||
return new CompoundEnumeration<>(resources);
|
||||
}
|
||||
|
||||
public static InMemoryDelegateLastClassLoader loadApk(File apk, String librarySearchPath, ClassLoader parent) {
|
||||
public static InMemoryDelegateLastClassLoader loadApk(File apk,
|
||||
String librarySearchPath,
|
||||
ClassLoader parent) {
|
||||
var byteBuffers = new ArrayList<ByteBuffer>();
|
||||
try (var apkFile = new ZipFile(apk)) {
|
||||
int secondaryNumber = 2;
|
||||
int secondary = 2;
|
||||
for (var dexFile = apkFile.getEntry("classes.dex"); dexFile != null;
|
||||
dexFile = apkFile.getEntry("classes" + secondaryNumber + ".dex"), secondaryNumber++) {
|
||||
dexFile = apkFile.getEntry("classes" + secondary + ".dex"), secondary++) {
|
||||
try (var in = apkFile.getInputStream(dexFile)) {
|
||||
var byteBuffer = ByteBuffer.allocate(in.available());
|
||||
byteBuffer.mark();
|
||||
|
|
|
|||
|
|
@ -12,4 +12,8 @@ public class ByteBufferDexClassLoader extends BaseDexClassLoader {
|
|||
public ByteBufferDexClassLoader(ByteBuffer[] dexFiles, String librarySearchPath, ClassLoader parent) {
|
||||
super(dexFiles, librarySearchPath, parent);
|
||||
}
|
||||
|
||||
public String getLdLibraryPath() {
|
||||
return super.getLdLibraryPath();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@
|
|||
package dalvik.system;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Enumeration;
|
||||
|
||||
public class BaseDexClassLoader extends ClassLoader {
|
||||
public BaseDexClassLoader(String dexPath, File optimizedDirectory, String librarySearchPath, ClassLoader parent) {
|
||||
|
|
@ -23,31 +21,7 @@ public class BaseDexClassLoader extends ClassLoader {
|
|||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
protected Class<?> findClass(String name) throws ClassNotFoundException {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
protected URL findResource(String name) {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
protected Enumeration<URL> findResources(String name) {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
public String findLibrary(String name) {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
protected synchronized Package getPackage(String name) {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
|
||||
public void addDexPath(String dexPath) {
|
||||
public String getLdLibraryPath() {
|
||||
throw new RuntimeException("Stub!");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue