Merge change 1831 into donut

* changes:
  Tear down data, if a disconnect request is pending.
This commit is contained in:
Android (Google) Code Review
2009-05-15 17:41:30 -07:00

View File

@@ -95,16 +95,20 @@ public class PdpConnection extends DataConnection {
apn.password, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE)); apn.password, obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE));
} }
private void tearDownData(Message msg) {
if (dataLink != null) {
dataLink.disconnect();
}
if (phone.mCM.getRadioState().isOn()) {
phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, msg));
}
}
protected void disconnect(Message msg) { protected void disconnect(Message msg) {
onDisconnect = msg; onDisconnect = msg;
if (state == State.ACTIVE) { if (state == State.ACTIVE) {
if (dataLink != null) { tearDownData(msg);
dataLink.disconnect();
}
if (phone.mCM.getRadioState().isOn()) {
phone.mCM.deactivateDataCall(cid, obtainMessage(EVENT_DEACTIVATE_DONE, msg));
}
} else if (state == State.ACTIVATING) { } else if (state == State.ACTIVATING) {
receivedDisconnectReq = true; receivedDisconnectReq = true;
} else { } else {
@@ -243,7 +247,7 @@ public class PdpConnection extends DataConnection {
// Don't bother reporting success if there's already a // Don't bother reporting success if there's already a
// pending disconnect request, since DataConnectionTracker // pending disconnect request, since DataConnectionTracker
// has already updated its state. // has already updated its state.
disconnect(onDisconnect); tearDownData(onDisconnect);
} else { } else {
String[] response = ((String[]) ar.result); String[] response = ((String[]) ar.result);
cid = Integer.parseInt(response[0]); cid = Integer.parseInt(response[0]);