diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-07-29 14:25:07 -0700 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-07-29 14:25:07 -0700 |
commit | a8675f67e33bc7337d148358783b0fd138b501ff (patch) | |
tree | 71fb9d10330ef9161b3ead71d01074b3ef9e53ba /vpn/java | |
parent | cf4550c3198d6b3d92cdc52707fe70d7cc0caa9f (diff) | |
download | frameworks_base-a8675f67e33bc7337d148358783b0fd138b501ff.zip frameworks_base-a8675f67e33bc7337d148358783b0fd138b501ff.tar.gz frameworks_base-a8675f67e33bc7337d148358783b0fd138b501ff.tar.bz2 |
donut snapshot
Diffstat (limited to 'vpn/java')
-rw-r--r-- | vpn/java/android/net/vpn/VpnManager.java | 21 | ||||
-rw-r--r-- | vpn/java/android/net/vpn/VpnState.java | 7 |
2 files changed, 26 insertions, 2 deletions
diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java index dc70b26..0bf2346 100644 --- a/vpn/java/android/net/vpn/VpnManager.java +++ b/vpn/java/android/net/vpn/VpnManager.java @@ -42,6 +42,15 @@ public class VpnManager { public static final String BROADCAST_PROFILE_NAME = "profile_name"; /** Key to the connectivity state of a connectivity broadcast event. */ public static final String BROADCAST_CONNECTION_STATE = "connection_state"; + /** 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; + /** Error code to indicate the connection attempt failed. */ + public static final int VPN_ERROR_CONNECTION_FAILED = 2; + /** Error code to indicate the server is not known. */ + public static final int VPN_ERROR_UNKNOWN_SERVER = 3; + private static final int VPN_ERROR_NO_ERROR = 0; public static final String PROFILES_PATH = "/data/misc/vpn/profiles"; @@ -52,7 +61,8 @@ public class VpnManager { private static final String ACTION_VPN_SERVICE = PACKAGE_PREFIX + "SERVICE"; // Action to start VPN settings - private static final String ACTION_VPN_SETTINGS = PACKAGE_PREFIX + "SETTINGS"; + private static final String ACTION_VPN_SETTINGS = + PACKAGE_PREFIX + "SETTINGS"; private static final String TAG = VpnManager.class.getSimpleName(); @@ -130,9 +140,18 @@ public class VpnManager { /** Broadcasts the connectivity state of the specified profile. */ public void broadcastConnectivity(String profileName, VpnState s) { + broadcastConnectivity(profileName, s, VPN_ERROR_NO_ERROR); + } + + /** Broadcasts the connectivity state with an error code. */ + public void broadcastConnectivity(String profileName, VpnState s, + int error) { Intent intent = new Intent(ACTION_VPN_CONNECTIVITY); intent.putExtra(BROADCAST_PROFILE_NAME, profileName); intent.putExtra(BROADCAST_CONNECTION_STATE, s); + if (error != VPN_ERROR_NO_ERROR) { + intent.putExtra(BROADCAST_ERROR_CODE, error); + } mContext.sendBroadcast(intent); } diff --git a/vpn/java/android/net/vpn/VpnState.java b/vpn/java/android/net/vpn/VpnState.java index ebd9364..6e61f9c 100644 --- a/vpn/java/android/net/vpn/VpnState.java +++ b/vpn/java/android/net/vpn/VpnState.java @@ -26,8 +26,13 @@ package android.net.vpn; * {@link DISCONNECTING} and then {@link IDLE}. * {@link CANCELLED} is a state when a VPN connection attempt is aborted, and * is in transition to {@link IDLE}. + * The {@link UNUSABLE} state indicates that the profile is not in a state for + * connecting due to possibly the integrity of the fields or another profile is + * connecting etc. + * The {@link UNKNOWN} state indicates that the profile state is to be + * determined. * {@hide} */ public enum VpnState { - CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE + CONNECTING, DISCONNECTING, CANCELLED, CONNECTED, IDLE, UNUSABLE, UNKNOWN } |