Merge "VpnSettings: fix bugs."

This commit is contained in:
Chia-chi Yeh
2011-08-08 17:45:41 -07:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 19 deletions

View File

@@ -56,7 +56,7 @@
android:hint="@string/vpn_not_used"/>
</LinearLayout>
<LinearLayout android:id="@+id/ipsec_id"
<LinearLayout android:id="@+id/ipsec_psk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -64,13 +64,7 @@
<TextView style="@style/vpn_label" android:text="@string/vpn_ipsec_identifier"/>
<EditText style="@style/vpn_value" android:id="@+id/ipsec_identifier"
android:hint="@string/vpn_not_used"/>
</LinearLayout>
<LinearLayout android:id="@+id/ipsec_psk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<TextView style="@style/vpn_label" android:text="@string/vpn_ipsec_secret"/>
<EditText style="@style/vpn_value" android:id="@+id/ipsec_secret"
android:password="true"/>

View File

@@ -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();

View File

@@ -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;
}