diff --git a/app/src/main/java/toolkit/coderstory/CorePatchForR.java b/app/src/main/java/toolkit/coderstory/CorePatchForR.java index b0b7035..e206703 100644 --- a/app/src/main/java/toolkit/coderstory/CorePatchForR.java +++ b/app/src/main/java/toolkit/coderstory/CorePatchForR.java @@ -13,6 +13,7 @@ import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Member; import java.lang.reflect.Method; import java.security.cert.Certificate; import java.security.cert.X509Certificate; @@ -238,6 +239,19 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } } }); + + var utilClass = findClass("com.android.server.pm.PackageManagerServiceUtils", loadPackageParam.classLoader); + if (utilClass != null) { + for (var m : utilClass.getDeclaredMethods()) { + if ("verifySignatures".equals(m.getName())) { + try { + XposedBridge.class.getDeclaredMethod("deoptimizeMethod", Member.class).invoke(null, m); + } catch (Throwable e) { + Log.e("CorePatch", "deoptimizing failed", e); + } + } + } + } } Class getSigningDetails(ClassLoader classLoader) { diff --git a/app/src/main/java/toolkit/coderstory/CorePatchForT.java b/app/src/main/java/toolkit/coderstory/CorePatchForT.java index 9e31333..b0a5539 100644 --- a/app/src/main/java/toolkit/coderstory/CorePatchForT.java +++ b/app/src/main/java/toolkit/coderstory/CorePatchForT.java @@ -3,7 +3,6 @@ import android.util.Log; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Member; import de.robv.android.xposed.XC_MethodHook; import de.robv.android.xposed.XposedBridge; @@ -21,7 +20,6 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) "android.content.pm.PackageInfoLite", new ReturnConstant(prefs, "downgrade", null)); - var utilClass = findClass("com.android.server.pm.PackageManagerServiceUtils", loadPackageParam.classLoader); Class signingDetails = getSigningDetails(loadPackageParam.classLoader); //New package has a different signature //处理覆盖安装但签名不一致 @@ -37,17 +35,6 @@ protected void beforeHookedMethod(MethodHookParam param) { } }); - if (utilClass != null) { - for (var m : utilClass.getDeclaredMethods()) { - if ("verifySignatures".equals(m.getName())) { - try { - XposedBridge.class.getDeclaredMethod("deoptimizeMethod", Member.class).invoke(null, m); - } catch (Throwable e) { - Log.e("CorePatch", "deoptimizing failed", e); - } - } - } - } // Package " + packageName + " signatures do not match previously installed version; ignoring!" // public boolean checkCapability(String sha256String, @CertCapabilities int flags) { // public boolean checkCapability(SigningDetails oldDetails, @CertCapabilities int flags)