(Object obj, String name, Object... argsTypesAndReturnType)
| 727 | } |
| 728 | |
| 729 | public static Object invokeVirtualOriginal(Object obj, String name, Object... argsTypesAndReturnType) |
| 730 | throws ReflectiveOperationException { |
| 731 | Class clazz = obj.getClass(); |
| 732 | int argc = argsTypesAndReturnType.length / 2; |
| 733 | Class[] argt = new Class[argc]; |
| 734 | Object[] argv = new Object[argc]; |
| 735 | Class returnType = null; |
| 736 | if (argc * 2 + 1 == argsTypesAndReturnType.length) { |
| 737 | returnType = (Class) argsTypesAndReturnType[argsTypesAndReturnType.length - 1]; |
| 738 | } |
| 739 | int i, ii; |
| 740 | Method[] m; |
| 741 | Method method = null; |
| 742 | Class[] _argt; |
| 743 | for (i = 0; i < argc; i++) { |
| 744 | argt[i] = (Class) argsTypesAndReturnType[argc + i]; |
| 745 | argv[i] = argsTypesAndReturnType[i]; |
| 746 | } |
| 747 | loop_main: |
| 748 | do { |
| 749 | m = clazz.getDeclaredMethods(); |
| 750 | loop: |
| 751 | for (i = 0; i < m.length; i++) { |
| 752 | if (m[i].getName().equals(name)) { |
| 753 | _argt = m[i].getParameterTypes(); |
| 754 | if (_argt.length == argt.length) { |
| 755 | for (ii = 0; ii < argt.length; ii++) { |
| 756 | if (!argt[ii].equals(_argt[ii])) { |
| 757 | continue loop; |
| 758 | } |
| 759 | } |
| 760 | if (returnType != null && !returnType.equals(m[i].getReturnType())) { |
| 761 | continue; |
| 762 | } |
| 763 | method = m[i]; |
| 764 | break loop_main; |
| 765 | } |
| 766 | } |
| 767 | } |
| 768 | } while (!Object.class.equals(clazz = clazz.getSuperclass())); |
| 769 | if (method == null) { |
| 770 | throw new NoSuchMethodException(name + " in " + obj.getClass().getName()); |
| 771 | } |
| 772 | method.setAccessible(true); |
| 773 | Object ret; |
| 774 | boolean needPatch = false; |
| 775 | try { |
| 776 | ret = XposedBridge.invokeOriginalMethod(method, obj, argv); |
| 777 | return ret; |
| 778 | } catch (IllegalStateException e) { |
| 779 | //For SandHook-EdXp: Method not hooked. |
| 780 | needPatch = true; |
| 781 | } catch (InvocationTargetException | NullPointerException e) { |
| 782 | //For TaiChi |
| 783 | Throwable cause; |
| 784 | if (e instanceof InvocationTargetException) { |
| 785 | cause = e.getCause(); |
| 786 | } else { |
nothing calls this directly
no test coverage detected