Remove pendding record after hooking
This commit is contained in:
parent
126c88ab02
commit
583e24b757
|
|
@ -34,6 +34,7 @@ namespace art {
|
||||||
LOGD("Pending hook for %p (%s)", clazz_ptr,
|
LOGD("Pending hook for %p (%s)", clazz_ptr,
|
||||||
art::mirror::Class(clazz_ptr).GetDescriptor().c_str());
|
art::mirror::Class(clazz_ptr).GetDescriptor().c_str());
|
||||||
lspd::Context::GetInstance()->CallOnPostFixupStaticTrampolines(clazz_ptr);
|
lspd::Context::GetInstance()->CallOnPostFixupStaticTrampolines(clazz_ptr);
|
||||||
|
lspd::DonePendingHook(class_def);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,20 @@
|
||||||
#include "art/runtime/mirror/class.h"
|
#include "art/runtime/mirror/class.h"
|
||||||
|
|
||||||
namespace lspd {
|
namespace lspd {
|
||||||
|
namespace {
|
||||||
|
std::unordered_set<const void *> pending_classes_;
|
||||||
|
|
||||||
static std::unordered_set<const void *> pending_classes_;
|
std::unordered_set<const void *> hooked_methods_;
|
||||||
|
}
|
||||||
static std::unordered_set<const void *> hooked_methods_;
|
|
||||||
|
|
||||||
bool IsClassPending(void *clazz) {
|
bool IsClassPending(void *clazz) {
|
||||||
return pending_classes_.count(clazz);
|
return pending_classes_.count(clazz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DonePendingHook(void *clazz) {
|
||||||
|
pending_classes_.erase(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
static void PendingHooks_recordPendingMethodNative(JNI_START, jobject method_ref, jclass class_ref) {
|
static void PendingHooks_recordPendingMethodNative(JNI_START, jobject method_ref, jclass class_ref) {
|
||||||
auto *class_ptr = art::Thread::Current().DecodeJObject(class_ref);
|
auto *class_ptr = art::Thread::Current().DecodeJObject(class_ref);
|
||||||
auto *method = getArtMethod(env, method_ref);
|
auto *method = getArtMethod(env, method_ref);
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@ namespace lspd {
|
||||||
|
|
||||||
void recordHooked(void* art_method);
|
void recordHooked(void* art_method);
|
||||||
|
|
||||||
|
void DonePendingHook(void *clazz);
|
||||||
|
|
||||||
} // namespace lspd
|
} // namespace lspd
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ public final class PendingHooks {
|
||||||
for (Map.Entry<Member, XposedBridge.AdditionalHookInfo> hook : sPendingHooks.get(clazz).entrySet()) {
|
for (Map.Entry<Member, XposedBridge.AdditionalHookInfo> hook : sPendingHooks.get(clazz).entrySet()) {
|
||||||
hookMethodNative(hook.getKey(), clazz, 0, hook.getValue());
|
hookMethodNative(hook.getKey(), clazz, 0, hook.getValue());
|
||||||
}
|
}
|
||||||
|
sPendingHooks.remove(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue