[core] fix loading embedded module so (#1036)
* [core] fix loading embedded module so * [core] move if out of for * [core] make cpp master happy * [core] make cpp master happy once more Co-authored-by: LoveSy <shana@zju.edu.cn>
This commit is contained in:
parent
673079b9c1
commit
1075743360
|
|
@ -1,6 +1,7 @@
|
|||
package org.lsposed.lspd.models;
|
||||
|
||||
parcelable PreLoadedApk {
|
||||
String hostApk;
|
||||
List<SharedMemory> preLoadedDexes;
|
||||
List<String> moduleClassNames;
|
||||
List<String> moduleLibraryNames;
|
||||
|
|
|
|||
|
|
@ -336,9 +336,23 @@ public final class XposedInit {
|
|||
|
||||
var sb = new StringBuilder();
|
||||
var abis = Process.is64Bit() ? Build.SUPPORTED_64_BIT_ABIS : Build.SUPPORTED_32_BIT_ABIS;
|
||||
if (file.hostApk != null) {
|
||||
try {
|
||||
var runtime = XposedHelpers.callStaticMethod(Class.forName("dalvik.system.VMRuntime"), "getRuntime");
|
||||
var arch = (String) XposedHelpers.callMethod(runtime, "vmInstructionSet");
|
||||
var hostDir = new File(file.hostApk).getParent();
|
||||
for (String abi : abis) {
|
||||
sb.append(hostDir).append("/lib/").append(arch).append("/").append(name).append(".so!/lib/").append(abi).append(File.pathSeparator);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e(TAG, " Cannot load module: " + name, e);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for (String abi : abis) {
|
||||
sb.append(apk).append("!/lib/").append(abi).append(File.pathSeparator);
|
||||
}
|
||||
}
|
||||
var librarySearchPath = sb.toString();
|
||||
|
||||
var initLoader = XposedInit.class.getClassLoader();
|
||||
|
|
|
|||
Loading…
Reference in New Issue