summaryrefslogtreecommitdiffstats
path: root/vpn/java
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2009-07-11 22:23:30 +0800
committerHung-ying Tyan <tyanh@google.com>2009-07-13 13:11:36 +0800
commitdf1aa3359ccfe81a3f79ed457c7bfc75942a9d91 (patch)
tree8d915f8762b7ce3271a0a0d2b4f84287b9cda059 /vpn/java
parentcf29e116129f38309c18ba14b9893b079a712289 (diff)
downloadframeworks_base-df1aa3359ccfe81a3f79ed457c7bfc75942a9d91.zip
frameworks_base-df1aa3359ccfe81a3f79ed457c7bfc75942a9d91.tar.gz
frameworks_base-df1aa3359ccfe81a3f79ed457c7bfc75942a9d91.tar.bz2
Add error code in vpn connectivity broadcast.
* Changes + Add VpnConnectingError.java. + Broadcast the error returned by daemons. + Add error codes to VpnManager.java. + Add error code to VpnManager.broadcastConnectivity(). Patch Set 4: + Replace VPN_UP with VPN_STATUS in response to ip-up-vpn changes. + Make VpnServiceBinder a foreground service so that it won't be interrupted by the system. Patch Set 5: + Remove the support of returning 0 from daemon and restart socket in AndroidServiceProxy.
Diffstat (limited to 'vpn/java')
-rw-r--r--vpn/java/android/net/vpn/VpnManager.java21
1 files changed, 20 insertions, 1 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);
}