Fix the state machine for CONNECTING/DISCONNECTING states.
This commit is contained in:
@@ -239,7 +239,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||||
public void onCancel(DialogInterface dialog) {
|
public void onCancel(DialogInterface dialog) {
|
||||||
removeDialog(DIALOG_CONNECT);
|
removeDialog(DIALOG_CONNECT);
|
||||||
onIdle();
|
changeState(mActiveProfile, VpnState.IDLE);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
@@ -451,7 +451,6 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
Dialog d = (Dialog) dialog;
|
Dialog d = (Dialog) dialog;
|
||||||
String error = mConnectingActor.validateInputs(d);
|
String error = mConnectingActor.validateInputs(d);
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
changeState(mActiveProfile, VpnState.CONNECTING);
|
|
||||||
mConnectingActor.connect(d);
|
mConnectingActor.connect(d);
|
||||||
removeDialog(DIALOG_CONNECT);
|
removeDialog(DIALOG_CONNECT);
|
||||||
return;
|
return;
|
||||||
@@ -475,7 +474,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeDialog(DIALOG_CONNECT);
|
removeDialog(DIALOG_CONNECT);
|
||||||
onIdle();
|
changeState(mActiveProfile, VpnState.IDLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,13 +689,11 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
if (!unlockKeystore(p, action)) return;
|
if (!unlockKeystore(p, action)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mConnectingActor = getActor(p);
|
|
||||||
mActiveProfile = p;
|
|
||||||
if (!checkSecrets(p)) return;
|
if (!checkSecrets(p)) return;
|
||||||
|
changeState(p, VpnState.CONNECTING);
|
||||||
if (mConnectingActor.isConnectDialogNeeded()) {
|
if (mConnectingActor.isConnectDialogNeeded()) {
|
||||||
showDialog(DIALOG_CONNECT);
|
showDialog(DIALOG_CONNECT);
|
||||||
} else {
|
} else {
|
||||||
changeState(p, VpnState.CONNECTING);
|
|
||||||
mConnectingActor.connect(null);
|
mConnectingActor.connect(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -737,7 +734,10 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONNECTING:
|
case CONNECTING:
|
||||||
|
mConnectingActor = getActor(p);
|
||||||
|
// pass through
|
||||||
case DISCONNECTING:
|
case DISCONNECTING:
|
||||||
|
mActiveProfile = p;
|
||||||
disableProfilePreferencesIfOneActive();
|
disableProfilePreferencesIfOneActive();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -976,6 +976,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (secretMissing) {
|
if (secretMissing) {
|
||||||
|
mActiveProfile = p;
|
||||||
showDialog(DIALOG_SECRET_NOT_SET);
|
showDialog(DIALOG_SECRET_NOT_SET);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user