Commit 5b8585d4 authored by swift_gan's avatar swift_gan

disable useless reset declaring class

parent bc670453
......@@ -138,21 +138,25 @@ public class SandHook {
HookWrapper.HookEntity hookEntity = globalHookEntityMap.get(originMethod);
if (hookEntity == null || hookEntity.backup == null)
return null;
return callOriginMethod(originMethod, hookEntity.backup, thiz, args);
return callOriginMethod(hookEntity.backupIsStub, originMethod, hookEntity.backup, thiz, args);
}
public static Object callOriginByBackup(Method backupMethod, Object thiz, Object... args) throws Throwable {
HookWrapper.HookEntity hookEntity = globalBackupMap.get(backupMethod);
if (hookEntity == null)
return null;
return callOriginMethod(hookEntity.target, backupMethod, thiz, args);
return callOriginMethod(hookEntity.backupIsStub, hookEntity.target, backupMethod, thiz, args);
}
public static Object callOriginMethod(Member originMethod, Method backupMethod, Object thiz, Object[] args) throws Throwable {
//holder in stack to avoid moving gc
Class originClassHolder = originMethod.getDeclaringClass();
return callOriginMethod(false, originMethod, backupMethod, thiz, args);
}
public static Object callOriginMethod(boolean backupIsStub, Member originMethod, Method backupMethod, Object thiz, Object[] args) throws Throwable {
//reset declaring class
if (SandHookConfig.SDK_INT >= Build.VERSION_CODES.N) {
if (!backupIsStub && SandHookConfig.SDK_INT >= Build.VERSION_CODES.N) {
//holder in stack to avoid moving gc
Class originClassHolder = originMethod.getDeclaringClass();
ensureDeclareClass(originMethod, backupMethod);
}
if (Modifier.isStatic(originMethod.getModifiers())) {
......
......@@ -405,6 +405,7 @@ public class HookWrapper {
public boolean hookIsStub = false;
public boolean resolveDexCache = true;
public boolean backupIsStub = true;
public Class[] pars;
public int hookMode;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment