Merge "Fix broken data retry" into honeycomb-LTE
This commit is contained in:
@@ -927,37 +927,43 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dc = findReadyDataConnection(apn);
|
// First, check to see if ApnContext already has DC.
|
||||||
|
// This could happen if the retries are currently engaged.
|
||||||
|
dc = (GsmDataConnection)apnContext.getDataConnection();
|
||||||
|
|
||||||
if (dc == null) {
|
if (dc == null) {
|
||||||
if (DBG) log("setupData: No ready GsmDataConnection found!");
|
dc = findReadyDataConnection(apn);
|
||||||
// TODO: When allocating you are mapping type to id. If more than 1 free,
|
|
||||||
// then could findFreeDataConnection get the wrong one??
|
|
||||||
dc = findFreeDataConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dc == null) {
|
if (dc == null) {
|
||||||
dc = createDataConnection();
|
if (DBG) log("setupData: No ready GsmDataConnection found!");
|
||||||
}
|
// TODO: When allocating you are mapping type to id. If more than 1 free,
|
||||||
|
// then could findFreeDataConnection get the wrong one??
|
||||||
|
dc = findFreeDataConnection();
|
||||||
|
}
|
||||||
|
|
||||||
if (dc == null) {
|
if (dc == null) {
|
||||||
if (DBG) log("setupData: No free GsmDataConnection found!");
|
dc = createDataConnection();
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
dc.setProfileId( profileId );
|
if (dc == null) {
|
||||||
dc.setActiveApnType(apnContext.getApnType());
|
if (DBG) log("setupData: No free GsmDataConnection found!");
|
||||||
int refCount = dc.incAndGetRefCount();
|
return false;
|
||||||
if (DBG) log("setupData: init dc and apnContext refCount=" + refCount);
|
}
|
||||||
|
|
||||||
// configure retry count if no other Apn is using the same connection.
|
dc.setProfileId( profileId );
|
||||||
if (refCount == 1) {
|
dc.setActiveApnType(apnContext.getApnType());
|
||||||
configureRetry(dc, apnContext.getApnType());
|
int refCount = dc.incAndGetRefCount();
|
||||||
|
if (DBG) log("setupData: init dc and apnContext refCount=" + refCount);
|
||||||
|
|
||||||
|
// configure retry count if no other Apn is using the same connection.
|
||||||
|
if (refCount == 1) {
|
||||||
|
configureRetry(dc, apnContext.getApnType());
|
||||||
|
}
|
||||||
|
DataConnectionAc dcac = mDataConnectionAsyncChannels.get(dc.getDataConnectionId());
|
||||||
|
apnContext.setDataConnectionAc(mDataConnectionAsyncChannels.get(dc.getDataConnectionId()));
|
||||||
|
apnContext.setApnSetting(apn);
|
||||||
|
apnContext.setDataConnection(dc);
|
||||||
}
|
}
|
||||||
DataConnectionAc dcac = mDataConnectionAsyncChannels.get(dc.getDataConnectionId());
|
|
||||||
apnContext.setDataConnectionAc(mDataConnectionAsyncChannels.get(dc.getDataConnectionId()));
|
|
||||||
apnContext.setApnSetting(apn);
|
|
||||||
apnContext.setDataConnection(dc);
|
|
||||||
|
|
||||||
Message msg = obtainMessage();
|
Message msg = obtainMessage();
|
||||||
msg.what = EVENT_DATA_SETUP_COMPLETE;
|
msg.what = EVENT_DATA_SETUP_COMPLETE;
|
||||||
@@ -1655,6 +1661,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
apnContext.setState(State.FAILED);
|
apnContext.setState(State.FAILED);
|
||||||
mPhone.notifyDataConnection(Phone.REASON_APN_FAILED, apnContext.getApnType());
|
mPhone.notifyDataConnection(Phone.REASON_APN_FAILED, apnContext.getApnType());
|
||||||
|
|
||||||
|
int refCount = releaseApnContext(apnContext, false);
|
||||||
|
if (DBG) {
|
||||||
|
log("onDataSetupComplete: permanent error apn=%s" + apnString +
|
||||||
|
" refCount=" + refCount);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
|
if (DBG) log("onDataSetupComplete: Not all permanent failures, retry");
|
||||||
startDelayedRetry(cause, apnContext);
|
startDelayedRetry(cause, apnContext);
|
||||||
@@ -1667,11 +1679,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, apnContext),
|
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, apnContext),
|
||||||
APN_DELAY_MILLIS);
|
APN_DELAY_MILLIS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int refCount = releaseApnContext(apnContext, false);
|
|
||||||
if (DBG) {
|
|
||||||
log("onDataSetupComplete: error apn=%s" + apnString + " refCount=" + refCount);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user