Skip to content

Allow anonymous XposedInterface.Hooker implementation and provide a way to skip hooked methods #10

@anonymix007

Description

@anonymix007

Sometimes it's needed to hook lots of different methods (about 50 in my case), so only one XposedInterface.Hooker class isn't enough, because dispatching between hooked methods will be ugly. Having anonymous implementation of XposedInterface.Hooker is more convenient, but it's now impossible:

hook(method, new @XposedHooker Hooker() {
    @BeforeInvocation
    public static @Nullable Hooker before(@NonNull Member member, @Nullable Object thisObject, @NonNull Object[] args) {
        // Do something
        return null;
    }
}.getClass());

will not compile because of '@XposedHooker' not applicable to type use
It's also a bit problematic to create return value of before method as anonymous classes don't have constructors.

Another problem is that some methods need to be skipped (because of their side effects), and now it's also impossible.
So maybe before and after methods should include new parameter, which will contain functions returnAndSkip, setThrowable and others?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions