Skip to content

Commit c80d5a4

Browse files
committed
Fix bug in Call Privacy
Signed-off-by: Dev4Mod <[email protected]>
1 parent c87d52d commit c80d5a4

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/CallPrivacy.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,23 +60,17 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
6060
case "uncallable":
6161
case "declined":
6262
var rejectCallMethod = ReflectionUtils.findMethodUsingFilter(clazzVoip, m -> m.getName().equals("rejectCall"));
63-
var obj = new Object[rejectCallMethod.getParameterCount()];
64-
obj[0] = callId;
65-
obj[1] = "declined".equals(rejectType) ? null : rejectType;
66-
if (obj.length > 2) {
67-
obj[2] = 0;
68-
}
69-
70-
ReflectionUtils.callMethod(rejectCallMethod, null, obj);
71-
param.setResult(true);
63+
var params = ReflectionUtils.initArray(rejectCallMethod.getParameterTypes());
64+
params[0] = callId;
65+
params[1] = "declined".equals(rejectType) ? null : rejectType;
66+
ReflectionUtils.callMethod(rejectCallMethod, null, params);
7267
break;
7368
case "ended":
7469
try {
7570
XposedHelpers.callStaticMethod(clazzVoip, "endCall", true);
7671
} catch (NoSuchMethodError e) {
7772
XposedHelpers.callStaticMethod(clazzVoip, "endCall", true, 0);
7873
}
79-
param.setResult(true);
8074
break;
8175
default:
8276
}

app/src/main/java/com/wmods/wppenhacer/xposed/utils/ReflectionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public static Object callMethod(Method method, Object instance, Object... args)
152152
}
153153
}
154154

155-
private static Object[] initArray(Class<?>[] parameterTypes) {
155+
public static Object[] initArray(Class<?>[] parameterTypes) {
156156
var args = new Object[parameterTypes.length];
157157
for (int i = 0; i < parameterTypes.length; i++) {
158158
args[i] = getDefaultValue(parameterTypes[i]);

0 commit comments

Comments
 (0)