Delete unused functions

This commit is contained in:
kotori0 2020-12-11 00:23:04 +08:00
commit f2f0a298c7
10 changed files with 0 additions and 52 deletions

View File

@ -10,11 +10,6 @@ public class ClassLinker implements KeepAll {
public static native void setEntryPointsToInterpreter(Member method);
public static void onPreFixupStaticTrampolines(Class clazz) {
// remove modified native flags to let FixupStaticTrampolines fill in right entrypoints
PendingHooks.removeNativeFlags(clazz);
}
public static void onPostFixupStaticTrampolines(Class clazz) {
// native flags will be re-set in hooking logic
PendingHooks.hookPendingMethod(clazz);

View File

@ -39,11 +39,6 @@ public abstract class BaseHookProvider implements HookProvider {
return false;
}
@Override
public void setNativeFlag(Member hookMethod, boolean isNative) {
Yahfa.setNativeFlag(hookMethod, isNative);
}
@Override
public boolean methodHooked(Member target) {
return Yahfa.isHooked(target);

View File

@ -14,8 +14,6 @@ public class Yahfa {
public static native void setMethodNonCompilable(Member member);
public static native boolean setNativeFlag(Member member, boolean isNative);
public static native void recordHooked(Member member);
public static native boolean isHooked(Member member);

View File

@ -23,8 +23,6 @@ void Java_lab_galaxy_yahfa_HookMain_ensureMethodCached(JNIEnv *env, jclass clazz
void setNonCompilable(void *method);
bool setNativeFlag(void *method, bool isNative);
void *getArtMethod(JNIEnv *env, jobject jmethod);
// TODO: move to common utils instead of in YAHFA's code

View File

@ -40,9 +40,6 @@ namespace art {
const char *desc = clazz.GetDescriptor(&storage);
bool should_intercept =
edxp::IsClassPending(desc) || std::string(desc).rfind("LEdHooker_") == 0;
if (UNLIKELY(should_intercept)) {
edxp::Context::GetInstance()->CallOnPreFixupStaticTrampolines(clazz_ptr);
}
FixupStaticTrampolinesBackup(thiz, clazz_ptr);
if (UNLIKELY(should_intercept)) {
edxp::Context::GetInstance()->CallOnPostFixupStaticTrampolines(clazz_ptr);

View File

@ -50,10 +50,6 @@ namespace edxp {
}
}
void Context::CallOnPreFixupStaticTrampolines(void *class_ptr) {
CallPostFixupStaticTrampolinesCallback(class_ptr, pre_fixup_static_mid_);
}
void Context::CallOnPostFixupStaticTrampolines(void *class_ptr) {
CallPostFixupStaticTrampolinesCallback(class_ptr, post_fixup_static_mid_);
}
@ -116,9 +112,6 @@ namespace edxp {
env->GetJavaVM(&vm_);
class_linker_class_ = (jclass) env->NewGlobalRef(
FindClassFromLoader(env, kClassLinkerClassName));
pre_fixup_static_mid_ = JNI_GetStaticMethodID(env, class_linker_class_,
"onPreFixupStaticTrampolines",
"(Ljava/lang/Class;)V");
post_fixup_static_mid_ = JNI_GetStaticMethodID(env, class_linker_class_,
"onPostFixupStaticTrampolines",
"(Ljava/lang/Class;)V");

View File

@ -32,8 +32,6 @@ namespace edxp {
inline auto GetCurrentClassLoader() const { return inject_class_loader_; }
void CallOnPreFixupStaticTrampolines(void *class_ptr);
void CallOnPostFixupStaticTrampolines(void *class_ptr);
void PrepareJavaEnv(JNIEnv *env);
@ -90,7 +88,6 @@ namespace edxp {
jstring nice_name_ = nullptr;
JavaVM *vm_ = nullptr;
jclass class_linker_class_ = nullptr;
jmethodID pre_fixup_static_mid_ = nullptr;
jmethodID post_fixup_static_mid_ = nullptr;
bool skip_ = false;
std::vector<std::vector<signed char>> dexes;

View File

@ -38,19 +38,6 @@ namespace edxp {
setNonCompilable(art_method);
}
static jboolean Yahfa_setNativeFlag(JNI_START, jobject member, jboolean is_native) {
if (!member) {
LOGE("setNativeFlagNative: member is null");
return JNI_FALSE;
}
void *art_method = getArtMethod(env, member);
if (!art_method) {
LOGE("setNativeFlagNative: art_method is null");
return JNI_FALSE;
}
return (jboolean) setNativeFlag(art_method, is_native);
}
static void Yahfa_recordHooked(JNI_START, jobject member) {
edxp::recordHooked(getArtMethod(env, member));
}
@ -72,7 +59,6 @@ namespace edxp {
NATIVE_METHOD(Yahfa, backupAndHookNative,
"(Ljava/lang/Object;Ljava/lang/reflect/Method;Ljava/lang/reflect/Method;)Z"),
NATIVE_METHOD(Yahfa, setMethodNonCompilable, "(Ljava/lang/reflect/Member;)V"),
NATIVE_METHOD(Yahfa, setNativeFlag, "(Ljava/lang/reflect/Member;Z)Z"),
NATIVE_METHOD(Yahfa, recordHooked, "(Ljava/lang/reflect/Member;)V"),
NATIVE_METHOD(Yahfa, isHooked, "(Ljava/lang/reflect/Member;)Z"),
NATIVE_METHOD(Yahfa, makeInitializedClassesVisiblyInitialized, "(JZ)V"),

View File

@ -26,8 +26,6 @@ public interface HookProvider {
boolean removeFinalFlagNative(Class clazz);
void setNativeFlag(Member hookMethod, boolean isNative);
boolean methodHooked(Member target);
}

View File

@ -25,21 +25,12 @@ public final class PendingHooks {
}
}
public synchronized static void removeNativeFlags(Class clazz) {
for (Member member : sPendingHookMethods.keySet()) {
if (member.getDeclaringClass().equals(clazz) && sNonNativeMethods.contains(member)) {
EdXpConfigGlobal.getHookProvider().setNativeFlag(member, false);
}
}
}
public synchronized static void recordPendingMethod(Member hookMethod,
XposedBridge.AdditionalHookInfo additionalInfo) {
if (!Modifier.isNative(hookMethod.getModifiers())) {
// record non-native methods for later native flag temporary removing
sNonNativeMethods.add(hookMethod);
}
EdXpConfigGlobal.getHookProvider().setNativeFlag(hookMethod, true);
sPendingHookMethods.put(hookMethod, additionalInfo);
recordPendingMethodNative("L" +
hookMethod.getDeclaringClass().getName().replace(".", "/") + ";");