mirror of
https://github.com/schwabe/ics-openvpn.git
synced 2024-09-20 20:03:13 +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();
|
return shouldBeConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
enum connectState {
|
private enum connectState {
|
||||||
SHOULDBECONNECTED,
|
SHOULDBECONNECTED,
|
||||||
PENDINGDISCONNECT,
|
PENDINGDISCONNECT,
|
||||||
DISCONNECTED
|
DISCONNECTED
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Datapoint {
|
private static class Datapoint {
|
||||||
private Datapoint(long t, long d) {
|
private Datapoint(long t, long d) {
|
||||||
timestamp = t;
|
timestamp = t;
|
||||||
data = d;
|
data = d;
|
||||||
@ -81,7 +81,7 @@ public class DeviceStateReceiver extends BroadcastReceiver implements ByteCountL
|
|||||||
long data;
|
long data;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedList<Datapoint> trafficdata = new LinkedList<DeviceStateReceiver.Datapoint>();
|
private LinkedList<Datapoint> trafficdata = new LinkedList<>();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -349,6 +349,10 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
|
|||||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
mDeviceStateReceiver = new DeviceStateReceiver(magnagement);
|
mDeviceStateReceiver = new DeviceStateReceiver(magnagement);
|
||||||
|
|
||||||
|
// Fetch initial network state
|
||||||
|
mDeviceStateReceiver.networkStateChange(this);
|
||||||
|
|
||||||
registerReceiver(mDeviceStateReceiver, filter);
|
registerReceiver(mDeviceStateReceiver, filter);
|
||||||
VpnStatus.addByteCountListener(mDeviceStateReceiver);
|
VpnStatus.addByteCountListener(mDeviceStateReceiver);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user