Loading packages/VpnServices/src/com/android/server/vpn/VpnService.java +3 −21 Original line number Diff line number Diff line Loading @@ -56,10 +56,6 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { private static final String REMOTE_IP = "net.ipremote"; private static final String DNS_DOMAIN_SUFFICES = "net.dns.search"; private static final int CHALLENGE_ERROR_CODE = 5; private static final int REMOTE_HUNG_UP_ERROR_CODE = 7; private static final int AUTH_ERROR_CODE = 51; private final String TAG = VpnService.class.getSimpleName(); // FIXME: profile is only needed in connecting phase, so we can just save Loading Loading @@ -202,7 +198,7 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { private void waitUntilConnectedOrTimedout() throws IOException { sleep(2000); // 2 seconds for (int i = 0; i < 60; i++) { for (int i = 0; i < 80; i++) { if (mState != VpnState.CONNECTING) { break; } else if (VPN_IS_UP.equals( Loading Loading @@ -464,22 +460,8 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { synchronized int getSocketError() { for (DaemonProxy s : mDaemonList) { switch (getResultFromSocket(s)) { case 0: continue; case AUTH_ERROR_CODE: return VpnManager.VPN_ERROR_AUTH; case CHALLENGE_ERROR_CODE: return VpnManager.VPN_ERROR_CHALLENGE; case REMOTE_HUNG_UP_ERROR_CODE: return VpnManager.VPN_ERROR_REMOTE_HUNG_UP; default: return VpnManager.VPN_ERROR_CONNECTION_FAILED; } int errCode = getResultFromSocket(s); if (errCode != 0) return errCode; } return 0; } Loading packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ public class VpnServiceBinder extends Service { void removeStates() { try { new File(STATES_FILE_PATH).delete(); File f = new File(STATES_FILE_PATH); if (f.exists()) f.delete(); } catch (Throwable e) { if (DBG) Log.d("VpnServiceBinder", " remove states: " + e); } Loading vpn/java/android/net/vpn/VpnManager.java +14 −7 Original line number Diff line number Diff line Loading @@ -45,18 +45,25 @@ public class VpnManager { /** Key to the error code of a connectivity broadcast event. */ public static final String BROADCAST_ERROR_CODE = "err"; /** Error code to indicate an error from authentication. */ public static final int VPN_ERROR_AUTH = 1; public static final int VPN_ERROR_AUTH = 51; /** Error code to indicate the connection attempt failed. */ public static final int VPN_ERROR_CONNECTION_FAILED = 2; public static final int VPN_ERROR_CONNECTION_FAILED = 101; /** Error code to indicate the server is not known. */ public static final int VPN_ERROR_UNKNOWN_SERVER = 3; public static final int VPN_ERROR_UNKNOWN_SERVER = 102; /** Error code to indicate an error from challenge response. */ public static final int VPN_ERROR_CHALLENGE = 4; public static final int VPN_ERROR_CHALLENGE = 5; /** Error code to indicate an error of remote server hanging up. */ public static final int VPN_ERROR_REMOTE_HUNG_UP = 5; public static final int VPN_ERROR_REMOTE_HUNG_UP = 7; /** Error code to indicate an error of remote PPP server hanging up. */ public static final int VPN_ERROR_REMOTE_PPP_HUNG_UP = 48; /** Error code to indicate a PPP negotiation error. */ public static final int VPN_ERROR_PPP_NEGOTIATION_FAILED = 42; /** Error code to indicate an error of losing connectivity. */ public static final int VPN_ERROR_CONNECTION_LOST = 6; private static final int VPN_ERROR_NO_ERROR = 0; public static final int VPN_ERROR_CONNECTION_LOST = 103; /** Largest error code used by VPN. */ public static final int VPN_ERROR_LARGEST = 200; /** Error code to indicate a successful connection. */ public static final int VPN_ERROR_NO_ERROR = 0; public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; Loading Loading
packages/VpnServices/src/com/android/server/vpn/VpnService.java +3 −21 Original line number Diff line number Diff line Loading @@ -56,10 +56,6 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { private static final String REMOTE_IP = "net.ipremote"; private static final String DNS_DOMAIN_SUFFICES = "net.dns.search"; private static final int CHALLENGE_ERROR_CODE = 5; private static final int REMOTE_HUNG_UP_ERROR_CODE = 7; private static final int AUTH_ERROR_CODE = 51; private final String TAG = VpnService.class.getSimpleName(); // FIXME: profile is only needed in connecting phase, so we can just save Loading Loading @@ -202,7 +198,7 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { private void waitUntilConnectedOrTimedout() throws IOException { sleep(2000); // 2 seconds for (int i = 0; i < 60; i++) { for (int i = 0; i < 80; i++) { if (mState != VpnState.CONNECTING) { break; } else if (VPN_IS_UP.equals( Loading Loading @@ -464,22 +460,8 @@ abstract class VpnService<E extends VpnProfile> implements Serializable { synchronized int getSocketError() { for (DaemonProxy s : mDaemonList) { switch (getResultFromSocket(s)) { case 0: continue; case AUTH_ERROR_CODE: return VpnManager.VPN_ERROR_AUTH; case CHALLENGE_ERROR_CODE: return VpnManager.VPN_ERROR_CHALLENGE; case REMOTE_HUNG_UP_ERROR_CODE: return VpnManager.VPN_ERROR_REMOTE_HUNG_UP; default: return VpnManager.VPN_ERROR_CONNECTION_FAILED; } int errCode = getResultFromSocket(s); if (errCode != 0) return errCode; } return 0; } Loading
packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java +2 −1 Original line number Diff line number Diff line Loading @@ -91,7 +91,8 @@ public class VpnServiceBinder extends Service { void removeStates() { try { new File(STATES_FILE_PATH).delete(); File f = new File(STATES_FILE_PATH); if (f.exists()) f.delete(); } catch (Throwable e) { if (DBG) Log.d("VpnServiceBinder", " remove states: " + e); } Loading
vpn/java/android/net/vpn/VpnManager.java +14 −7 Original line number Diff line number Diff line Loading @@ -45,18 +45,25 @@ public class VpnManager { /** Key to the error code of a connectivity broadcast event. */ public static final String BROADCAST_ERROR_CODE = "err"; /** Error code to indicate an error from authentication. */ public static final int VPN_ERROR_AUTH = 1; public static final int VPN_ERROR_AUTH = 51; /** Error code to indicate the connection attempt failed. */ public static final int VPN_ERROR_CONNECTION_FAILED = 2; public static final int VPN_ERROR_CONNECTION_FAILED = 101; /** Error code to indicate the server is not known. */ public static final int VPN_ERROR_UNKNOWN_SERVER = 3; public static final int VPN_ERROR_UNKNOWN_SERVER = 102; /** Error code to indicate an error from challenge response. */ public static final int VPN_ERROR_CHALLENGE = 4; public static final int VPN_ERROR_CHALLENGE = 5; /** Error code to indicate an error of remote server hanging up. */ public static final int VPN_ERROR_REMOTE_HUNG_UP = 5; public static final int VPN_ERROR_REMOTE_HUNG_UP = 7; /** Error code to indicate an error of remote PPP server hanging up. */ public static final int VPN_ERROR_REMOTE_PPP_HUNG_UP = 48; /** Error code to indicate a PPP negotiation error. */ public static final int VPN_ERROR_PPP_NEGOTIATION_FAILED = 42; /** Error code to indicate an error of losing connectivity. */ public static final int VPN_ERROR_CONNECTION_LOST = 6; private static final int VPN_ERROR_NO_ERROR = 0; public static final int VPN_ERROR_CONNECTION_LOST = 103; /** Largest error code used by VPN. */ public static final int VPN_ERROR_LARGEST = 200; /** Error code to indicate a successful connection. */ public static final int VPN_ERROR_NO_ERROR = 0; public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; Loading