summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java6
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java4
2 files changed, 7 insertions, 3 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
index 4260ea8f..c7760a0e 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/DeviceStateReceiver.java
@@ -65,13 +65,13 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
return shouldBeConnected();
}
- enum connectState {
+ private enum connectState {
SHOULDBECONNECTED,
PENDINGDISCONNECT,
DISCONNECTED
}
- static class Datapoint {
+ private static class Datapoint {
private Datapoint(long t, long d) {
timestamp = t;
data = d;
@@ -81,7 +81,7 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
long data;
}
- LinkedList<Datapoint> trafficdata = new LinkedList<DeviceStateReceiver.Datapoint>();
+ private LinkedList<Datapoint> trafficdata = new LinkedList<>();
@Override
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index f5778d1a..3237f256 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -349,6 +349,10 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(Intent.ACTION_SCREEN_ON);
mDeviceStateReceiver = new DeviceStateReceiver(magnagement);
+
+ // Fetch initial network state
+ mDeviceStateReceiver.networkStateChange(this);
+
registerReceiver(mDeviceStateReceiver, filter);
VpnStatus.addByteCountListener(mDeviceStateReceiver);