Commit b75018b0 authored by topjohnwu's avatar topjohnwu

Fix SN check errors on some devices

parent 41499d4b
...@@ -43,14 +43,14 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> { ...@@ -43,14 +43,14 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> {
conn.disconnect(); conn.disconnect();
} }
private void dyload() throws ReflectiveOperationException { private void dyload() throws Exception {
loader = new DexClassLoader(dexPath.getPath(), dexPath.getParent(), loader = new DexClassLoader(dexPath.getPath(), dexPath.getParent(),
null, ClassLoader.getSystemClassLoader()); null, ClassLoader.getSystemClassLoader());
helperClazz = loader.loadClass(Const.SNET_PKG + ".SafetyNetHelper"); helperClazz = loader.loadClass(Const.SNET_PKG + ".SafetyNetHelper");
callbackClazz = loader.loadClass(Const.SNET_PKG + ".SafetyNetCallback"); callbackClazz = loader.loadClass(Const.SNET_PKG + ".SafetyNetCallback");
int snet_ver = (int) helperClazz.getMethod("getVersion").invoke(null); int snet_ver = (int) helperClazz.getMethod("getVersion").invoke(null);
if (snet_ver != Const.SNET_VER) { if (snet_ver != Const.SNET_VER) {
throw new ReflectiveOperationException(); throw new Exception();
} }
} }
...@@ -59,7 +59,7 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> { ...@@ -59,7 +59,7 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> {
try { try {
try { try {
dyload(); dyload();
} catch (ReflectiveOperationException e) { } catch (Exception e) {
// If dynamic load failed, try re-downloading and reload // If dynamic load failed, try re-downloading and reload
dlSnet(); dlSnet();
dyload(); dyload();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment