diff options
author | Wink Saville <wink@google.com> | 2010-11-17 17:17:28 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-11-17 17:17:28 -0800 |
commit | ae95eaeb432042c617e5d8667b2afa32edb47a68 (patch) | |
tree | 8e6b98ec08a3c28343b63e4ecee7a9a00d854f28 /telephony | |
parent | 73bfdfe07ac4f8d7fea49ddbbc929caaf2ab87aa (diff) | |
parent | 076113130608a3def67bc71809527b34ba1e3888 (diff) | |
download | frameworks_base-ae95eaeb432042c617e5d8667b2afa32edb47a68.zip frameworks_base-ae95eaeb432042c617e5d8667b2afa32edb47a68.tar.gz frameworks_base-ae95eaeb432042c617e5d8667b2afa32edb47a68.tar.bz2 |
Merge "Fix GSM permanent failure handling."
Diffstat (limited to 'telephony')
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index effb743..70328f7 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -106,7 +106,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { * It is a subset of allApns and has the same format */ private ArrayList<ApnSetting> mWaitingApns = null; - + private int mWaitingApnsPermanentFailureCountDown = 0; private ApnSetting mPreferredApn = null; /* Currently active APN */ @@ -361,6 +361,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (mState == State.IDLE) { mWaitingApns = buildWaitingApns(mRequestedApnType); + mWaitingApnsPermanentFailureCountDown = mWaitingApns.size(); if (mWaitingApns.isEmpty()) { if (DBG) log("No APN found"); notifyNoData(GsmDataConnection.FailCause.MISSING_UNKNOWN_APN); @@ -996,6 +997,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } if (ar.exception == null) { + if(DBG) { + log(String.format("onDataSetupComplete: success apn=%s", mWaitingApns.get(0).apn)); + } // TODO: We should clear LinkProperties/Capabilities when torn down or disconnected mLinkProperties = getLinkProperties(mPendingDataConnection); mLinkCapabilities = getLinkCapabilities(mPendingDataConnection); @@ -1047,27 +1051,32 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { log(String.format("onDataSetupComplete: error apn=%s cause=%s", apnString, cause)); } if (cause.isEventLoggable()) { + // Log this failure to the Event Logs. GsmCellLocation loc = ((GsmCellLocation)mPhone.getCellLocation()); EventLog.writeEvent(EventLogTags.PDP_SETUP_FAIL, cause.ordinal(), loc != null ? loc.getCid() : -1, TelephonyManager.getDefault().getNetworkType()); } - // Do not retry on permanent failure - // TODO: We should not fail permanently if more Apns to try! - if (cause.isPermanentFail()) { - notifyNoData(cause); - notifyDataConnection(Phone.REASON_APN_FAILED); - onEnableApn(apnTypeToId(mRequestedApnType), DISABLED); - return; - } - + // Count permanent failures and remove the APN we just tried + mWaitingApnsPermanentFailureCountDown -= cause.isPermanentFail() ? 1 : 0; mWaitingApns.remove(0); + if (DBG) log(String.format("onDataSetupComplete: mWaitingApns.size=%d" + + " mWaitingApnsPermanenatFailureCountDown=%d", + mWaitingApns.size(), mWaitingApnsPermanentFailureCountDown)); + + // See if there are more APN's to try if (mWaitingApns.isEmpty()) { - // No more to try, start delayed retry - startDelayedRetry(cause, reason); + if (mWaitingApnsPermanentFailureCountDown == 0) { + if (DBG) log("onDataSetupComplete: Permanent failures stop retrying"); + notifyNoData(cause); + notifyDataConnection(Phone.REASON_APN_FAILED); + } else { + if (DBG) log("onDataSetupComplete: Not all permanent failures, retry"); + startDelayedRetry(cause, reason); + } } else { - // we still have more apns to try + if (DBG) log("onDataSetupComplete: Try next APN"); setState(State.SCANNING); // Wait a bit before trying the next APN, so that // we're not tying up the RIL command channel |