Revert "Throw HookFailedException"
This reverts commit 06cb7abedbd1af4d58d42ebe79b5458f7dad62c5.
This commit is contained in:
parent
c69bd3fbcc
commit
b228c224c1
|
|
@ -1,5 +1,7 @@
|
||||||
package org.lsposed.lspd.impl;
|
package org.lsposed.lspd.impl;
|
||||||
|
|
||||||
|
import static de.robv.android.xposed.callbacks.XCallback.PRIORITY_DEFAULT;
|
||||||
|
|
||||||
import android.app.ActivityThread;
|
import android.app.ActivityThread;
|
||||||
import android.app.LoadedApk;
|
import android.app.LoadedApk;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
|
|
@ -850,7 +852,6 @@ public class LSPosedContext extends XposedContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
private <T, U extends Executable> MethodUnhooker<T, U> doHook(U hookMethod, int priority, T callback) {
|
private <T, U extends Executable> MethodUnhooker<T, U> doHook(U hookMethod, int priority, T callback) {
|
||||||
try {
|
|
||||||
if (Modifier.isAbstract(hookMethod.getModifiers())) {
|
if (Modifier.isAbstract(hookMethod.getModifiers())) {
|
||||||
throw new IllegalArgumentException("Cannot hook abstract methods: " + hookMethod);
|
throw new IllegalArgumentException("Cannot hook abstract methods: " + hookMethod);
|
||||||
} else if (hookMethod.getDeclaringClass().getClassLoader() == LSPosedContext.class.getClassLoader()) {
|
} else if (hookMethod.getDeclaringClass().getClassLoader() == LSPosedContext.class.getClassLoader()) {
|
||||||
|
|
@ -883,82 +884,78 @@ public class LSPosedContext extends XposedContext {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
|
||||||
throw new HookFailedException(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
log("Cannot hook " + hookMethod);
|
log("Cannot hook " + hookMethod);
|
||||||
throw new HookFailedException("Cannot hook " + hookMethod);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker<Method> hooker) {
|
public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker<Method> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker<Method> hooker) {
|
public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker<Method> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, @NonNull Hooker<Method> hooker) {
|
public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, @NonNull Hooker<Method> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker<Method> hooker) {
|
public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker<Method> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker<Method> hooker) {
|
public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker<Method> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker<Method> hooker) {
|
public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker<Method> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, @NonNull AfterHooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, @NonNull AfterHooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, @NonNull Hooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, @NonNull Hooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
return doHook(origin, PRIORITY_DEFAULT, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, int priority, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, int priority, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, int priority, @NonNull AfterHooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, int priority, @NonNull AfterHooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NonNull
|
@Nullable
|
||||||
public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull Hooker<Constructor<T>> hooker) {
|
public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull Hooker<Constructor<T>> hooker) {
|
||||||
return doHook(origin, priority, hooker);
|
return doHook(origin, priority, hooker);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue