Fix the retry the vpn connection issue.
Fix the issue of vpn connection retry if back button is pressed and the profile state is still in connecting. bug: 3278489 Change-Id: I8b51fdd65b2fdd8cbe4fb43afd916f1966b77b67
This commit is contained in:
@@ -216,23 +216,27 @@ public class VpnSettings extends SettingsPreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
private class ConnectDialog extends AlertDialog {
|
||||
public ConnectDialog(Context context) {
|
||||
super(context);
|
||||
setTitle(String.format(getString(R.string.vpn_connect_to),
|
||||
mActiveProfile.getName()));
|
||||
setButton(DialogInterface.BUTTON_POSITIVE,
|
||||
getString(R.string.vpn_connect_button),
|
||||
VpnSettings.this);
|
||||
setButton(DialogInterface.BUTTON_NEGATIVE,
|
||||
getString(android.R.string.cancel),
|
||||
VpnSettings.this);
|
||||
setView(mConnectingActor.createConnectView());
|
||||
}
|
||||
public void onBackPressed() {
|
||||
changeState(mActiveProfile, VpnState.IDLE);
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
private Dialog createConnectDialog() {
|
||||
final Activity activity = getActivity();
|
||||
return new AlertDialog.Builder(activity)
|
||||
.setView(mConnectingActor.createConnectView())
|
||||
.setTitle(String.format(activity.getString(R.string.vpn_connect_to),
|
||||
mActiveProfile.getName()))
|
||||
.setPositiveButton(activity.getString(R.string.vpn_connect_button),
|
||||
this)
|
||||
.setNegativeButton(activity.getString(android.R.string.cancel),
|
||||
this)
|
||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
removeDialog(DIALOG_CONNECT);
|
||||
changeState(mActiveProfile, VpnState.IDLE);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
return new ConnectDialog(getActivity());
|
||||
}
|
||||
|
||||
private Dialog createReconnectDialog(int id) {
|
||||
|
Reference in New Issue
Block a user