am ac4ff895: Merge "Special retry back-off timer in call setup failure." into honeycomb-LTE
* commit 'ac4ff8958eced1c56a2e9571dd754c98eaa43108': Special retry back-off timer in call setup failure.
This commit is contained in:
@@ -47,6 +47,7 @@ public class DataCallState {
|
||||
public String [] addresses = new String[0];
|
||||
public String [] dnses = new String[0];
|
||||
public String[] gateways = new String[0];
|
||||
public int suggestedRetryTime = -1;
|
||||
|
||||
/**
|
||||
* Class returned by onSetupConnectionCompleted.
|
||||
@@ -77,6 +78,7 @@ public class DataCallState {
|
||||
sb.append("DataCallState: {")
|
||||
.append("version=").append(version)
|
||||
.append(" status=").append(status)
|
||||
.append(" retry=").append(suggestedRetryTime)
|
||||
.append(" cid=").append(cid)
|
||||
.append(" active=").append(active)
|
||||
.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
|
||||
protected static final int BASE = Protocol.BASE_DATA_CONNECTION;
|
||||
protected static final int EVENT_CONNECT = BASE + 0;
|
||||
@@ -205,6 +217,7 @@ public abstract class DataConnection extends StateMachine {
|
||||
protected long createTime;
|
||||
protected long lastFailTime;
|
||||
protected FailCause lastFailCause;
|
||||
protected int mRetryOverride = -1;
|
||||
protected static final String NULL_IP = "0.0.0.0";
|
||||
private int mRefCount;
|
||||
Object userData;
|
||||
@@ -288,7 +301,8 @@ public abstract class DataConnection extends StateMachine {
|
||||
} else {
|
||||
lastFailCause = cause;
|
||||
lastFailTime = timeStamp;
|
||||
AsyncResult.forMessage(connectionCompletedMsg, cause, new Exception());
|
||||
AsyncResult.forMessage(connectionCompletedMsg, cause,
|
||||
new CallSetupException(mRetryOverride));
|
||||
}
|
||||
if (DBG) log("notifyConnectionCompleted at " + timeStamp + " cause=" + cause);
|
||||
|
||||
@@ -430,6 +444,7 @@ public abstract class DataConnection extends StateMachine {
|
||||
createTime = -1;
|
||||
lastFailTime = -1;
|
||||
lastFailCause = FailCause.NONE;
|
||||
mRetryOverride = -1;
|
||||
mRefCount = 0;
|
||||
|
||||
mLinkProperties = new LinkProperties();
|
||||
@@ -482,6 +497,15 @@ public abstract class DataConnection extends StateMachine {
|
||||
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,
|
||||
LinkProperties lp) {
|
||||
// Check if system property dns usable
|
||||
@@ -685,10 +709,12 @@ public abstract class DataConnection extends StateMachine {
|
||||
private FailCause mFailCause = 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");
|
||||
mConnectionParams = cp;
|
||||
mFailCause = cause;
|
||||
mRetryOverride = retryOverride;
|
||||
}
|
||||
|
||||
public void setEnterNotificationParams(DisconnectParams dp) {
|
||||
@@ -808,7 +834,7 @@ public abstract class DataConnection extends StateMachine {
|
||||
// Vendor ril rejected the command and didn't connect.
|
||||
// Transition to inactive but send notifications after
|
||||
// we've entered the mInactive state.
|
||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
|
||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause, -1);
|
||||
transitionTo(mInactiveState);
|
||||
break;
|
||||
case ERR_UnacceptableParameter:
|
||||
@@ -823,7 +849,8 @@ public abstract class DataConnection extends StateMachine {
|
||||
break;
|
||||
case ERR_RilError:
|
||||
// Request failed and mFailCause has the reason
|
||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause);
|
||||
mInactiveState.setEnterNotificationParams(cp, result.mFailCause,
|
||||
getSuggestedRetryTime(ar));
|
||||
transitionTo(mInactiveState);
|
||||
break;
|
||||
case ERR_Stale:
|
||||
@@ -848,8 +875,8 @@ public abstract class DataConnection extends StateMachine {
|
||||
}
|
||||
// Transition to inactive but send notifications after
|
||||
// we've entered the mInactive state.
|
||||
mInactiveState.setEnterNotificationParams(cp, cause);
|
||||
transitionTo(mInactiveState);
|
||||
mInactiveState.setEnterNotificationParams(cp, cause, -1);
|
||||
transitionTo(mInactiveState);
|
||||
} else {
|
||||
if (DBG) {
|
||||
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
|
||||
// we've entered the mInactive state.
|
||||
mInactiveState.setEnterNotificationParams(cp,
|
||||
FailCause.UNACCEPTABLE_NETWORK_PARAMETER);
|
||||
FailCause.UNACCEPTABLE_NETWORK_PARAMETER, -1);
|
||||
transitionTo(mInactiveState);
|
||||
} else {
|
||||
if (DBG) {
|
||||
|
||||
@@ -3010,6 +3010,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
||||
}
|
||||
} else {
|
||||
dataCall.status = p.readInt();
|
||||
dataCall.suggestedRetryTime = p.readInt();
|
||||
dataCall.cid = p.readInt();
|
||||
dataCall.active = p.readInt();
|
||||
dataCall.type = p.readString();
|
||||
|
||||
@@ -1332,7 +1332,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
return retry;
|
||||
}
|
||||
|
||||
private void reconnectAfterFail(FailCause lastFailCauseCode, ApnContext apnContext) {
|
||||
private void reconnectAfterFail(FailCause lastFailCauseCode,
|
||||
ApnContext apnContext, int retryOverride) {
|
||||
if (apnContext == null) {
|
||||
loge("reconnectAfterFail: apnContext == null, impossible");
|
||||
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);
|
||||
apnContext.getDataConnection().increaseRetryCount();
|
||||
|
||||
if (!shouldPostNotification(lastFailCauseCode)) {
|
||||
if (DBG) {
|
||||
@@ -1664,7 +1670,13 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
}
|
||||
} else {
|
||||
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 {
|
||||
if (DBG) log("onDataSetupComplete: Try next APN");
|
||||
@@ -1936,9 +1948,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
private void startDelayedRetry(GsmDataConnection.FailCause cause, ApnContext apnContext) {
|
||||
private void startDelayedRetry(GsmDataConnection.FailCause cause,
|
||||
ApnContext apnContext, int retryOverride) {
|
||||
notifyNoData(cause, apnContext);
|
||||
reconnectAfterFail(cause, apnContext);
|
||||
reconnectAfterFail(cause, apnContext, retryOverride);
|
||||
}
|
||||
|
||||
private void setPreferredApn(int pos) {
|
||||
|
||||
Reference in New Issue
Block a user