mirror of
https://github.com/schwabe/ics-openvpn.git
synced 2024-09-20 12:02:28 +02:00
Fetch initial network state for seriously broken devices.
This commit is contained in:
parent
39f9fffbc6
commit
c6d7fcd124
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user