VpnConnector: Fix NPE if service isn't bound when activity exits

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
DeviceStateReceiver: Refactor code and enable pause-on-screen-off

Pause on screen off or network down; resume on screen on or network up.
Reconnect if the network type changes rather than letting the connection
time out.  These are global settings.

Also, this converts DeviceStateReceiver.java to UNIX LF format.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
KeepAlive: Dynamically register/unregister the broadcast receiver

This makes it easier to pass in parameters and perform callbacks.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
KeepAlive: Convert class methods/vars to instance methods/vars

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
KeepAlive: Pass in operating parameters from OpenVpnService

Also, don't rely on broadcasts to ascertain the VPN state.  OpenVpnService
will call start()/stop() as needed.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
KeepAlive: Configure using parameters furnished by the gateway

Send keepalive requests to the gateway-provided DNS server, and compute
the interval based on 40% of the gateway-provided idle timeout.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
OpenConnectManagementThread: Don't cache last form digest for NEWGROUP

If we're selecting a non-default group, we will see the same form twice
in a row.  This is normal, and it shouldn't cause the "repeated prompt
detection" logic to disable batch mode.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
strings: Tweak "pause" text to fit on smaller screens

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>