diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5d89800df50..3091f7a0543 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1847,6 +1847,7 @@ found in the list of installed applications.
Are you sure you don\'t want to create this profile?
Are you sure you want to discard the changes made to this profile?
Unable to connect to the network. Do you want to try again?
+ Connection lost. Do you want to connect again?
Server name cannot be resolved. Do you want to check your server name setting?
Challenge error. Do you want to check your secret setting?
One or more secrets are missing in this VPN configuration. Do you want to check your secret setting?
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index 4dda152793f..7d4ea2516a0 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -111,6 +111,7 @@ public class VpnSettings extends PreferenceActivity implements
private static final int DIALOG_SECRET_NOT_SET = 5;
private static final int DIALOG_CHALLENGE_ERROR = 6;
private static final int DIALOG_REMOTE_HUNG_UP_ERROR = 7;
+ private static final int DIALOG_CONNECTION_LOST = 8;
private static final int NO_ERROR = 0;
@@ -218,6 +219,9 @@ public class VpnSettings extends PreferenceActivity implements
case DIALOG_SECRET_NOT_SET:
return createSecretNotSetDialog();
+ case DIALOG_CONNECTION_LOST:
+ return createConnectionLostDialog();
+
default:
return super.onCreateDialog(id);
}
@@ -227,7 +231,7 @@ public class VpnSettings extends PreferenceActivity implements
return new AlertDialog.Builder(this)
.setView(mConnectingActor.createConnectView())
.setTitle(String.format(getString(R.string.vpn_connect_to),
- mConnectingActor.getProfile().getName()))
+ mActiveProfile.getName()))
.setPositiveButton(getString(R.string.vpn_connect_button),
this)
.setNegativeButton(getString(android.R.string.cancel),
@@ -277,8 +281,7 @@ public class VpnSettings extends PreferenceActivity implements
.setPositiveButton(R.string.vpn_yes_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int w) {
- VpnProfile p = mConnectingActor.getProfile();
- startVpnEditor(p);
+ startVpnEditor(mActiveProfile);
}
})
.create();
@@ -289,13 +292,19 @@ public class VpnSettings extends PreferenceActivity implements
.setPositiveButton(R.string.vpn_yes_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int w) {
- VpnProfile p = mConnectingActor.getProfile();
+ VpnProfile p = mActiveProfile;
onIdle();
startVpnEditor(p);
}
});
}
+ private Dialog createConnectionLostDialog() {
+ return createCommonDialogBuilder()
+ .setMessage(R.string.vpn_reconnect_from_lost)
+ .create();
+ }
+
private AlertDialog.Builder createCommonDialogBuilder() {
return new AlertDialog.Builder(this)
.setTitle(android.R.string.dialog_alert_title)
@@ -303,7 +312,7 @@ public class VpnSettings extends PreferenceActivity implements
.setPositiveButton(R.string.vpn_yes_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int w) {
- connectOrDisconnect(mConnectingActor.getProfile());
+ connectOrDisconnect(mActiveProfile);
}
})
.setNegativeButton(R.string.vpn_no_button,
@@ -442,7 +451,7 @@ public class VpnSettings extends PreferenceActivity implements
Dialog d = (Dialog) dialog;
String error = mConnectingActor.validateInputs(d);
if (error == null) {
- changeState(mConnectingActor.getProfile(), VpnState.CONNECTING);
+ changeState(mActiveProfile, VpnState.CONNECTING);
mConnectingActor.connect(d);
removeDialog(DIALOG_CONNECT);
return;
@@ -760,6 +769,10 @@ public class VpnSettings extends PreferenceActivity implements
showDialog(DIALOG_UNKNOWN_SERVER);
break;
+ case VpnManager.VPN_ERROR_CONNECTION_LOST:
+ showDialog(DIALOG_CONNECTION_LOST);
+ break;
+
default:
showDialog(DIALOG_RECONNECT);
break;