我试图使用Xposed:
在NotificationManagerService中挂钩这个方法void enqueueNotificationInternal(final String pkg, final String opPkg, final int callingUid,
final int callingPid, final String tag, final int id, final Notification notification,
int[] idOut, int incomingUserId)
为此我正在使用这个钩子:
XposedHelpers.findAndHookMethod("com.android.server.notification.NotificationManagerService", loadPackageParam.classLoader,
"enqueueNotificationInternal", String.class, String.class, Integer.class, Integer.class, String.class,
Integer.class, Notification.class, Integer.class, Integer.class, new XC_MethodHook(){
//More code...
});
然而,这在Xposed日志中给出了一个错误,即无法找到该方法。这可能是因为int[] idOut
,因为我不确定该参数的“类型”类是什么。显然不是Integer.class
,或者它是否存在其他错误?
答案 0 :(得分:3)
对我有用的是声明一个空的数组变量并获得它的类:
int[] data = new int[0];
XposedHelpers.findAndHookMethod("com.class",
loadPackageParam.classLoader,
"methodName",
String.class,
data.getClass(),
new XC_MethodHook(){
// code
});
另一个可能的答案:
XposedHelpers.findAndHookMethod("com.class",
loadPackageParam.classLoader,
"methodName",
String.class,
int[].class,
new XC_MethodHook(){
// code
});
答案 1 :(得分:1)
这有效:
XposedHelpers.findAndHookMethod("com.android.server.notification.NotificationManagerService", loadPackageParam.classLoader, "enqueueNotificationInternal", String.class, String.class, int.class, int.class, String.class, int.class, Notification.class, new int[0].class, int.class, new XC_MethodHook(){
//More code...
});
答案 2 :(得分:0)
您可以简单地使用:
int[].class
其他答案有效,但方法不对。