Skip to content

Commit

Permalink
Avoid parsing libart for multiple times
Browse files Browse the repository at this point in the history
Use GetArt instead of parsing the lib anew.
  • Loading branch information
JingMatrix committed Nov 21, 2024
1 parent 403b5fa commit 5da38f6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion magisk-loader/src/main/jni/src/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ namespace lspd {
return;
}

auto &art = lspd::GetArt();
auto binder_class = JNI_FindClass(env, "android/os/Binder");
exec_transact_backup_methodID_ = JNI_GetMethodID(env, binder_class, "execTransact",
"(IJJI)Z");
auto *setTableOverride = SandHook::ElfImg("/libart.so").getSymbAddress<void (*)(JNINativeInterface *)>(
auto *setTableOverride = art->getSymbAddress<void (*)(JNINativeInterface *)>(
"_ZN3art9JNIEnvExt16SetTableOverrideEPK18JNINativeInterface");
if (!setTableOverride) {
LOGE("set table override not found");
Expand All @@ -247,6 +248,7 @@ namespace lspd {
auto &binder = lspd::GetLibBinder(false);
IPCThreadState::Init(binder.get());
lspd::GetLibBinder(true);
lspd::GetArt(true);

LOGD("Done InitService");
}
Expand Down

0 comments on commit 5da38f6

Please sign in to comment.