Reload when enabled

This commit is contained in:
M66B 2015-11-04 23:45:47 +01:00
parent 5f705da814
commit ac141afe5d
1 changed files with 7 additions and 5 deletions

View File

@ -425,11 +425,13 @@ public class SinkholeService extends VpnService {
} }
public static void reload(String network, Context context) { public static void reload(String network, Context context) {
if (network == null || ("wifi".equals(network) ? !Util.isMetered(context) : Util.isMetered(context))) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Intent intent = new Intent(context, SinkholeService.class); if (prefs.getBoolean("enabled", false))
intent.putExtra(EXTRA_COMMAND, Command.reload); if (network == null || ("wifi".equals(network) ? !Util.isMetered(context) : Util.isMetered(context))) {
context.startService(intent); Intent intent = new Intent(context, SinkholeService.class);
} intent.putExtra(EXTRA_COMMAND, Command.reload);
context.startService(intent);
}
} }
public static void stop(Context context) { public static void stop(Context context) {