|
|
|
@ -391,9 +391,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
watchdogIntent.setAction(ACTION_WATCHDOG);
|
|
|
|
|
PendingIntent pi;
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
|
|
|
pi = PendingIntent.getForegroundService(ServiceSinkhole.this, 1, watchdogIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
pi = PendingIntent.getForegroundService(ServiceSinkhole.this, 1, watchdogIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
else
|
|
|
|
|
pi = PendingIntent.getService(ServiceSinkhole.this, 1, watchdogIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
pi = PendingIntent.getService(ServiceSinkhole.this, 1, watchdogIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
|
|
|
|
am.cancel(pi);
|
|
|
|
@ -1102,7 +1102,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
// Show notification
|
|
|
|
|
Intent main = new Intent(ServiceSinkhole.this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(ServiceSinkhole.this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(ServiceSinkhole.this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
|
|
|
@ -1446,7 +1446,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
// Build configure intent
|
|
|
|
|
Intent configure = new Intent(this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, configure, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, configure, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
builder.setConfigureIntent(pi);
|
|
|
|
|
|
|
|
|
|
return builder;
|
|
|
|
@ -2011,7 +2011,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
|
|
|
|
Intent i = new Intent(ACTION_SCREEN_OFF_DELAYED);
|
|
|
|
|
i.setPackage(context.getPackageName());
|
|
|
|
|
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getBroadcast(context, 0, i, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
am.cancel(pi);
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
@ -2312,7 +2312,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
main.putExtra(ActivityMain.EXTRA_REFRESH, true);
|
|
|
|
|
main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(uid));
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, uid, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, uid, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
|
|
|
@ -2347,7 +2347,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
riWifi.putExtra(ServiceSinkhole.EXTRA_PACKAGE, packages[0]);
|
|
|
|
|
riWifi.putExtra(ServiceSinkhole.EXTRA_BLOCKED, !wifi);
|
|
|
|
|
|
|
|
|
|
PendingIntent piWifi = PendingIntent.getService(this, uid, riWifi, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent piWifi = PendingIntent.getService(this, uid, riWifi, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
NotificationCompat.Action wAction = new NotificationCompat.Action.Builder(
|
|
|
|
|
wifi ? R.drawable.wifi_on : R.drawable.wifi_off,
|
|
|
|
|
getString(wifi ? R.string.title_allow_wifi : R.string.title_block_wifi),
|
|
|
|
@ -2362,7 +2362,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
riOther.putExtra(ServiceSinkhole.EXTRA_UID, uid);
|
|
|
|
|
riOther.putExtra(ServiceSinkhole.EXTRA_PACKAGE, packages[0]);
|
|
|
|
|
riOther.putExtra(ServiceSinkhole.EXTRA_BLOCKED, !other);
|
|
|
|
|
PendingIntent piOther = PendingIntent.getService(this, uid + 10000, riOther, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent piOther = PendingIntent.getService(this, uid + 10000, riOther, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
NotificationCompat.Action oAction = new NotificationCompat.Action.Builder(
|
|
|
|
|
other ? R.drawable.other_on : R.drawable.other_off,
|
|
|
|
|
getString(other ? R.string.title_allow_other : R.string.title_block_other),
|
|
|
|
@ -2477,9 +2477,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
alarmIntent.setAction(ACTION_HOUSE_HOLDING);
|
|
|
|
|
PendingIntent pi;
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
|
|
|
|
pi = PendingIntent.getForegroundService(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
pi = PendingIntent.getForegroundService(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
else
|
|
|
|
|
pi = PendingIntent.getService(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
pi = PendingIntent.getService(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
|
|
|
|
am.setInexactRepeating(AlarmManager.RTC, SystemClock.elapsedRealtime() + 60 * 1000, AlarmManager.INTERVAL_HALF_DAY, pi);
|
|
|
|
@ -2796,7 +2796,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private Notification getEnforcingNotification(int allowed, int blocked, int hosts) {
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
|
|
|
@ -2860,7 +2860,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private Notification getWaitingNotification() {
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
|
|
|
@ -2887,7 +2887,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private void showDisabledNotification() {
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorOff, tv, true);
|
|
|
|
@ -2912,7 +2912,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private void showLockdownNotification() {
|
|
|
|
|
Intent intent = new Intent(Settings.ACTION_VPN_SETTINGS);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, NOTIFY_LOCKDOWN, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, NOTIFY_LOCKDOWN, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorOff, tv, true);
|
|
|
|
@ -2943,7 +2943,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
private void showAutoStartNotification() {
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
main.putExtra(ActivityMain.EXTRA_APPROVE, true);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, NOTIFY_AUTOSTART, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, NOTIFY_AUTOSTART, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorOff, tv, true);
|
|
|
|
@ -2968,7 +2968,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private void showErrorNotification(String message) {
|
|
|
|
|
Intent main = new Intent(this, ActivityMain.class);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorOff, tv, true);
|
|
|
|
@ -2997,7 +2997,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
Intent main = new Intent(ServiceSinkhole.this, ActivityMain.class);
|
|
|
|
|
main.putExtra(ActivityMain.EXTRA_SEARCH, Integer.toString(uid));
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(ServiceSinkhole.this, uid + 10000, main, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(ServiceSinkhole.this, uid + 10000, main, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorOn, tv, true);
|
|
|
|
@ -3079,7 +3079,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
|
|
|
|
|
|
|
|
|
private void showUpdateNotification(String name, String url) {
|
|
|
|
|
Intent download = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, download, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
PendingIntent pi = PendingIntent.getActivity(this, 0, download, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
|
|
|
|
|
|
|
|
|
|
TypedValue tv = new TypedValue();
|
|
|
|
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
|
|
|
|