Merge "VpnSettings: fix bugs."
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
android:hint="@string/vpn_not_used"/>
|
android:hint="@string/vpn_not_used"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout android:id="@+id/ipsec_id"
|
<LinearLayout android:id="@+id/ipsec_psk"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
@@ -64,13 +64,7 @@
|
|||||||
<TextView style="@style/vpn_label" android:text="@string/vpn_ipsec_identifier"/>
|
<TextView style="@style/vpn_label" android:text="@string/vpn_ipsec_identifier"/>
|
||||||
<EditText style="@style/vpn_value" android:id="@+id/ipsec_identifier"
|
<EditText style="@style/vpn_value" android:id="@+id/ipsec_identifier"
|
||||||
android:hint="@string/vpn_not_used"/>
|
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"/>
|
<TextView style="@style/vpn_label" android:text="@string/vpn_ipsec_secret"/>
|
||||||
<EditText style="@style/vpn_value" android:id="@+id/ipsec_secret"
|
<EditText style="@style/vpn_value" android:id="@+id/ipsec_secret"
|
||||||
android:password="true"/>
|
android:password="true"/>
|
||||||
|
@@ -213,7 +213,6 @@ class VpnDialog extends AlertDialog implements TextWatcher,
|
|||||||
// First, hide everything.
|
// First, hide everything.
|
||||||
mMppe.setVisibility(View.GONE);
|
mMppe.setVisibility(View.GONE);
|
||||||
mView.findViewById(R.id.l2tp).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_psk).setVisibility(View.GONE);
|
||||||
mView.findViewById(R.id.ipsec_user).setVisibility(View.GONE);
|
mView.findViewById(R.id.ipsec_user).setVisibility(View.GONE);
|
||||||
mView.findViewById(R.id.ipsec_ca).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:
|
case VpnProfile.TYPE_PPTP:
|
||||||
mMppe.setVisibility(View.VISIBLE);
|
mMppe.setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
mView.findViewById(R.id.l2tp).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.l2tp).setVisibility(View.VISIBLE);
|
||||||
mView.findViewById(R.id.ipsec_psk).setVisibility(View.VISIBLE);
|
// fall through
|
||||||
break;
|
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
||||||
mView.findViewById(R.id.ipsec_id).setVisibility(View.VISIBLE);
|
|
||||||
mView.findViewById(R.id.ipsec_psk).setVisibility(View.VISIBLE);
|
mView.findViewById(R.id.ipsec_psk).setVisibility(View.VISIBLE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -255,6 +253,7 @@ class VpnDialog extends AlertDialog implements TextWatcher,
|
|||||||
}
|
}
|
||||||
switch (mType.getSelectedItemPosition()) {
|
switch (mType.getSelectedItemPosition()) {
|
||||||
case VpnProfile.TYPE_PPTP:
|
case VpnProfile.TYPE_PPTP:
|
||||||
|
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
@@ -343,10 +342,10 @@ class VpnDialog extends AlertDialog implements TextWatcher,
|
|||||||
case VpnProfile.TYPE_PPTP:
|
case VpnProfile.TYPE_PPTP:
|
||||||
profile.mppe = mMppe.isChecked();
|
profile.mppe = mMppe.isChecked();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
profile.l2tpSecret = mL2tpSecret.getText().toString();
|
profile.l2tpSecret = mL2tpSecret.getText().toString();
|
||||||
profile.ipsecSecret = mIpsecSecret.getText().toString();
|
// fall through
|
||||||
break;
|
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
||||||
profile.ipsecIdentifier = mIpsecIdentifier.getText().toString();
|
profile.ipsecIdentifier = mIpsecIdentifier.getText().toString();
|
||||||
profile.ipsecSecret = mIpsecSecret.getText().toString();
|
profile.ipsecSecret = mIpsecSecret.getText().toString();
|
||||||
|
@@ -53,7 +53,6 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
|
DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
|
||||||
|
|
||||||
private static final String TAG = "VpnSettings";
|
private static final String TAG = "VpnSettings";
|
||||||
private static final String SCRIPT = "/etc/ppp/ip-up-vpn";
|
|
||||||
|
|
||||||
private final IConnectivityManager mService = IConnectivityManager.Stub
|
private final IConnectivityManager mService = IConnectivityManager.Stub
|
||||||
.asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
|
.asInterface(ServiceManager.getService(Context.CONNECTIVITY_SERVICE));
|
||||||
@@ -171,8 +170,10 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unregister for context menu.
|
// Unregister for context menu.
|
||||||
|
if (getView() != null) {
|
||||||
unregisterForContextMenu(getListView());
|
unregisterForContextMenu(getListView());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDismiss(DialogInterface dialog) {
|
public void onDismiss(DialogInterface dialog) {
|
||||||
@@ -373,7 +374,8 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
switch (profile.type) {
|
switch (profile.type) {
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
racoon = new String[] {
|
racoon = new String[] {
|
||||||
interfaze, profile.server, "udppsk", profile.ipsecSecret, "1701",
|
interfaze, profile.server, "udppsk", profile.ipsecIdentifier,
|
||||||
|
profile.ipsecSecret, "1701",
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
||||||
@@ -384,19 +386,19 @@ public class VpnSettings extends SettingsPreferenceFragment implements
|
|||||||
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
||||||
racoon = new String[] {
|
racoon = new String[] {
|
||||||
interfaze, profile.server, "xauthpsk", profile.ipsecIdentifier,
|
interfaze, profile.server, "xauthpsk", profile.ipsecIdentifier,
|
||||||
profile.ipsecSecret, profile.username, profile.password, SCRIPT, gateway,
|
profile.ipsecSecret, profile.username, profile.password, "", gateway,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
||||||
racoon = new String[] {
|
racoon = new String[] {
|
||||||
interfaze, profile.server, "xauthrsa", privateKey, userCert, caCert,
|
interfaze, profile.server, "xauthrsa", privateKey, userCert, caCert,
|
||||||
profile.username, profile.password, SCRIPT, gateway,
|
profile.username, profile.password, "", gateway,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
case VpnProfile.TYPE_IPSEC_HYBRID_RSA:
|
||||||
racoon = new String[] {
|
racoon = new String[] {
|
||||||
interfaze, profile.server, "hybridrsa", caCert,
|
interfaze, profile.server, "hybridrsa", caCert,
|
||||||
profile.username, profile.password, SCRIPT, gateway,
|
profile.username, profile.password, "", gateway,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user