parent
02b7b59ac7
commit
4e554affc3
|
|
@ -47,7 +47,6 @@ public final class LspModuleClassLoader extends ByteBufferDexClassLoader {
|
||||||
String apk) {
|
String apk) {
|
||||||
super(dexBuffers, parent);
|
super(dexBuffers, parent);
|
||||||
this.apk = apk;
|
this.apk = apk;
|
||||||
setDexName(apk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.Q)
|
@RequiresApi(Build.VERSION_CODES.Q)
|
||||||
|
|
@ -58,7 +57,6 @@ public final class LspModuleClassLoader extends ByteBufferDexClassLoader {
|
||||||
super(dexBuffers, librarySearchPath, parent);
|
super(dexBuffers, librarySearchPath, parent);
|
||||||
initNativeLibraryDirs(librarySearchPath);
|
initNativeLibraryDirs(librarySearchPath);
|
||||||
this.apk = apk;
|
this.apk = apk;
|
||||||
setDexName(apk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initNativeLibraryDirs(String librarySearchPath) {
|
private void initNativeLibraryDirs(String librarySearchPath) {
|
||||||
|
|
@ -160,7 +158,8 @@ public final class LspModuleClassLoader extends ByteBufferDexClassLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Enumeration<URL> getResources(String name) throws IOException {
|
public Enumeration<URL> getResources(String name) throws IOException {
|
||||||
@SuppressWarnings("unchecked") final var resources = (Enumeration<URL>[]) new Enumeration<?>[]{
|
@SuppressWarnings("unchecked")
|
||||||
|
final var resources = (Enumeration<URL>[]) new Enumeration<?>[]{
|
||||||
Object.class.getClassLoader().getResources(name),
|
Object.class.getClassLoader().getResources(name),
|
||||||
findResources(name),
|
findResources(name),
|
||||||
getParent() == null ? null : getParent().getResources(name)};
|
getParent() == null ? null : getParent().getResources(name)};
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,10 @@
|
||||||
package hidden;
|
package hidden;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import dalvik.system.BaseDexClassLoader;
|
import dalvik.system.BaseDexClassLoader;
|
||||||
|
|
||||||
public class ByteBufferDexClassLoader extends BaseDexClassLoader {
|
public class ByteBufferDexClassLoader extends BaseDexClassLoader {
|
||||||
static Field pathListField = null;
|
|
||||||
static Field dexElementsField = null;
|
|
||||||
static Field dexFileField = null;
|
|
||||||
static Field nameField = null;
|
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
pathListField = BaseDexClassLoader.class.getDeclaredField("pathList");
|
|
||||||
pathListField.setAccessible(true);
|
|
||||||
dexElementsField = pathListField.getType().getDeclaredField("dexElements");
|
|
||||||
dexElementsField.setAccessible(true);
|
|
||||||
var elementType = dexElementsField.getType().getComponentType();
|
|
||||||
dexFileField = elementType.getDeclaredField("dexFile");
|
|
||||||
dexFileField.setAccessible(true);
|
|
||||||
nameField = dexFileField.getType().getDeclaredField("mFileName");
|
|
||||||
nameField.setAccessible(true);
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ByteBufferDexClassLoader(ByteBuffer[] dexFiles, ClassLoader parent) {
|
public ByteBufferDexClassLoader(ByteBuffer[] dexFiles, ClassLoader parent) {
|
||||||
super(dexFiles, parent);
|
super(dexFiles, parent);
|
||||||
|
|
@ -35,17 +14,6 @@ public class ByteBufferDexClassLoader extends BaseDexClassLoader {
|
||||||
super(dexFiles, librarySearchPath, parent);
|
super(dexFiles, librarySearchPath, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some modules get their module paths from this variable
|
|
||||||
// They should use `initZygote.modulePath` instead
|
|
||||||
// Temporarily workaround
|
|
||||||
// TODO(vvb2060): removed in the next major release
|
|
||||||
public void setDexName(String name){
|
|
||||||
try {
|
|
||||||
nameField.set(dexFileField.get(((Object[]) dexElementsField.get(pathListField.get(this)))[0]), name);
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLdLibraryPath() {
|
public String getLdLibraryPath() {
|
||||||
return super.getLdLibraryPath();
|
return super.getLdLibraryPath();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package com.android.internal.os;
|
|
||||||
|
|
||||||
public class RuntimeInit {
|
|
||||||
public static final void main(String[] argv) {
|
|
||||||
throw new UnsupportedOperationException("STUB");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
package com.android.internal.os;
|
|
||||||
|
|
||||||
public class ZygoteInit {
|
|
||||||
public static void main(String[] argv) {
|
|
||||||
throw new UnsupportedOperationException("STUB");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,19 +1,8 @@
|
||||||
//
|
|
||||||
// Source code recreated from a .class file by IntelliJ IDEA
|
|
||||||
// (powered by Fernflower decompiler)
|
|
||||||
//
|
|
||||||
|
|
||||||
package dalvik.system;
|
package dalvik.system;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
public class BaseDexClassLoader extends ClassLoader {
|
public class BaseDexClassLoader extends ClassLoader {
|
||||||
private Object pathList;
|
|
||||||
public BaseDexClassLoader(String dexPath, File optimizedDirectory, String librarySearchPath, ClassLoader parent) {
|
|
||||||
throw new RuntimeException("Stub!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseDexClassLoader(ByteBuffer[] dexFiles, ClassLoader parent) {
|
public BaseDexClassLoader(ByteBuffer[] dexFiles, ClassLoader parent) {
|
||||||
throw new RuntimeException("Stub!");
|
throw new RuntimeException("Stub!");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue