diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-08-08 14:33:53 -0700 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-08-08 14:35:25 -0700 |
commit | 6d4334be691815cd9615b0fdebb756999a9c06a3 (patch) | |
tree | 4deda6580b09f1da75395cfedf1ddd617ba4ad9f /src/com/android/settings/vpn2 | |
parent | 14f6934fed64f296458ef0babffdc45398100a30 (diff) | |
download | packages_apps_Settings-6d4334be691815cd9615b0fdebb756999a9c06a3.zip packages_apps_Settings-6d4334be691815cd9615b0fdebb756999a9c06a3.tar.gz packages_apps_Settings-6d4334be691815cd9615b0fdebb756999a9c06a3.tar.bz2 |
VpnSettings: fix bugs.
1. Support identifier in L2TP/IPSec PSK.
2. Fix profile validation for IPSec Hybrid RSA.
3. Fix crash when the user does not want to initialize keystore.
Change-Id: Id46dbbc84915dfb69f8bab6b540426e7614ab7c6
Diffstat (limited to 'src/com/android/settings/vpn2')
-rw-r--r-- | src/com/android/settings/vpn2/VpnDialog.java | 11 | ||||
-rw-r--r-- | src/com/android/settings/vpn2/VpnSettings.java | 14 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/com/android/settings/vpn2/VpnDialog.java b/src/com/android/settings/vpn2/VpnDialog.java index c1a4531..cce5e2d 100644 --- a/src/com/android/settings/vpn2/VpnDialog.java +++ b/src/com/android/settings/vpn2/VpnDialog.java @@ -213,7 +213,6 @@ class VpnDialog extends AlertDialog implements TextWatcher, // First, hide everything. mMppe.setVisibility(View.GONE); mView.findViewById(R.id.l2tp).setVisibility(View.GONE); - mView.findViewById(R.id.ipsec_id).setVisibility(View.GONE); mView.findViewById(R.id.ipsec_psk).setVisibility(View.GONE); mView.findViewById(R.id.ipsec_user).setVisibility(View.GONE); mView.findViewById(R.id.ipsec_ca).setVisibility(View.GONE); @@ -223,12 +222,11 @@ class VpnDialog extends AlertDialog implements TextWatcher, case VpnProfile.TYPE_PPTP: mMppe.setVisibility(View.VISIBLE); break; + case VpnProfile.TYPE_L2TP_IPSEC_PSK: mView.findViewById(R.id.l2tp).setVisibility(View.VISIBLE); - mView.findViewById(R.id.ipsec_psk).setVisibility(View.VISIBLE); - break; + // fall through case VpnProfile.TYPE_IPSEC_XAUTH_PSK: - mView.findViewById(R.id.ipsec_id).setVisibility(View.VISIBLE); mView.findViewById(R.id.ipsec_psk).setVisibility(View.VISIBLE); break; @@ -255,6 +253,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, } switch (mType.getSelectedItemPosition()) { case VpnProfile.TYPE_PPTP: + case VpnProfile.TYPE_IPSEC_HYBRID_RSA: return true; case VpnProfile.TYPE_L2TP_IPSEC_PSK: @@ -343,10 +342,10 @@ class VpnDialog extends AlertDialog implements TextWatcher, case VpnProfile.TYPE_PPTP: profile.mppe = mMppe.isChecked(); break; + case VpnProfile.TYPE_L2TP_IPSEC_PSK: profile.l2tpSecret = mL2tpSecret.getText().toString(); - profile.ipsecSecret = mIpsecSecret.getText().toString(); - break; + // fall through case VpnProfile.TYPE_IPSEC_XAUTH_PSK: profile.ipsecIdentifier = mIpsecIdentifier.getText().toString(); profile.ipsecSecret = mIpsecSecret.getText().toString(); diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java index 5fe6426..0197333 100644 --- a/src/com/android/settings/vpn2/VpnSettings.java +++ b/src/com/android/settings/vpn2/VpnSettings.java @@ -53,7 +53,6 @@ public class VpnSettings extends SettingsPreferenceFragment implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener { private static final String TAG = "VpnSettings"; - private static final String SCRIPT = "/etc/ppp/ip-up-vpn"; private final IConnectivityManager mService = IConnectivityManager.Stub .asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE)); @@ -171,7 +170,9 @@ public class VpnSettings extends SettingsPreferenceFragment implements } // Unregister for context menu. - unregisterForContextMenu(getListView()); + if (getView() != null) { + unregisterForContextMenu(getListView()); + } } @Override @@ -373,7 +374,8 @@ public class VpnSettings extends SettingsPreferenceFragment implements switch (profile.type) { case VpnProfile.TYPE_L2TP_IPSEC_PSK: racoon = new String[] { - interfaze, profile.server, "udppsk", profile.ipsecSecret, "1701", + interfaze, profile.server, "udppsk", profile.ipsecIdentifier, + profile.ipsecSecret, "1701", }; break; case VpnProfile.TYPE_L2TP_IPSEC_RSA: @@ -384,19 +386,19 @@ public class VpnSettings extends SettingsPreferenceFragment implements case VpnProfile.TYPE_IPSEC_XAUTH_PSK: racoon = new String[] { interfaze, profile.server, "xauthpsk", profile.ipsecIdentifier, - profile.ipsecSecret, profile.username, profile.password, SCRIPT, gateway, + profile.ipsecSecret, profile.username, profile.password, "", gateway, }; break; case VpnProfile.TYPE_IPSEC_XAUTH_RSA: racoon = new String[] { interfaze, profile.server, "xauthrsa", privateKey, userCert, caCert, - profile.username, profile.password, SCRIPT, gateway, + profile.username, profile.password, "", gateway, }; break; case VpnProfile.TYPE_IPSEC_HYBRID_RSA: racoon = new String[] { interfaze, profile.server, "hybridrsa", caCert, - profile.username, profile.password, SCRIPT, gateway, + profile.username, profile.password, "", gateway, }; break; } |