mirror of https://github.com/M66B/NetGuard.git
Bark five times an hour to Samsung
This commit is contained in:
parent
411b72000d
commit
d59a25833c
|
@ -240,7 +240,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
screen.findPreference("pcap_file_size").setTitle(getString(R.string.setting_pcap_file_size, prefs.getString("pcap_file_size", "2")));
|
||||
|
||||
// Watchdog
|
||||
screen.findPreference("watchdog").setTitle(getString(R.string.setting_watchdog, prefs.getString("watchdog", "0")));
|
||||
screen.findPreference("watchdog").setTitle(getString(R.string.setting_watchdog, prefs.getString("watchdog", Util.isSamsung() ? "12" : "0")));
|
||||
|
||||
// Handle stats
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
|
@ -701,7 +701,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
|||
ServiceSinkhole.setPcap(true, this);
|
||||
|
||||
} else if ("watchdog".equals(name)) {
|
||||
getPreferenceScreen().findPreference(name).setTitle(getString(R.string.setting_watchdog, prefs.getString(name, "0")));
|
||||
getPreferenceScreen().findPreference(name).setTitle(getString(R.string.setting_watchdog, prefs.getString(name, Util.isSamsung() ? "12" : "0")));
|
||||
ServiceSinkhole.reload("changed " + name, this);
|
||||
|
||||
} else if ("show_stats".equals(name))
|
||||
|
|
|
@ -315,7 +315,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|||
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||
am.cancel(pi);
|
||||
|
||||
int watchdog = Integer.parseInt(prefs.getString("watchdog", "0"));
|
||||
int watchdog = Integer.parseInt(prefs.getString("watchdog", Util.isSamsung() ? "12" : "0"));
|
||||
if (watchdog > 0) {
|
||||
Log.i(TAG, "Watchdog " + watchdog + " minutes");
|
||||
am.setInexactRepeating(AlarmManager.RTC, SystemClock.elapsedRealtime() + watchdog * 60 * 1000, watchdog * 60 * 1000, pi);
|
||||
|
|
|
@ -693,6 +693,10 @@ public class Util {
|
|||
return (cm.getRestrictBackgroundStatus() == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED);
|
||||
}
|
||||
|
||||
public static boolean isSamsung() {
|
||||
return "samsung".equals(Build.MANUFACTURER);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||
public static String getSubscriptionInfo(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1)
|
||||
|
|
Loading…
Reference in New Issue