Merge "Data Retry fix after failure due to permanent causes." into honeycomb-LTE
This commit is contained in:
@@ -42,7 +42,8 @@ public class ApnContext {
|
|||||||
|
|
||||||
ArrayList<ApnSetting> mWaitingApns = null;
|
ArrayList<ApnSetting> mWaitingApns = null;
|
||||||
|
|
||||||
private int mWaitingApnsPermanentFailureCountDown = 0;
|
/** A zero indicates that all waiting APNs had a permanent error */
|
||||||
|
private int mWaitingApnsPermanentFailureCountDown;
|
||||||
|
|
||||||
ApnSetting mApnSetting;
|
ApnSetting mApnSetting;
|
||||||
|
|
||||||
@@ -68,14 +69,6 @@ public class ApnContext {
|
|||||||
pendingAction = pa;
|
pendingAction = pa;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPermFailCount() {
|
|
||||||
return mWaitingApnsPermanentFailureCountDown;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void decPermFailCount() {
|
|
||||||
mWaitingApnsPermanentFailureCountDown--;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getApnType() {
|
public String getApnType() {
|
||||||
return mApnType;
|
return mApnType;
|
||||||
}
|
}
|
||||||
@@ -98,9 +91,18 @@ public class ApnContext {
|
|||||||
|
|
||||||
public void setWaitingApns(ArrayList<ApnSetting> waitingApns) {
|
public void setWaitingApns(ArrayList<ApnSetting> waitingApns) {
|
||||||
mWaitingApns = waitingApns;
|
mWaitingApns = waitingApns;
|
||||||
|
mWaitingApnsPermanentFailureCountDown = mWaitingApns.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApnSetting getNextApn() {
|
public int getWaitingApnsPermFailCount() {
|
||||||
|
return mWaitingApnsPermanentFailureCountDown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void decWaitingApnsPermFailCount() {
|
||||||
|
mWaitingApnsPermanentFailureCountDown--;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApnSetting getNextWaitingApn() {
|
||||||
ArrayList<ApnSetting> list = mWaitingApns;
|
ArrayList<ApnSetting> list = mWaitingApns;
|
||||||
ApnSetting apn = null;
|
ApnSetting apn = null;
|
||||||
|
|
||||||
@@ -112,7 +114,7 @@ public class ApnContext {
|
|||||||
return apn;
|
return apn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeNextApn() {
|
public void removeNextWaitingApn() {
|
||||||
if ((mWaitingApns != null) && (!mWaitingApns.isEmpty())) {
|
if ((mWaitingApns != null) && (!mWaitingApns.isEmpty())) {
|
||||||
mWaitingApns.remove(0);
|
mWaitingApns.remove(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -574,9 +574,11 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean trySetupData(String reason, String type) {
|
private boolean trySetupData(String reason, String type) {
|
||||||
if (DBG)
|
if (DBG) {
|
||||||
log("***trySetupData for type:" + type+" due to " + (reason == null ? "(unspecified)" : reason));
|
log("***trySetupData for type:" + type +
|
||||||
log("[DSAC DEB] " + "trySetupData with mIsPsRestricted=" + mIsPsRestricted);
|
" due to " + (reason == null ? "(unspecified)" : reason) +
|
||||||
|
" isPsRestricted=" + mIsPsRestricted);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
type = Phone.APN_TYPE_DEFAULT;
|
type = Phone.APN_TYPE_DEFAULT;
|
||||||
@@ -585,12 +587,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
ApnContext apnContext = mApnContexts.get(type);
|
ApnContext apnContext = mApnContexts.get(type);
|
||||||
|
|
||||||
if (apnContext == null ){
|
if (apnContext == null ){
|
||||||
if (DBG) log("***new apn context for type:" + type);
|
if (DBG) log("new apn context for type:" + type);
|
||||||
apnContext = new ApnContext(type, LOG_TAG);
|
apnContext = new ApnContext(type, LOG_TAG);
|
||||||
if (apnContext == null) {
|
|
||||||
if (DBG) log("***new apn context failed ");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
mApnContexts.put(type, apnContext);
|
mApnContexts.put(type, apnContext);
|
||||||
}
|
}
|
||||||
apnContext.setReason(reason);
|
apnContext.setReason(reason);
|
||||||
@@ -839,7 +837,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
GsmDataConnection dc;
|
GsmDataConnection dc;
|
||||||
|
|
||||||
int profileId = getApnProfileID(apnContext.getApnType());
|
int profileId = getApnProfileID(apnContext.getApnType());
|
||||||
apn = apnContext.getNextApn();
|
apn = apnContext.getNextWaitingApn();
|
||||||
if (apn == null) {
|
if (apn == null) {
|
||||||
if (DBG) log("setupData: return for no apn found!");
|
if (DBG) log("setupData: return for no apn found!");
|
||||||
return false;
|
return false;
|
||||||
@@ -1449,19 +1447,22 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count permanent failures and remove the APN we just tried
|
// Count permanent failures and remove the APN we just tried
|
||||||
// TODO: Where is mWaitingApnsPermanentFailureCountDown initialized
|
if (cause.isPermanentFail()) apnContext.decWaitingApnsPermFailCount();
|
||||||
if (cause.isPermanentFail())
|
|
||||||
apnContext.decPermFailCount();
|
|
||||||
|
|
||||||
apnContext.removeNextApn();
|
apnContext.removeNextWaitingApn();
|
||||||
if (DBG) log(String.format("onDataSetupComplete: mWaitingApns.size=%d" +
|
if (DBG) {
|
||||||
" mWaitingApnsPermanenatFailureCountDown=%d",
|
log(String.format("onDataSetupComplete: WaitingApns.size=%d" +
|
||||||
apnContext.getWaitingApns().size(), apnContext.getPermFailCount()));
|
" WaitingApnsPermFailureCountDown=%d",
|
||||||
|
apnContext.getWaitingApns().size(),
|
||||||
|
apnContext.getWaitingApnsPermFailCount()));
|
||||||
|
}
|
||||||
|
|
||||||
// See if there are more APN's to try
|
// See if there are more APN's to try
|
||||||
if (apnContext.getWaitingApns().isEmpty()) {
|
if (apnContext.getWaitingApns().isEmpty()) {
|
||||||
if (apnContext.getPermFailCount() == 0) {
|
if (apnContext.getWaitingApnsPermFailCount() == 0) {
|
||||||
if (DBG) log("onDataSetupComplete: Permanent failures stop retrying");
|
if (DBG) {
|
||||||
|
log("onDataSetupComplete: All APN's had permanent failures, stop retrying");
|
||||||
|
}
|
||||||
apnContext.setState(State.FAILED);
|
apnContext.setState(State.FAILED);
|
||||||
notifyDataConnection(Phone.REASON_APN_FAILED);
|
notifyDataConnection(Phone.REASON_APN_FAILED);
|
||||||
} else {
|
} else {
|
||||||
@@ -1473,7 +1474,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker {
|
|||||||
apnContext.setState(State.SCANNING);
|
apnContext.setState(State.SCANNING);
|
||||||
// Wait a bit before trying the next APN, so that
|
// Wait a bit before trying the next APN, so that
|
||||||
// we're not tying up the RIL command channel
|
// we're not tying up the RIL command channel
|
||||||
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, apnContext), APN_DELAY_MILLIS);
|
sendMessageDelayed(obtainMessage(EVENT_TRY_SETUP_DATA, apnContext),
|
||||||
|
APN_DELAY_MILLIS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user