Refactoring

This commit is contained in:
M66B 2015-11-24 10:44:02 +01:00
parent 9010ac3dc3
commit 6565938101
1 changed files with 15 additions and 15 deletions

View File

@ -443,6 +443,21 @@ public class SinkholeService extends VpnService {
return START_STICKY;
}
@Override
public void onRevoke() {
Log.i(TAG, "Revoke");
// Disable firewall (will result in stop command)
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.edit().putBoolean("enabled", false).apply();
// Feedback
showDisabledNotification();
Widget.updateWidgets(this);
super.onRevoke();
}
@Override
public void onDestroy() {
Log.i(TAG, "Destroy");
@ -471,21 +486,6 @@ public class SinkholeService extends VpnService {
super.onDestroy();
}
@Override
public void onRevoke() {
Log.i(TAG, "Revoke");
// Disable firewall (will result in stop command)
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.edit().putBoolean("enabled", false).apply();
// Feedback
showDisabledNotification();
Widget.updateWidgets(this);
super.onRevoke();
}
private Notification getForegroundNotification(int allowed, int blocked) {
Intent main = new Intent(this, ActivityMain.class);
PendingIntent pi = PendingIntent.getActivity(this, 0, main, PendingIntent.FLAG_CANCEL_CURRENT);