diff options
| author | Wink Saville <wink@google.com> | 2010-11-17 15:50:50 -0800 |
|---|---|---|
| committer | Wink Saville <wink@google.com> | 2010-11-17 15:50:50 -0800 |
| commit | 076113130608a3def67bc71809527b34ba1e3888 (patch) | |
| tree | 532eb0383764fb8576d231f8f0a3456befa42906 /telephony/java | |
| parent | 0dcea08af30465407201a77d660a8b7500a024b5 (diff) | |
| download | frameworks_base-076113130608a3def67bc71809527b34ba1e3888.zip frameworks_base-076113130608a3def67bc71809527b34ba1e3888.tar.gz frameworks_base-076113130608a3def67bc71809527b34ba1e3888.tar.bz2 | |
Fix GSM permanent failure handling.
Wait until all APN's have been tried before checking for permanent errors
and then, don't do retires only if all of the APN's had permanent errors.
Also, don't disable the requested apn type because if we do we won't
be able to setup data because there won't be an apn type.
This was tested by creating a new non existent APN, I chose:
Name="badapn1"
APN="badapn1"
Server="noapn.com"
Then selecting "badapn1" will cause a permanent error.
bug: 3202729
Change-Id: I0a2160a852c5dcdd07ae06f93b3b77c29406af4b
Diffstat (limited to 'telephony/java')
| -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 |
