Make all hooks non-null
This commit is contained in:
parent
49d8af94ba
commit
0cf4d3170e
|
|
@ -80,73 +80,73 @@ public class XposedContextWrapper extends ContextWrapper implements XposedInterf
|
|||
return getBaseContext().featuredMethod(name, args);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker<Method> hooker) {
|
||||
return getBaseContext().hookBefore(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker<Method> hooker) {
|
||||
return getBaseContext().hookAfter(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, @NonNull Hooker<Method> hooker) {
|
||||
return getBaseContext().hook(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker<Method> hooker) {
|
||||
return getBaseContext().hookBefore(origin, priority, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker<Method> hooker) {
|
||||
return getBaseContext().hookAfter(origin, priority, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker<Method> hooker) {
|
||||
return getBaseContext().hook(origin, priority, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hookBefore(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, @NonNull AfterHooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hookAfter(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, @NonNull Hooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hook(origin, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, int priority, @NonNull BeforeHooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hookBefore(origin, priority, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, int priority, @NonNull AfterHooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hookAfter(origin, priority, hooker);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
final public <T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull Hooker<Constructor<T>> hooker) {
|
||||
return getBaseContext().hook(origin, priority, hooker);
|
||||
|
|
|
|||
|
|
@ -45,6 +45,19 @@ public interface XposedInterface {
|
|||
*/
|
||||
int FRAMEWORK_PRIVILEGE_EMBEDDED = 3;
|
||||
|
||||
/**
|
||||
* The default hook priority.
|
||||
*/
|
||||
int PRIORITY_DEFAULT = 50;
|
||||
/**
|
||||
* Execute the hook callback late.
|
||||
*/
|
||||
int PRIORITY_LOWEST = -10000;
|
||||
/**
|
||||
* Execute the hook callback early.
|
||||
*/
|
||||
int PRIORITY_HIGHEST = 10000;
|
||||
|
||||
/**
|
||||
* The interface Before hook callback.
|
||||
*
|
||||
|
|
@ -306,6 +319,24 @@ public interface XposedInterface {
|
|||
void unhook();
|
||||
}
|
||||
|
||||
/**
|
||||
* The exception thrown when a hook fails
|
||||
*/
|
||||
class HookFailedException extends RuntimeException {
|
||||
|
||||
public HookFailedException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public HookFailedException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public HookFailedException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets framework name.
|
||||
*
|
||||
|
|
@ -343,6 +374,7 @@ public interface XposedInterface {
|
|||
* @param args the args
|
||||
* @return the object
|
||||
*/
|
||||
@Nullable
|
||||
Object featuredMethod(String name, Object... args);
|
||||
|
||||
/**
|
||||
|
|
@ -351,8 +383,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, @NonNull BeforeHooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -361,8 +394,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, @NonNull AfterHooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -371,8 +405,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, @NonNull Hooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -382,8 +417,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<BeforeHooker<Method>, Method> hookBefore(@NonNull Method origin, int priority, @NonNull BeforeHooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -393,8 +429,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<AfterHooker<Method>, Method> hookAfter(@NonNull Method origin, int priority, @NonNull AfterHooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -404,8 +441,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
MethodUnhooker<Hooker<Method>, Method> hook(@NonNull Method origin, int priority, @NonNull Hooker<Method> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -415,8 +453,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, @NonNull BeforeHooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -426,8 +465,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, @NonNull AfterHooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -437,8 +477,9 @@ public interface XposedInterface {
|
|||
* @param origin the origin
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, @NonNull Hooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -449,8 +490,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<BeforeHooker<Constructor<T>>, Constructor<T>> hookBefore(@NonNull Constructor<T> origin, int priority, @NonNull BeforeHooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -461,8 +503,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<AfterHooker<Constructor<T>>, Constructor<T>> hookAfter(@NonNull Constructor<T> origin, int priority, @NonNull AfterHooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
@ -473,8 +516,9 @@ public interface XposedInterface {
|
|||
* @param priority the priority
|
||||
* @param hooker the hooker
|
||||
* @return the method unhooker
|
||||
* @throws HookFailedException if hook fails
|
||||
*/
|
||||
@Nullable
|
||||
@NonNull
|
||||
<T> MethodUnhooker<Hooker<Constructor<T>>, Constructor<T>> hook(@NonNull Constructor<T> origin, int priority, @NonNull Hooker<Constructor<T>> hooker);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue