Several small snet fixes
This commit is contained in:
parent
48f9b27381
commit
e986332bf2
@ -96,8 +96,6 @@ public class MagiskFragment extends Fragment
|
||||
@OnClick(R.id.safetyNet_title)
|
||||
void safetyNet() {
|
||||
Runnable task = () -> {
|
||||
mm.snet_version = CheckSafetyNet.SNET_VER;
|
||||
mm.prefs.edit().putInt("snet_version", CheckSafetyNet.SNET_VER).apply();
|
||||
safetyNetProgress.setVisibility(View.VISIBLE);
|
||||
safetyNetRefreshIcon.setVisibility(View.GONE);
|
||||
safetyNetStatusText.setText(R.string.checking_safetyNet_status);
|
||||
|
@ -3,6 +3,7 @@ package com.topjohnwu.magisk.asyncs;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
import com.topjohnwu.jarsigner.ByteArrayStream;
|
||||
import com.topjohnwu.magisk.MagiskManager;
|
||||
import com.topjohnwu.magisk.utils.WebService;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
@ -32,9 +33,12 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> {
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
if (getMagiskManager().snet_version < CheckSafetyNet.SNET_VER) {
|
||||
MagiskManager mm = getMagiskManager();
|
||||
if (mm.snet_version != CheckSafetyNet.SNET_VER) {
|
||||
getShell().sh("rm -rf " + dexPath.getParent());
|
||||
}
|
||||
mm.snet_version = CheckSafetyNet.SNET_VER;
|
||||
mm.prefs.edit().putInt("snet_version", CheckSafetyNet.SNET_VER).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -71,7 +75,7 @@ public class CheckSafetyNet extends ParallelTask<Void, Void, Exception> {
|
||||
getMagiskManager().safetyNetDone.publish(false, args[0]);
|
||||
return null;
|
||||
}));
|
||||
helperClazz.getMethod("requestTest").invoke(helper);
|
||||
helperClazz.getMethod("attest").invoke(helper);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
getMagiskManager().safetyNetDone.publish(false, -1);
|
||||
|
@ -43,7 +43,7 @@ public class SafetyNetHelper
|
||||
}
|
||||
|
||||
// Entry point to start test
|
||||
public void requestTest() {
|
||||
public void attest() {
|
||||
// Connect Google Service
|
||||
GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mActivity);
|
||||
try {
|
||||
@ -92,7 +92,7 @@ public class SafetyNetHelper
|
||||
responseCode |= decoded.getBoolean("ctsProfileMatch") ? CTS_PASS : 0;
|
||||
responseCode |= decoded.getBoolean("basicIntegrity") ? BASIC_PASS : 0;
|
||||
} catch (JSONException e) {
|
||||
responseCode |= RESPONSE_ERR;
|
||||
cb.onResponse(RESPONSE_ERR);
|
||||
return;
|
||||
}
|
||||
// Disconnect
|
||||
|
Loading…
Reference in New Issue
Block a user