mirror of https://github.com/M66B/NetGuard.git
Revert "Quick manage speed graph notification"
This reverts commit ffca21cba1
.
Refs #442
This commit is contained in:
parent
d052c13bde
commit
711b86920b
|
@ -140,10 +140,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
private volatile LogHandler logHandler;
|
private volatile LogHandler logHandler;
|
||||||
private volatile StatsHandler statsHandler;
|
private volatile StatsHandler statsHandler;
|
||||||
|
|
||||||
private static final int SERVICE_HOUSEHOLDING = 1;
|
|
||||||
private static final int SERVICE_GRAPH_ON = 2;
|
|
||||||
private static final int SERVICE_GRAPH_OFF = 3;
|
|
||||||
|
|
||||||
private static final int NOTIFY_ENFORCING = 1;
|
private static final int NOTIFY_ENFORCING = 1;
|
||||||
private static final int NOTIFY_WAITING = 2;
|
private static final int NOTIFY_WAITING = 2;
|
||||||
private static final int NOTIFY_DISABLED = 3;
|
private static final int NOTIFY_DISABLED = 3;
|
||||||
|
@ -155,7 +151,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
private static final int NOTIFY_UPDATE = 9;
|
private static final int NOTIFY_UPDATE = 9;
|
||||||
|
|
||||||
public static final String EXTRA_COMMAND = "Command";
|
public static final String EXTRA_COMMAND = "Command";
|
||||||
public static final String EXTRA_OPTION = "Option";
|
|
||||||
private static final String EXTRA_REASON = "Reason";
|
private static final String EXTRA_REASON = "Reason";
|
||||||
public static final String EXTRA_NETWORK = "Network";
|
public static final String EXTRA_NETWORK = "Network";
|
||||||
public static final String EXTRA_UID = "UID";
|
public static final String EXTRA_UID = "UID";
|
||||||
|
@ -275,10 +270,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
|
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ServiceSinkhole.this);
|
||||||
|
|
||||||
Command cmd = (Command) intent.getSerializableExtra(EXTRA_COMMAND);
|
Command cmd = (Command) intent.getSerializableExtra(EXTRA_COMMAND);
|
||||||
String option = intent.getStringExtra(EXTRA_OPTION);
|
|
||||||
String reason = intent.getStringExtra(EXTRA_REASON);
|
String reason = intent.getStringExtra(EXTRA_REASON);
|
||||||
Log.i(TAG, "Executing intent=" + intent +
|
Log.i(TAG, "Executing intent=" + intent + " command=" + cmd + " reason=" + reason +
|
||||||
" command=" + cmd + " option=" + option + " reason=" + reason +
|
|
||||||
" vpn=" + (vpn != null) + " user=" + (Process.myUid() / 100000));
|
" vpn=" + (vpn != null) + " user=" + (Process.myUid() / 100000));
|
||||||
|
|
||||||
// Check if prepared
|
// Check if prepared
|
||||||
|
@ -342,10 +335,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case stats:
|
case stats:
|
||||||
if ("start".equals(option))
|
|
||||||
prefs.edit().putBoolean("show_stats", true).apply();
|
|
||||||
else if ("stop".equals(option))
|
|
||||||
prefs.edit().putBoolean("show_stats", false).apply();
|
|
||||||
statsHandler.sendEmptyMessage(MSG_STATS_STOP);
|
statsHandler.sendEmptyMessage(MSG_STATS_STOP);
|
||||||
statsHandler.sendEmptyMessage(MSG_STATS_START);
|
statsHandler.sendEmptyMessage(MSG_STATS_START);
|
||||||
break;
|
break;
|
||||||
|
@ -901,11 +890,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
Intent main = new Intent(ServiceSinkhole.this, ActivityMain.class);
|
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);
|
||||||
|
|
||||||
Intent riGraph = new Intent(ServiceSinkhole.this, ServiceSinkhole.class);
|
|
||||||
riGraph.putExtra(ServiceSinkhole.EXTRA_COMMAND, ServiceSinkhole.Command.stats);
|
|
||||||
riGraph.putExtra(ServiceSinkhole.EXTRA_OPTION, "stop");
|
|
||||||
PendingIntent piGraph = PendingIntent.getService(ServiceSinkhole.this, SERVICE_GRAPH_OFF, riGraph, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
||||||
|
|
||||||
TypedValue tv = new TypedValue();
|
TypedValue tv = new TypedValue();
|
||||||
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
getTheme().resolveAttribute(R.attr.colorPrimary, tv, true);
|
||||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(ServiceSinkhole.this)
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(ServiceSinkhole.this)
|
||||||
|
@ -914,9 +898,8 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
.setContent(remoteViews)
|
.setContent(remoteViews)
|
||||||
.setContentIntent(pi)
|
.setContentIntent(pi)
|
||||||
.setColor(tv.data)
|
.setColor(tv.data)
|
||||||
.setOngoing(false)
|
.setOngoing(true)
|
||||||
.setAutoCancel(false)
|
.setAutoCancel(false);
|
||||||
.setDeleteIntent(piGraph);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
builder.setCategory(Notification.CATEGORY_STATUS)
|
builder.setCategory(Notification.CATEGORY_STATUS)
|
||||||
|
@ -1769,7 +1752,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
// Setup house holding
|
// Setup house holding
|
||||||
Intent alarmIntent = new Intent(this, ServiceSinkhole.class);
|
Intent alarmIntent = new Intent(this, ServiceSinkhole.class);
|
||||||
alarmIntent.setAction(ACTION_HOUSE_HOLDING);
|
alarmIntent.setAction(ACTION_HOUSE_HOLDING);
|
||||||
PendingIntent pi = PendingIntent.getService(this, SERVICE_HOUSEHOLDING, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
PendingIntent pi = PendingIntent.getService(this, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
am.setInexactRepeating(AlarmManager.RTC, SystemClock.elapsedRealtime() + 60 * 1000, AlarmManager.INTERVAL_HALF_DAY, pi);
|
am.setInexactRepeating(AlarmManager.RTC, SystemClock.elapsedRealtime() + 60 * 1000, AlarmManager.INTERVAL_HALF_DAY, pi);
|
||||||
|
@ -1962,15 +1945,6 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
|
||||||
.setPriority(Notification.PRIORITY_MIN);
|
.setPriority(Notification.PRIORITY_MIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (IAB.isPurchased(ActivityPro.SKU_SPEED, this)) {
|
|
||||||
Intent riGraph = new Intent(this, ServiceSinkhole.class);
|
|
||||||
riGraph.putExtra(ServiceSinkhole.EXTRA_COMMAND, ServiceSinkhole.Command.stats);
|
|
||||||
riGraph.putExtra(ServiceSinkhole.EXTRA_OPTION, "start");
|
|
||||||
PendingIntent piGraph = PendingIntent.getService(this, SERVICE_GRAPH_ON, riGraph, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
||||||
builder.addAction(R.drawable.ic_equalizer_white_24dp, getString(R.string.title_graph), piGraph);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowed > 0 || blocked > 0 || hosts > 0) {
|
if (allowed > 0 || blocked > 0 || hosts > 0) {
|
||||||
NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
|
NotificationCompat.BigTextStyle notification = new NotificationCompat.BigTextStyle(builder);
|
||||||
notification.bigText(getString(R.string.msg_started));
|
notification.bigText(getString(R.string.msg_started));
|
||||||
|
|
|
@ -208,7 +208,6 @@ Your internet traffic is not being sent to a remote VPN server.</string>
|
||||||
<string name="title_rate">Rate</string>
|
<string name="title_rate">Rate</string>
|
||||||
<string name="title_allow">Allow</string>
|
<string name="title_allow">Allow</string>
|
||||||
<string name="title_block">Block</string>
|
<string name="title_block">Block</string>
|
||||||
<string name="title_graph">Graph</string>
|
|
||||||
<string name="title_root">root</string>
|
<string name="title_root">root</string>
|
||||||
<string name="title_mediaserver">mediaserver</string>
|
<string name="title_mediaserver">mediaserver</string>
|
||||||
<string name="title_nobody">nobody</string>
|
<string name="title_nobody">nobody</string>
|
||||||
|
|
Loading…
Reference in New Issue