Separate InitArtHooker and InitHooks (#1965)
This commit is contained in:
parent
dd8dcfbab1
commit
d36d284f39
|
|
@ -115,7 +115,9 @@ namespace lspd {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void InitHooks(JNIEnv *env, const lsplant::InitInfo &initInfo);
|
virtual void InitArtHooker(JNIEnv *env, const lsplant::InitInfo &initInfo);
|
||||||
|
|
||||||
|
virtual void InitHooks(JNIEnv *env);
|
||||||
|
|
||||||
virtual void LoadDex(JNIEnv *env, PreloadedDex &&dex) = 0;
|
virtual void LoadDex(JNIEnv *env, PreloadedDex &&dex) = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,14 @@ namespace lspd {
|
||||||
if (*this) munmap(addr_, size_);
|
if (*this) munmap(addr_, size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::InitHooks(JNIEnv *env, const lsplant::InitInfo &initInfo) {
|
void Context::InitArtHooker(JNIEnv *env, const lsplant::InitInfo &initInfo) {
|
||||||
if (!lsplant::Init(env, initInfo)) {
|
if (!lsplant::Init(env, initInfo)) {
|
||||||
LOGE("Failed to init lsplant");
|
LOGE("Failed to init lsplant");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Context::InitHooks(JNIEnv *env) {
|
||||||
auto path_list = JNI_GetObjectFieldOf(env, inject_class_loader_, "pathList",
|
auto path_list = JNI_GetObjectFieldOf(env, inject_class_loader_, "pathList",
|
||||||
"Ldalvik/system/DexPathList;");
|
"Ldalvik/system/DexPathList;");
|
||||||
if (!path_list) {
|
if (!path_list) {
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,5 @@ android.nonTransitiveRClass=true
|
||||||
android.enableR8.fullMode=true
|
android.enableR8.fullMode=true
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
|
|
||||||
agpVersion=7.2.0
|
agpVersion=7.2.1
|
||||||
navVersion=2.5.0-alpha04
|
navVersion=2.5.0-alpha04
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,8 @@ namespace lspd {
|
||||||
return GetArt()->getSymbPrefixFirstAddress(symbol);
|
return GetArt()->getSymbPrefixFirstAddress(symbol);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
InitHooks(env, initInfo);
|
InitArtHooker(env, initInfo);
|
||||||
|
InitHooks(env);
|
||||||
SetupEntryClass(env);
|
SetupEntryClass(env);
|
||||||
FindAndCall(env, "forkCommon",
|
FindAndCall(env, "forkCommon",
|
||||||
"(ZLjava/lang/String;Landroid/os/IBinder;)V",
|
"(ZLjava/lang/String;Landroid/os/IBinder;)V",
|
||||||
|
|
@ -213,7 +214,8 @@ namespace lspd {
|
||||||
ConfigBridge::GetInstance()->obfuscation_map(std::move(obfs_map));
|
ConfigBridge::GetInstance()->obfuscation_map(std::move(obfs_map));
|
||||||
LoadDex(env, PreloadedDex(dex_fd, size));
|
LoadDex(env, PreloadedDex(dex_fd, size));
|
||||||
close(dex_fd);
|
close(dex_fd);
|
||||||
InitHooks(env, initInfo);
|
InitArtHooker(env, initInfo);
|
||||||
|
InitHooks(env);
|
||||||
SetupEntryClass(env);
|
SetupEntryClass(env);
|
||||||
LOGD("Done prepare");
|
LOGD("Done prepare");
|
||||||
FindAndCall(env, "forkCommon",
|
FindAndCall(env, "forkCommon",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue