summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-02-23 01:14:28 +0100
committercyBerta <cyberta@riseup.net>2021-02-26 10:03:31 +0100
commitcf6e6f355cc71e43c69f20716a7aa6fd0d6990ce (patch)
treeb4eac73f148fa4a151de8d80e205465da9acabb9 /app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
parentf41e7345f823029221c355be39fbcba9269014d8 (diff)
some refactorings in VpnNotificationManager, start foreground service notification in onCreate already
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java16
1 files changed, 6 insertions, 10 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
index 77038492..0c46f8cd 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VoidVpnService.java
@@ -58,7 +58,7 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
super.onCreate();
eipStatus = EipStatus.getInstance();
eipStatus.addObserver(this);
- notificationManager = new VpnNotificationManager(this, this);
+ notificationManager = new VpnNotificationManager(this);
notificationManager.createVoidVpnNotificationChannel();
}
@@ -100,13 +100,12 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
}
private void stop() {
- notificationManager.stopNotifications(NOTIFICATION_CHANNEL_NEWSTATUS_ID);
- notificationManager.deleteNotificationChannel(NOTIFICATION_CHANNEL_NEWSTATUS_ID);
if (thread != null) {
thread.interrupt();
}
closeFd();
VpnStatus.updateStateString("NOPROCESS", "BLOCKING VPN STOPPED", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED);
+ stopForeground(true);
}
public static boolean isRunning() throws NullPointerException {
@@ -185,9 +184,11 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
notificationManager.buildVoidVpnNotification(
blockingMessage,
blockingMessage,
- eipStatus.getLevel());
+ eipStatus.getLevel(),
+ this
+ );
} else {
- notificationManager.stopNotifications(NOTIFICATION_CHANNEL_NEWSTATUS_ID);
+ stopForeground(true);
}
}
@@ -196,9 +197,4 @@ public class VoidVpnService extends VpnService implements Observer, VpnNotificat
startForeground(notificationId, notification);
}
- @Override
- public void onNotificationStop() {
- stopForeground(true);
- }
-
}