Merge "Special retry back-off timer in call setup failure." into honeycomb-LTE
This commit is contained in:
@@ -47,6 +47,7 @@ public class DataCallState {
|
|||||||
public String [] addresses = new String[0];
|
public String [] addresses = new String[0];
|
||||||
public String [] dnses = new String[0];
|
public String [] dnses = new String[0];
|
||||||
public String[] gateways = new String[0];
|
public String[] gateways = new String[0];
|
||||||
|
public int suggestedRetryTime = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class returned by onSetupConnectionCompleted.
|
* Class returned by onSetupConnectionCompleted.
|
||||||
@@ -77,6 +78,7 @@ public class DataCallState {
|
|||||||
sb.append("DataCallState: {")
|
sb.append("DataCallState: {")
|
||||||
.append("version=").append(version)
|
.append("version=").append(version)
|
||||||
.append(" status=").append(status)
|
.append(" status=").append(status)
|
||||||
|
.append(" retry=").append(suggestedRetryTime)
|
||||||
.append(" cid=").append(cid)
|
.append(" cid=").append(cid)
|
||||||
.append(" active=").append(active)
|
.append(" active=").append(active)
|
||||||
.append(" type=").append(type)
|
.append(" type=").append(type)
|
||||||
|
|||||||
@@ -182,6 +182,18 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class CallSetupException extends Exception {
|
||||||
|
private int mRetryOverride = -1;
|
||||||
|
|
||||||
|
CallSetupException (int retryOverride) {
|
||||||
|
mRetryOverride = retryOverride;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRetryOverride() {
|
||||||
|
return mRetryOverride;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ***** Event codes for driving the state machine
|
// ***** Event codes for driving the state machine
|
||||||
protected static final int BASE = Protocol.BASE_DATA_CONNECTION;
|
protected static final int BASE = Protocol.BASE_DATA_CONNECTION;
|
||||||
protected static final int EVENT_CONNECT = BASE + 0;
|
protected static final int EVENT_CONNECT = BASE + 0;
|
||||||
@@ -205,6 +217,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
protected long createTime;
|
protected long createTime;
|
||||||
protected long lastFailTime;
|
protected long lastFailTime;
|
||||||
protected FailCause lastFailCause;
|
protected FailCause lastFailCause;
|
||||||
|
protected int mRetryOverride = -1;
|
||||||
protected static final String NULL_IP = "0.0.0.0";
|
protected static final String NULL_IP = "0.0.0.0";
|
||||||
private int mRefCount;
|
private int mRefCount;
|
||||||
Object userData;
|
Object userData;
|
||||||
@@ -288,7 +301,8 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
} else {
|
} else {
|
||||||
lastFailCause = cause;
|
lastFailCause = cause;
|
||||||
lastFailTime = timeStamp;
|
lastFailTime = timeStamp;
|
||||||
AsyncResult.forMessage(connectionCompletedMsg, cause, new Exception());
|
AsyncResult.forMessage(connectionCompletedMsg, cause,
|
||||||
|
new CallSetupException(mRetryOverride));
|
||||||
}
|
}
|
||||||
if (DBG) log("notifyConnectionCompleted at " + timeStamp + " cause=" + cause);
|
if (DBG) log("notifyConnectionCompleted at " + timeStamp + " cause=" + cause);
|
||||||
|
|
||||||
@@ -430,6 +444,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
createTime = -1;
|
createTime = -1;
|
||||||
lastFailTime = -1;
|
lastFailTime = -1;
|
||||||
lastFailCause = FailCause.NONE;
|
lastFailCause = FailCause.NONE;
|
||||||
|
mRetryOverride = -1;
|
||||||
mRefCount = 0;
|
mRefCount = 0;
|
||||||
|
|
||||||
mLinkProperties = new LinkProperties();
|
mLinkProperties = new LinkProperties();
|
||||||
@@ -482,6 +497,15 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getSuggestedRetryTime(AsyncResult ar) {
|
||||||
|
int retry = -1;
|
||||||
|
if (ar.exception == null) {
|
||||||
|
DataCallState response = (DataCallState) ar.result;
|
||||||
|
retry = response.suggestedRetryTime;
|
||||||
|
}
|
||||||
|
return retry;
|
||||||
|
}
|
||||||
|
|
||||||
private DataCallState.SetupResult setLinkProperties(DataCallState response,
|
private DataCallState.SetupResult setLinkProperties(DataCallState response,
|
||||||
LinkProperties lp) {
|
LinkProperties lp) {
|
||||||
// Check if system property dns usable
|
// Check if system property dns usable
|
||||||
@@ -685,10 +709,12 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
private FailCause mFailCause = null;
|
private FailCause mFailCause = null;
|
||||||
private DisconnectParams mDisconnectParams = null;
|
private DisconnectParams mDisconnectParams = null;
|
||||||
|
|
||||||
public void setEnterNotificationParams(ConnectionParams cp, FailCause cause) {
|
public void setEnterNotificationParams(ConnectionParams cp, FailCause cause,
|
||||||
|
int retryOverride) {
|
||||||
if (VDBG) log("DcInactiveState: setEnterNoticationParams cp,cause");
|
if (VDBG) log("DcInactiveState: setEnterNoticationParams cp,cause");
|
||||||
mConnectionParams = cp;
|
mConnectionParams = cp;
|
||||||
mFailCause = cause;
|
mFailCause = cause;
|
||||||
|
mRetryOverride = retryOverride;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnterNotificationParams(DisconnectParams dp) {
|
public void setEnterNotificationParams(DisconnectParams dp) {
|
||||||
@@ -808,7 +834,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
// Vendor ril rejected the command and didn't connect.
|
// Vendor ril rejected the command and didn't connect.
|
||||||
// Transition to inactive but send notifications after
|
// Transition to inactive but send notifications after
|
||||||
// we've entered the mInactive state.
|
// we've entered the mInactive state.
|
||||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
|
mInactiveState.setEnterNotificationParams(cp, result.mFailCause, -1);
|
||||||
transitionTo(mInactiveState);
|
transitionTo(mInactiveState);
|
||||||
break;
|
break;
|
||||||
case ERR_UnacceptableParameter:
|
case ERR_UnacceptableParameter:
|
||||||
@@ -823,7 +849,8 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
break;
|
break;
|
||||||
case ERR_RilError:
|
case ERR_RilError:
|
||||||
// Request failed and mFailCause has the reason
|
// Request failed and mFailCause has the reason
|
||||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
|
mInactiveState.setEnterNotificationParams(cp, result.mFailCause,
|
||||||
|
getSuggestedRetryTime(ar));
|
||||||
transitionTo(mInactiveState);
|
transitionTo(mInactiveState);
|
||||||
break;
|
break;
|
||||||
case ERR_Stale:
|
case ERR_Stale:
|
||||||
@@ -848,8 +875,8 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
}
|
}
|
||||||
// Transition to inactive but send notifications after
|
// Transition to inactive but send notifications after
|
||||||
// we've entered the mInactive state.
|
// we've entered the mInactive state.
|
||||||
mInactiveState.setEnterNotificationParams(cp, cause);
|
mInactiveState.setEnterNotificationParams(cp, cause, -1);
|
||||||
transitionTo(mInactiveState);
|
transitionTo(mInactiveState);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
log("DcActivatingState EVENT_GET_LAST_FAIL_DONE is stale cp.tag="
|
log("DcActivatingState EVENT_GET_LAST_FAIL_DONE is stale cp.tag="
|
||||||
@@ -1016,7 +1043,7 @@ public abstract class DataConnection extends StateMachine {
|
|||||||
// Transition to inactive but send notifications after
|
// Transition to inactive but send notifications after
|
||||||
// we've entered the mInactive state.
|
// we've entered the mInactive state.
|
||||||
mInactiveState.setEnterNotificationParams(cp,
|
mInactiveState.setEnterNotificationParams(cp,
|
||||||
FailCause.UNACCEPTABLE_NETWORK_PARAMETER);
|
FailCause.UNACCEPTABLE_NETWORK_PARAMETER, -1);
|
||||||
transitionTo(mInactiveState);
|
transitionTo(mInactiveState);
|
||||||
} else {
|
} else {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
|
|||||||
@@ -3010,6 +3010,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dataCall.status = p.readInt();
|
dataCall.status = p.readInt();
|
||||||
|
dataCall.suggestedRetryTime = p.readInt();
|
||||||
dataCall.cid = p.readInt();
|
dataCall.cid = p.readInt();
|
||||||
dataCall.active = p.readInt();
|
dataCall.active = p.readInt();
|
||||||
dataCall.type = p.readString();
|
dataCall.type = p.readString();
|
||||||
|
|||||||
@@ -1332,7 +1332,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return retry;
|
return retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reconnectAfterFail(FailCause lastFailCauseCode, ApnContext apnContext) {
|
private void reconnectAfterFail(FailCause lastFailCauseCode,
|
||||||
|
ApnContext apnContext, int retryOverride) {
|
||||||
if (apnContext == null) {
|
if (apnContext == null) {
|
||||||
loge("reconnectAfterFail: apnContext == null, impossible");
|
loge("reconnectAfterFail: apnContext == null, impossible");
|
||||||
return;
|
return;
|
||||||
@@ -1357,9 +1358,14 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextReconnectDelay = apnContext.getDataConnection().getRetryTimer();
|
// If retry needs to be backed off for specific case (determined by RIL/Modem)
|
||||||
|
// use the specified timer instead of pre-configured retry pattern.
|
||||||
|
int nextReconnectDelay = retryOverride;
|
||||||
|
if (nextReconnectDelay < 0) {
|
||||||
|
nextReconnectDelay = apnContext.getDataConnection().getRetryTimer();
|
||||||
|
apnContext.getDataConnection().increaseRetryCount();
|
||||||
|
}
|
||||||
startAlarmForReconnect(nextReconnectDelay, apnContext);
|
startAlarmForReconnect(nextReconnectDelay, apnContext);
|
||||||
apnContext.getDataConnection().increaseRetryCount();
|
|
||||||
|
|
||||||
if (!shouldPostNotification(lastFailCauseCode)) {
|
if (!shouldPostNotification(lastFailCauseCode)) {
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
@@ -1664,7 +1670,13 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
|
if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
|
||||||
startDelayedRetry(cause, apnContext);
|
// check to see if retry should be overridden for this failure.
|
||||||
|
int retryOverride = -1;
|
||||||
|
if (ar.exception instanceof DataConnection.CallSetupException) {
|
||||||
|
retryOverride =
|
||||||
|
((DataConnection.CallSetupException)ar.exception).getRetryOverride();
|
||||||
|
}
|
||||||
|
startDelayedRetry(cause, apnContext, retryOverride);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("onDataSetupComplete: Try next APN");
|
if (DBG) log("onDataSetupComplete: Try next APN");
|
||||||
@@ -1936,9 +1948,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return result.toString();
|
return result.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startDelayedRetry(GsmDataConnection.FailCause cause, ApnContext apnContext) {
|
private void startDelayedRetry(GsmDataConnection.FailCause cause,
|
||||||
|
ApnContext apnContext, int retryOverride) {
|
||||||
notifyNoData(cause, apnContext);
|
notifyNoData(cause, apnContext);
|
||||||
reconnectAfterFail(cause, apnContext);
|
reconnectAfterFail(cause, apnContext, retryOverride);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPreferredApn(int pos) {
|
private void setPreferredApn(int pos) {
|
||||||
|
|||||||
Reference in New Issue
Block a user