diff --git a/assets/VERSION b/assets/VERSION index 81b5c5d0..e522732c 100644 --- a/assets/VERSION +++ b/assets/VERSION @@ -1 +1 @@ -37 +38 diff --git a/src/de/robv/android/xposed/XposedHelpers.java b/src/de/robv/android/xposed/XposedHelpers.java index 299269da..8e0e6b3e 100644 --- a/src/de/robv/android/xposed/XposedHelpers.java +++ b/src/de/robv/android/xposed/XposedHelpers.java @@ -8,6 +8,7 @@ import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -249,9 +250,14 @@ public static Method findMethodBestMatch(Class clazz, String methodName, Clas } catch (NoSuchMethodError ignored) {} Method bestMatch = null; - for (int i = 0; i < 2; i++) { - Method[] methods = (i == 0) ? clazz.getDeclaredMethods() : clazz.getMethods(); - for (Method method : methods) { + Class clz = clazz; + boolean considerPrivateMethods = true; + do { + for (Method method : clz.getDeclaredMethods()) { + // don't consider private methods of superclasses + if (!considerPrivateMethods && Modifier.isPrivate(method.getModifiers())) + continue; + // compare name and parameters if (method.getName().equals(methodName) && ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { // get accessible version of method @@ -263,7 +269,8 @@ public static Method findMethodBestMatch(Class clazz, String methodName, Clas } } } - } + considerPrivateMethods = false; + } while ((clz = clz.getSuperclass()) != null); if (bestMatch != null) { bestMatch.setAccessible(true);