diff options
22 files changed, 311 insertions, 68 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 79588ea..62dc651 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -3697,6 +3697,13 @@ public final class ActivityThread { */ Locale.setDefault(data.config.locale); + /* + * Update the system configuration since its preloaded and might not + * reflect configuration changes. The configuration object passed + * in AppBindData can be safely assumed to be up to date + */ + Resources.getSystem().updateConfiguration(mConfiguration, null); + data.info = getPackageInfoNoCheck(data.appInfo); if (data.debugMode != IApplicationThread.DEBUG_OFF) { diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 44cf9a4..00bc21e 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -343,7 +343,7 @@ public class RelativeLayout extends ViewGroup { ignore = findViewById(mIgnoreGravity); } - View[] views = mSortedVerticalChildren; + View[] views = mSortedHorizontalChildren; int count = views.length; for (int i = 0; i < count; i++) { View child = views[i]; @@ -356,7 +356,7 @@ public class RelativeLayout extends ViewGroup { } } - views = mSortedHorizontalChildren; + views = mSortedVerticalChildren; count = views.length; for (int i = 0; i < count; i++) { View child = views[i]; diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 945a325..c890b0f 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -496,7 +496,7 @@ void android_os_Process_readProcLines(JNIEnv* env, jobject clazz, jstring fileSt const String8& field = fields[i]; if (strncmp(p, field.string(), field.length()) == 0) { p += field.length(); - while (*p == ' ') p++; + while (*p == ' ' || *p == '\t') p++; char* num = p; while (*p >= '0' && *p <= '9') p++; skipToEol = *p != '\n'; diff --git a/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java b/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java index a12db8c..2ad218f 100644 --- a/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java +++ b/packages/VpnServices/src/com/android/server/vpn/AndroidServiceProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java index 8358c5c..877fa6b 100644 --- a/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java +++ b/packages/VpnServices/src/com/android/server/vpn/L2tpIpsecService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,7 @@ import java.io.IOException; * The service that manages the L2TP-over-IPSec VPN connection. */ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> { - private static final String IPSEC_SERVICE = "racoon"; - private static final String L2TP_SERVICE = "mtpd"; + private static final String IPSEC_DAEMON = "racoon"; @Override protected void connect(String serverIp, String username, String password) @@ -34,7 +33,7 @@ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> { String hostIp = getHostIp(); // IPSEC - AndroidServiceProxy ipsecService = startService(IPSEC_SERVICE); + AndroidServiceProxy ipsecService = startService(IPSEC_DAEMON); ipsecService.sendCommand( String.format("SETKEY %s %s", hostIp, serverIp)); ipsecService.sendCommand(String.format("SET_CERTS %s %s %s %s", @@ -42,11 +41,11 @@ class L2tpIpsecService extends VpnService<L2tpIpsecProfile> { getUserkeyPath())); // L2TP - AndroidServiceProxy l2tpService = startService(L2TP_SERVICE); - l2tpService.sendCommand2("l2tp", serverIp, "1701", "", - "file", getPppOptionFilePath(), - "name", username, - "password", password); + L2tpIpsecProfile p = getProfile(); + MtpdHelper.sendCommand(this, L2tpService.L2TP_DAEMON, serverIp, + L2tpService.L2TP_PORT, + (p.isSecretEnabled() ? p.getSecretString() : null), + username, password); } private String getCaCertPath() { diff --git a/packages/VpnServices/src/com/android/server/vpn/L2tpService.java b/packages/VpnServices/src/com/android/server/vpn/L2tpService.java index 9aad7a1..9273f35 100644 --- a/packages/VpnServices/src/com/android/server/vpn/L2tpService.java +++ b/packages/VpnServices/src/com/android/server/vpn/L2tpService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,19 +24,15 @@ import java.io.IOException; * The service that manages the L2TP VPN connection. */ class L2tpService extends VpnService<L2tpProfile> { - private static final String L2TP_SERVICE = "mtpd"; + static final String L2TP_DAEMON = "l2tp"; + static final String L2TP_PORT = "1701"; @Override protected void connect(String serverIp, String username, String password) throws IOException { - String hostIp = getHostIp(); - - // L2TP - AndroidServiceProxy l2tpService = startService(L2TP_SERVICE); - l2tpService.sendCommand2("l2tp", serverIp, "1701", "", - "file", getPppOptionFilePath(), - "name", username, - "password", password); + L2tpProfile p = getProfile(); + MtpdHelper.sendCommand(this, L2TP_DAEMON, serverIp, L2TP_PORT, + (p.isSecretEnabled() ? p.getSecretString() : null), + username, password); } - } diff --git a/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java b/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java new file mode 100644 index 0000000..6160900 --- /dev/null +++ b/packages/VpnServices/src/com/android/server/vpn/MtpdHelper.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.vpn; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; + +/** + * A helper class for sending commands to the MTP daemon (mtpd). + */ +class MtpdHelper { + private static final String MTPD_SERVICE = "mtpd"; + private static final String VPN_LINKNAME = "vpn"; + private static final String PPP_ARGS_SEPARATOR = ""; + + static void sendCommand(VpnService<?> vpnService, String protocol, + String serverIp, String port, String secret, String username, + String password) throws IOException { + ArrayList<String> args = new ArrayList<String>(); + args.addAll(Arrays.asList(protocol, serverIp, port)); + if (secret != null) args.add(secret); + args.add(PPP_ARGS_SEPARATOR); + addPppArguments(vpnService, args, serverIp, username, password); + + AndroidServiceProxy mtpd = vpnService.startService(MTPD_SERVICE); + mtpd.sendCommand2(args.toArray(new String[args.size()])); + } + + private static void addPppArguments(VpnService<?> vpnService, + ArrayList<String> args, String serverIp, String username, + String password) throws IOException { + args.addAll(Arrays.asList( + "linkname", VPN_LINKNAME, + "name", username, + "password", password, + "ipparam", serverIp + "@" + vpnService.getGatewayIp(), + "refuse-eap", "nodefaultroute", "usepeerdns", + "idle", "1800", + "mtu", "1400", + "mru", "1400")); + } + + private MtpdHelper() { + } +} diff --git a/packages/VpnServices/src/com/android/server/vpn/NormalProcessProxy.java b/packages/VpnServices/src/com/android/server/vpn/NormalProcessProxy.java index f20d85f..f0bbc34 100644 --- a/packages/VpnServices/src/com/android/server/vpn/NormalProcessProxy.java +++ b/packages/VpnServices/src/com/android/server/vpn/NormalProcessProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/VpnServices/src/com/android/server/vpn/PptpService.java b/packages/VpnServices/src/com/android/server/vpn/PptpService.java new file mode 100644 index 0000000..01362a5 --- /dev/null +++ b/packages/VpnServices/src/com/android/server/vpn/PptpService.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.vpn; + +import android.net.vpn.PptpProfile; + +import java.io.IOException; + +/** + * The service that manages the PPTP VPN connection. + */ +class PptpService extends VpnService<PptpProfile> { + static final String PPTP_DAEMON = "pptp"; + static final String PPTP_PORT = "1723"; + @Override + protected void connect(String serverIp, String username, String password) + throws IOException { + MtpdHelper.sendCommand(this, PPTP_DAEMON, serverIp, PPTP_PORT, null, + username, password); + } + +} diff --git a/packages/VpnServices/src/com/android/server/vpn/ProcessProxy.java b/packages/VpnServices/src/com/android/server/vpn/ProcessProxy.java index 14d7521..50fbf4b 100644 --- a/packages/VpnServices/src/com/android/server/vpn/ProcessProxy.java +++ b/packages/VpnServices/src/com/android/server/vpn/ProcessProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnService.java b/packages/VpnServices/src/com/android/server/vpn/VpnService.java index fdefe9c..44127ff 100644 --- a/packages/VpnServices/src/com/android/server/vpn/VpnService.java +++ b/packages/VpnServices/src/com/android/server/vpn/VpnService.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; +import android.net.NetworkUtils; import android.net.vpn.VpnManager; import android.net.vpn.VpnProfile; import android.net.vpn.VpnState; @@ -31,8 +32,10 @@ import java.io.File; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.NetworkInterface; import java.net.Socket; import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; /** @@ -153,16 +156,25 @@ abstract class VpnService<E extends VpnProfile> { } /** - * Returns the IP of the specified host name. + * Returns the IP address of the specified host name. */ protected String getIp(String hostName) throws IOException { - InetAddress iaddr = InetAddress.getByName(hostName); - byte[] aa = iaddr.getAddress(); - StringBuilder sb = new StringBuilder().append(byteToInt(aa[0])); - for (int i = 1; i < aa.length; i++) { - sb.append(".").append(byteToInt(aa[i])); + return InetAddress.getByName(hostName).getHostAddress(); + } + + /** + * Returns the IP address of the default gateway. + */ + protected String getGatewayIp() throws IOException { + Enumeration<NetworkInterface> ifces = + NetworkInterface.getNetworkInterfaces(); + for (; ifces.hasMoreElements(); ) { + NetworkInterface ni = ifces.nextElement(); + int gateway = NetworkUtils.getDefaultRoute(ni.getName()); + if (gateway == 0) continue; + return toInetAddress(gateway).getHostAddress(); } - return sb.toString(); + throw new IOException("Default gateway is not available"); } /** @@ -170,7 +182,7 @@ abstract class VpnService<E extends VpnProfile> { * connection is established. */ protected String getConnectMonitorFile() { - return "/etc/ppp/ip-up"; + return "/etc/ppp/ip-up-vpn"; } /** @@ -461,12 +473,18 @@ abstract class VpnService<E extends VpnProfile> { } private String reallyGetHostIp() throws IOException { - Socket s = new Socket(); - s.connect(new InetSocketAddress("www.google.com", 80), DNS_TIMEOUT); - String ipAddress = s.getLocalAddress().getHostAddress(); - Log.d(TAG, "Host IP: " + ipAddress); - s.close(); - return ipAddress; + Enumeration<NetworkInterface> ifces = + NetworkInterface.getNetworkInterfaces(); + for (; ifces.hasMoreElements(); ) { + NetworkInterface ni = ifces.nextElement(); + int gateway = NetworkUtils.getDefaultRoute(ni.getName()); + if (gateway == 0) continue; + Enumeration<InetAddress> addrs = ni.getInetAddresses(); + for (; addrs.hasMoreElements(); ) { + return addrs.nextElement().getHostAddress(); + } + } + throw new IOException("Host IP is not available"); } private String getProfileSubpath(String subpath) throws IOException { @@ -496,8 +514,13 @@ abstract class VpnService<E extends VpnProfile> { return ((message == null) || (message.length() == 0)); } - private static int byteToInt(byte b) { - return ((int) b) & 0x0FF; + private InetAddress toInetAddress(int addr) throws IOException { + byte[] aa = new byte[4]; + for (int i= 0; i < aa.length; i++) { + aa[i] = (byte) (addr & 0x0FF); + addr >>= 8; + } + return InetAddress.getByAddress(aa); } private class ServiceHelper implements ProcessProxy.Callback { diff --git a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java index 7195ea6..63fc858 100644 --- a/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java +++ b/packages/VpnServices/src/com/android/server/vpn/VpnServiceBinder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/IVpnService.aidl b/vpn/java/android/net/vpn/IVpnService.aidl index 0e658df..fedccb0 100644 --- a/vpn/java/android/net/vpn/IVpnService.aidl +++ b/vpn/java/android/net/vpn/IVpnService.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/L2tpIpsecProfile.java b/vpn/java/android/net/vpn/L2tpIpsecProfile.java index 181619d..4ae2dec 100644 --- a/vpn/java/android/net/vpn/L2tpIpsecProfile.java +++ b/vpn/java/android/net/vpn/L2tpIpsecProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,15 +19,14 @@ package android.net.vpn; import android.os.Parcel; /** - * The profile for L2TP-over-IPSec type of VPN. + * The profile for certificate-based L2TP-over-IPSec type of VPN. * {@hide} */ -public class L2tpIpsecProfile extends VpnProfile { +public class L2tpIpsecProfile extends L2tpProfile { private static final long serialVersionUID = 1L; private String mUserCertificate; private String mCaCertificate; - private String mUserkey; @Override public VpnType getType() { @@ -50,20 +49,11 @@ public class L2tpIpsecProfile extends VpnProfile { return mUserCertificate; } - public void setUserkey(String name) { - mUserkey = name; - } - - public String getUserkey() { - return mUserkey; - } - @Override protected void readFromParcel(Parcel in) { super.readFromParcel(in); mCaCertificate = in.readString(); mUserCertificate = in.readString(); - mUserkey = in.readString(); } @Override @@ -71,6 +61,5 @@ public class L2tpIpsecProfile extends VpnProfile { super.writeToParcel(parcel, flags); parcel.writeString(mCaCertificate); parcel.writeString(mUserCertificate); - parcel.writeString(mUserkey); } } diff --git a/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java b/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java new file mode 100644 index 0000000..7a03018 --- /dev/null +++ b/vpn/java/android/net/vpn/L2tpIpsecPskProfile.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.vpn; + +import android.os.Parcel; + +/** + * The profile for pre-shared-key-based L2TP-over-IPSec type of VPN. + * {@hide} + */ +public class L2tpIpsecPskProfile extends L2tpProfile { + private static final long serialVersionUID = 1L; + + private String mPresharedKey; + + @Override + public VpnType getType() { + return VpnType.L2TP_IPSEC_PSK; + } + + public void setPresharedKey(String key) { + mPresharedKey = key; + } + + public String getPresharedKey() { + return mPresharedKey; + } + + @Override + protected void readFromParcel(Parcel in) { + super.readFromParcel(in); + mPresharedKey = in.readString(); + } + + @Override + public void writeToParcel(Parcel parcel, int flags) { + super.writeToParcel(parcel, flags); + parcel.writeString(mPresharedKey); + } +} diff --git a/vpn/java/android/net/vpn/L2tpProfile.java b/vpn/java/android/net/vpn/L2tpProfile.java index 59d4981..dbba0c5 100644 --- a/vpn/java/android/net/vpn/L2tpProfile.java +++ b/vpn/java/android/net/vpn/L2tpProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package android.net.vpn; +import android.os.Parcel; + /** * The profile for L2TP type of VPN. * {@hide} @@ -23,8 +25,44 @@ package android.net.vpn; public class L2tpProfile extends VpnProfile { private static final long serialVersionUID = 1L; + private boolean mSecret; + private String mSecretString; + @Override public VpnType getType() { return VpnType.L2TP; } + + /** + * Enables/disables the secret for authenticating tunnel connection. + */ + public void setSecretEnabled(boolean enabled) { + mSecret = enabled; + } + + public boolean isSecretEnabled() { + return mSecret; + } + + public void setSecretString(String secret) { + mSecretString = secret; + } + + public String getSecretString() { + return mSecretString; + } + + @Override + protected void readFromParcel(Parcel in) { + super.readFromParcel(in); + mSecret = in.readInt() > 0; + mSecretString = in.readString(); + } + + @Override + public void writeToParcel(Parcel parcel, int flags) { + super.writeToParcel(parcel, flags); + parcel.writeInt(mSecret ? 1 : 0); + parcel.writeString(mSecretString); + } } diff --git a/vpn/java/android/net/vpn/PptpProfile.java b/vpn/java/android/net/vpn/PptpProfile.java new file mode 100644 index 0000000..c68bb71 --- /dev/null +++ b/vpn/java/android/net/vpn/PptpProfile.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.net.vpn; + +/** + * The profile for PPTP type of VPN. + * {@hide} + */ +public class PptpProfile extends VpnProfile { + private static final long serialVersionUID = 1L; + + @Override + public VpnType getType() { + return VpnType.PPTP; + } +} diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java index 98795bd..dc70b26 100644 --- a/vpn/java/android/net/vpn/VpnManager.java +++ b/vpn/java/android/net/vpn/VpnManager.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnProfile.aidl b/vpn/java/android/net/vpn/VpnProfile.aidl index ad34bfc..edeaef0 100644 --- a/vpn/java/android/net/vpn/VpnProfile.aidl +++ b/vpn/java/android/net/vpn/VpnProfile.aidl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnProfile.java b/vpn/java/android/net/vpn/VpnProfile.java index 9e24da4..bd6c809 100644 --- a/vpn/java/android/net/vpn/VpnProfile.java +++ b/vpn/java/android/net/vpn/VpnProfile.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnState.java b/vpn/java/android/net/vpn/VpnState.java index 977d938..ebd9364 100644 --- a/vpn/java/android/net/vpn/VpnState.java +++ b/vpn/java/android/net/vpn/VpnState.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vpn/java/android/net/vpn/VpnType.java b/vpn/java/android/net/vpn/VpnType.java index 91b0ea2..c7df943 100644 --- a/vpn/java/android/net/vpn/VpnType.java +++ b/vpn/java/android/net/vpn/VpnType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, The Android Open Source Project + * Copyright (C) 2009, The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,14 +21,21 @@ package android.net.vpn; * {@hide} */ public enum VpnType { - L2TP_IPSEC("L2TP/IPSec", L2tpIpsecProfile.class), - L2TP("L2TP", L2tpProfile.class); + PPTP("PPTP", "", PptpProfile.class), + L2TP("L2TP", "", L2tpProfile.class), + L2TP_IPSEC_PSK("L2TP/IPSec PSK", "Pre-shared key based L2TP/IPSec VPN", + L2tpIpsecPskProfile.class), + L2TP_IPSEC("L2TP/IPSec CRT", "Certificate based L2TP/IPSec VPN", + L2tpIpsecProfile.class); private String mDisplayName; + private String mDescription; private Class<? extends VpnProfile> mClass; - VpnType(String displayName, Class<? extends VpnProfile> klass) { + VpnType(String displayName, String description, + Class<? extends VpnProfile> klass) { mDisplayName = displayName; + mDescription = description; mClass = klass; } @@ -36,6 +43,10 @@ public enum VpnType { return mDisplayName; } + public String getDescription() { + return mDescription; + } + public Class<? extends VpnProfile> getProfileClass() { return mClass; } |