Merge branch 'master' into android-o

This commit is contained in:
M66B 2017-08-01 09:38:46 +02:00
commit 86e53fcd86
1 changed files with 16 additions and 4 deletions

View File

@ -444,8 +444,10 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
showErrorNotification(ex.toString());
// Disable firewall
prefs.edit().putBoolean("enabled", false).apply();
WidgetMain.updateWidgets(ServiceSinkhole.this);
if (!(ex instanceof StartFailedException)) {
prefs.edit().putBoolean("enabled", false).apply();
WidgetMain.updateWidgets(ServiceSinkhole.this);
}
}
} else
showErrorNotification(ex.toString());
@ -476,7 +478,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
last_builder = getBuilder(listAllowed, listRule);
vpn = startVPN(last_builder);
if (vpn == null)
throw new IllegalStateException(getString((R.string.msg_start_failed)));
throw new StartFailedException(getString((R.string.msg_start_failed)));
startNative(vpn, listAllowed, listRule);
@ -571,7 +573,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
}
if (vpn == null)
throw new IllegalStateException(getString((R.string.msg_start_failed)));
throw new StartFailedException(getString((R.string.msg_start_failed)));
startNative(vpn, listAllowed, listRule);
@ -667,6 +669,16 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex));
}
}
private class StartFailedException extends IllegalStateException {
public StartFailedException() {
super();
}
public StartFailedException(String msg) {
super(msg);
}
}
}
private final class LogHandler extends Handler {