chore: adjust hook interface
This commit is contained in:
@@ -243,14 +243,4 @@ public interface IHookBridge {
|
||||
<T> T newInstanceOrigin(@NonNull Constructor<T> constructor, @NonNull Object... args)
|
||||
throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException;
|
||||
|
||||
/**
|
||||
* Query the extension of the current implementation.
|
||||
*
|
||||
* @param key The key of the extension
|
||||
* @param args The arguments for the extension, may be empty
|
||||
* @return The result of the extension, may be null
|
||||
*/
|
||||
@Nullable
|
||||
Object queryExtension(@NonNull String key, @Nullable Object... args);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.github.qauxv.loader.hookapi;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@Keep
|
||||
public interface ILoaderInfo {
|
||||
@@ -26,4 +27,14 @@ public interface ILoaderInfo {
|
||||
|
||||
void log(@NonNull Throwable tr);
|
||||
|
||||
/**
|
||||
* Query the extension of the current implementation.
|
||||
*
|
||||
* @param key The key of the extension
|
||||
* @param args The arguments for the extension, may be empty
|
||||
* @return The result of the extension, may be null
|
||||
*/
|
||||
@Nullable
|
||||
Object queryExtension(@NonNull String key, @Nullable Object... args);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* QAuxiliary - An Xposed module for QQ/TIM
|
||||
* Copyright (C) 2019-2024 QAuxiliary developers
|
||||
* https://github.com/cinit/QAuxiliary
|
||||
*
|
||||
* This software is an opensource software: you can redistribute it
|
||||
* and/or modify it under the terms of the General Public License
|
||||
* as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version as published
|
||||
* by QAuxiliary contributors.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the General Public License
|
||||
* along with this software.
|
||||
* If not, see
|
||||
* <https://github.com/cinit/QAuxiliary/blob/master/LICENSE.md>.
|
||||
*/
|
||||
|
||||
package io.github.qauxv.loader.sbl.lsp100;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import io.github.libxposed.api.XposedInterface;
|
||||
import io.github.qauxv.loader.sbl.common.CheckUtils;
|
||||
import io.github.qauxv.loader.sbl.common.ModuleLoader;
|
||||
|
||||
public class Lsp100ExtCmd {
|
||||
|
||||
private Lsp100ExtCmd() {
|
||||
}
|
||||
|
||||
public static Object handleQueryExtension(@NonNull String cmd, @Nullable Object[] arg) {
|
||||
CheckUtils.checkNonNull(cmd, "cmd");
|
||||
switch (cmd) {
|
||||
case "GetXposedInterfaceClass":
|
||||
return XposedInterface.class;
|
||||
case "GetLoadPackageParam":
|
||||
return null;
|
||||
case "GetInitZygoteStartupParam":
|
||||
return null;
|
||||
case "GetInitErrors":
|
||||
return ModuleLoader.getInitErrors();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -123,13 +123,13 @@ public class Lsp100HookImpl implements IHookBridge, ILoaderInfo {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object queryExtension(@NonNull String key, @Nullable Object... args) {
|
||||
return null;
|
||||
return Lsp100ExtCmd.handleQueryExtension(key, args);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEntryPointName() {
|
||||
return this.getClass().getSimpleName();
|
||||
return this.getClass().getName();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -296,7 +296,7 @@ public class Lsp100HookWrapper {
|
||||
public static class Lsp100HookAgent implements XposedInterface.Hooker {
|
||||
|
||||
@BeforeInvocation
|
||||
public static InvocationParamWrapper beforeInvocation(@NonNull XposedInterface.BeforeHookCallback callback) {
|
||||
public static InvocationParamWrapper before(@NonNull XposedInterface.BeforeHookCallback callback) {
|
||||
Member member = callback.getMember();
|
||||
// lookup callback list
|
||||
ConcurrentHashMap<Member, CallbackListHolder> callbackList = sCallbackRegistry.get(member.getDeclaringClass());
|
||||
@@ -330,7 +330,7 @@ public class Lsp100HookWrapper {
|
||||
}
|
||||
|
||||
@AfterInvocation
|
||||
public static void afterInvocation(
|
||||
public static void after(
|
||||
@NonNull XposedInterface.AfterHookCallback callback,
|
||||
@Nullable InvocationParamWrapper param
|
||||
) {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class Xp51HookImpl implements IHookBridge, ILoaderInfo {
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEntryPointName() {
|
||||
return "Xp51HookEntry";
|
||||
return this.getClass().getName();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
Reference in New Issue
Block a user