OSDN Git Service

Fix issues with noticing that a VPN interface is gone.
authorSreeram Ramachandran <sreeram@google.com>
Sat, 26 Jul 2014 01:48:12 +0000 (18:48 -0700)
committerSreeram Ramachandran <sreeram@google.com>
Sun, 27 Jul 2014 15:27:03 +0000 (15:27 +0000)
commit030a6b923400eada46220343b5e9681cd0a191b7
tree91e671a466bef14e7d603b4c84b7bfb919ee5fc8
parentd90cd59507a6b4e8d7bc9964c7c57dd1b30a1c82
Fix issues with noticing that a VPN interface is gone.

The root cause of both bugs linked below is the same. In establish(), we call
agentConnect(), which sets the state to CONNECTED. But right before returning
from establish(), we set the state to AUTHENTICATING, which is a "CONNECTING"
state. Later, when the interface is gone (either because the VpnService closed
it, or because the process got killed), agentDisconnect() doesn't do anything
because "isConnected()" is false.

We could fix it by changing that to "isConnectedOrConnecting()", but I think a
superior fix is to get rid of the bogus AUTHENTICATING state. It was added in
http://ag/214042 two years ago, with a TODO saying to eventually make sure it
becomes CONNECTED, but that never seems to have been followed up on.

I don't see any use for this AUTHENTICATING state. Although I haven't tested it,
code inspection suggests that the legacy VPN doesn't seem to care, and it sets
its own states in execute() and such.

Bug: 16495146
Bug: 16495887
Change-Id: Ie2a40aa1a8a173665d8b7aa9fab5ae6e800ba5fb
services/core/java/com/android/server/connectivity/Vpn.java