summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java25
1 files changed, 9 insertions, 16 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index 1670c0be..6be8db25 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -46,6 +46,7 @@ import de.blinkt.openvpn.core.VpnStatus.StateListener;
import de.blinkt.openvpn.core.connection.Connection;
import de.blinkt.openvpn.core.connection.Obfs4Connection;
import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.eip.EipStatus;
import se.leap.bitmaskclient.eip.VpnNotificationManager;
import se.leap.bitmaskclient.firewall.FirewallManager;
import se.leap.bitmaskclient.pluggableTransports.Shapeshifter;
@@ -92,11 +93,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
private Shapeshifter shapeshifter;
private FirewallManager firewallManager;
- private static final int PRIORITY_MIN = -2;
- private static final int PRIORITY_DEFAULT = 0;
- private static final int PRIORITY_MAX = 2;
-
-
private final IBinder mBinder = new IOpenVPNServiceInternal.Stub() {
@Override
@@ -118,6 +114,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
public boolean isVpnRunning() throws RemoteException {
return OpenVPNService.this.isVpnRunning();
}
+
+ @Override
+ public void startWithForegroundNotification() throws RemoteException {
+ OpenVPNService.this.startWithForegroundNotification();
+ }
};
// From: http://stackoverflow.com/questions/3758606/how-to-convert-byte-size-into-human-readable-format-in-java
@@ -280,18 +281,11 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
}
+ @Override
public void startWithForegroundNotification() {
// Always show notification here to avoid problem with startForeground timeout
notificationManager.createOpenVpnNotificationChannel();
- notificationManager.buildOpenVpnNotification(
- mProfile != null ? mProfile.mName : "",
- mProfile != null && mProfile.mUsePluggableTransports,
- VpnStatus.getLastCleanLogMessage(this),
- VpnStatus.getLastCleanLogMessage(this),
- ConnectionStatus.LEVEL_START,
- 0,
- NOTIFICATION_CHANNEL_NEWSTATUS_ID,
- this::onNotificationBuild);
+ notificationManager.buildForegroundServiceNotification(EipStatus.getInstance().getLevel(), this::onNotificationBuild);
}
@Override
@@ -539,7 +533,6 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
public void onCreate() {
super.onCreate();
notificationManager = new VpnNotificationManager(this);
- startWithForegroundNotification();
firewallManager = new FirewallManager(this, true);
}
@@ -558,7 +551,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
VpnStatus.removeStateListener(this);
VpnStatus.flushLog();
firewallManager.onDestroy();
- notificationManager.cancelAllNotifications();
+ notificationManager.deleteOpenvpnNotificationChannel();
}
private String getTunConfigString() {