Commit bb2467d2 authored by Wang Han's avatar Wang Han Committed by topjohnwu

Handle Google API Connection Problems

parent 05c063b6
......@@ -221,6 +221,16 @@ public class StatusFragment extends Fragment implements CallbackHandler.EventLis
int image, color;
safetyNetProgress.setVisibility(View.GONE);
switch (SNCheckResult) {
case -3:
color = colorNeutral;
image = R.drawable.ic_help;
safetyNetStatusText.setText(R.string.safetyNet_connection_suspended);
break;
case -2:
color = colorNeutral;
image = R.drawable.ic_help;
safetyNetStatusText.setText(R.string.safetyNet_connection_failed);
break;
case -1:
color = colorNeutral;
image = R.drawable.ic_help;
......
......@@ -32,6 +32,7 @@ public abstract class SafetyNetHelper
@Override
public void onConnectionFailed(@NonNull ConnectionResult result) {
Logger.dev("SN: Google API fail");
handleResults(-2);
}
@Override
......@@ -43,6 +44,7 @@ public abstract class SafetyNetHelper
@Override
public void onConnectionSuspended(int i) {
Logger.dev("SN: Google API Suspended");
handleResults(-3);
}
public void requestTest() {
......
......@@ -26,6 +26,8 @@
<string name="not_rooted">Not rooted</string>
<string name="proper_root">Properly rooted</string>
<string name="checking_safetyNet_status">Checking SafetyNet status…</string>
<string name="safetyNet_connection_failed">Cannot connect to Google API</string>
<string name="safetyNet_connection_suspended">Connection to Google API was suspended</string>
<string name="safetyNet_error">Cannot check SafetyNet, no Internet?</string>
<string name="safetyNet_fail">SafetyNet Failed: CTS profile mismatch</string>
<string name="safetyNet_pass">SafetyNet Passed</string>
......
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