Fix module not loading on first run
This commit is contained in:
parent
4e41e141dd
commit
641ed369fa
2
core
2
core
|
|
@ -1 +1 @@
|
|||
Subproject commit dd8dcfbab1d8aa8a408ab57cb5e934684679533d
|
||||
Subproject commit d36d284f3908e7f5eb8bcb873e637cac2db27b01
|
||||
|
|
@ -93,10 +93,11 @@ public class LSPApplication {
|
|||
try {
|
||||
disableProfile(context);
|
||||
Startup.initXposed(false, ActivityThread.currentProcessName(), service);
|
||||
Log.i(TAG, "Start loading modules");
|
||||
Log.i(TAG, "Bootstrap Xposed");
|
||||
Startup.bootstrapXposed();
|
||||
// WARN: Since it uses `XResource`, the following class should not be initialized
|
||||
// before forkPostCommon is invoke. Otherwise, you will get failure of XResources
|
||||
Log.i(TAG, "Load modules");
|
||||
LSPLoader.initModules(appLoadedApk);
|
||||
Log.i(TAG, "Modules initialized");
|
||||
|
||||
|
|
|
|||
|
|
@ -71,11 +71,15 @@ namespace lspd {
|
|||
env->DeleteLocalRef(dex_buffer);
|
||||
}
|
||||
|
||||
void PatchLoader::InitHooks(JNIEnv* env, const lsplant::InitInfo& initInfo) {
|
||||
void PatchLoader::InitArtHooker(JNIEnv* env, const InitInfo& initInfo) {
|
||||
Context::InitArtHooker(env, initInfo);
|
||||
handler = initInfo;
|
||||
Context::InitHooks(env, handler);
|
||||
art::DisableInline(handler);
|
||||
art::DisableBackgroundVerification(handler);
|
||||
art::DisableInline(initInfo);
|
||||
art::DisableBackgroundVerification(initInfo);
|
||||
}
|
||||
|
||||
void PatchLoader::InitHooks(JNIEnv* env) {
|
||||
Context::InitHooks(env);
|
||||
RegisterBypass(env);
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +92,7 @@ namespace lspd {
|
|||
|
||||
void PatchLoader::Load(JNIEnv* env) {
|
||||
InitSymbolCache(nullptr);
|
||||
lsplant::InitInfo initInfo{
|
||||
lsplant::InitInfo initInfo {
|
||||
.inline_hooker = [](auto t, auto r) {
|
||||
void* bk = nullptr;
|
||||
return HookFunction(t, r, &bk) == RS_SUCCESS ? bk : nullptr;
|
||||
|
|
@ -108,10 +112,11 @@ namespace lspd {
|
|||
auto dex_field = JNI_GetStaticFieldID(env, stub, "dex", "[B");
|
||||
|
||||
auto array = (jbyteArray) env->GetStaticObjectField(stub, dex_field);
|
||||
auto dex = PreloadedDex{env->GetByteArrayElements(array, nullptr), static_cast<size_t>(JNI_GetArrayLength(env, array))};
|
||||
auto dex = PreloadedDex {env->GetByteArrayElements(array, nullptr), static_cast<size_t>(JNI_GetArrayLength(env, array))};
|
||||
|
||||
InitArtHooker(env, initInfo);
|
||||
LoadDex(env, std::move(dex));
|
||||
InitHooks(env, initInfo);
|
||||
InitHooks(env);
|
||||
|
||||
GetArt(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ namespace lspd {
|
|||
void Load(JNIEnv* env);
|
||||
|
||||
protected:
|
||||
void InitHooks(JNIEnv* env, const lsplant::InitInfo& initInfo) override;
|
||||
void InitArtHooker(JNIEnv* env, const lsplant::InitInfo& initInfo) override;
|
||||
|
||||
void InitHooks(JNIEnv* env) override;
|
||||
|
||||
void LoadDex(JNIEnv* env, PreloadedDex&& dex) override;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue