diff options
author | Robert Greenwalt <rgreenwalt@google.com> | 2011-05-06 14:52:45 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-05-06 14:52:45 -0700 |
commit | 2499da83cb3db5f1d87a52e3e390139c98ff4210 (patch) | |
tree | 0e7dc759e11284628f3fdd70c54ee21705dc1436 | |
parent | 6c6b62e04d1953916637be7fc96d83dde68da801 (diff) | |
parent | 51a8610f9ad7100194d9afe196e5477215645966 (diff) | |
download | frameworks_base-2499da83cb3db5f1d87a52e3e390139c98ff4210.zip frameworks_base-2499da83cb3db5f1d87a52e3e390139c98ff4210.tar.gz frameworks_base-2499da83cb3db5f1d87a52e3e390139c98ff4210.tar.bz2 |
Merge "Mark a disable apn so we don't reconnect." into honeycomb-LTE
-rw-r--r-- | telephony/java/com/android/internal/telephony/ApnContext.java | 15 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java | 40 |
2 files changed, 5 insertions, 50 deletions
diff --git a/telephony/java/com/android/internal/telephony/ApnContext.java b/telephony/java/com/android/internal/telephony/ApnContext.java index 010d61d..ce1a3b6 100644 --- a/telephony/java/com/android/internal/telephony/ApnContext.java +++ b/telephony/java/com/android/internal/telephony/ApnContext.java @@ -28,14 +28,8 @@ import java.util.concurrent.atomic.AtomicInteger; */ public class ApnContext { - public static final int PENDING_ACTION_NONE = 1; - public static final int PENDING_ACTION_RECONNECT = 2; - public static final int PENDING_ACTION_APN_DISABLE = 3; - public final String LOG_TAG; - private AtomicInteger mPendingAction; - protected static final boolean DBG = true; private final String mApnType; @@ -71,21 +65,12 @@ public class ApnContext { mApnType = apnType; mState = DataConnectionTracker.State.IDLE; setReason(Phone.REASON_DATA_ENABLED); - mPendingAction = new AtomicInteger(PENDING_ACTION_NONE); mDataEnabled = new AtomicBoolean(false); mDependencyMet = new AtomicBoolean(true); mWaitingApnsPermanentFailureCountDown = new AtomicInteger(0); LOG_TAG = logTag; } - public int getPendingAction() { - return mPendingAction.get(); - } - - public void setPendingAction(int pa) { - mPendingAction.set(pa); - } - public String getApnType() { return mApnType; } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index d3e659a..21c644d 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -457,20 +457,10 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // If already active, return if (DBG) log("enableApnType: " + apnType + " mState(" + apnContext.getState() + ")"); - if (apnContext.getState() == State.INITING) { - if (DBG) log("enableApnType: return APN_REQUEST_STARTED"); - return Phone.APN_REQUEST_STARTED; - } - else if (apnContext.getState() == State.CONNECTED) { + if (apnContext.getState() == State.CONNECTED) { if (DBG) log("enableApnType: return APN_ALREADY_ACTIVE"); return Phone.APN_ALREADY_ACTIVE; } - else if (apnContext.getState() == State.DISCONNECTING) { - if (DBG) log("enableApnType: while disconnecting, return APN_REQUEST_STARTED"); - apnContext.setPendingAction(ApnContext.PENDING_ACTION_RECONNECT); - return Phone.APN_REQUEST_STARTED; - } - setEnabled(apnTypeToId(apnType), true); if (DBG) { log("enableApnType: new apn request for type " + apnType + @@ -504,21 +494,12 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { ApnContext apnContext = mApnContexts.get(type); if (apnContext != null) { + setEnabled(apnTypeToId(type), false); if (apnContext.getState() != State.IDLE && apnContext.getState() != State.FAILED) { - apnContext.setPendingAction(ApnContext.PENDING_ACTION_APN_DISABLE); - Message msg = obtainMessage(EVENT_CLEAN_UP_CONNECTION); - msg.arg1 = 1; // tearDown is true; - // TODO - don't set things on apnContext from public functions. - // Maybe pass reason as arg2? - apnContext.setReason(Phone.REASON_DATA_DISABLED); - msg.obj = apnContext; - sendMessage(msg); if (DBG) log("diableApnType: return APN_REQUEST_STARTED"); return Phone.APN_REQUEST_STARTED; } else { if (DBG) log("disableApnType: return APN_ALREADY_INACTIVE"); - apnContext.setEnabled(false); - apnContext.setDataConnection(null); return Phone.APN_ALREADY_INACTIVE; } @@ -565,10 +546,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } private boolean isDataAllowed(ApnContext apnContext) { - if(apnContext.getState() == State.DISCONNECTING - && apnContext.getPendingAction() == ApnContext.PENDING_ACTION_APN_DISABLE) { - return false; - } return apnContext.isReady() && isDataAllowed(); } @@ -1327,7 +1304,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { if (apnContext.getState() == State.FAILED) { if (!apnContext.getDataConnection().isRetryNeeded()) { if (!apnContext.getApnType().equals(Phone.APN_TYPE_DEFAULT)) { - notifyDataConnection(Phone.REASON_APN_FAILED); + mPhone.notifyDataConnection(Phone.REASON_APN_FAILED, apnContext.getApnType()); return; } if (mReregisterOnReconnectFailure) { @@ -1645,7 +1622,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { log("onDataSetupComplete: All APN's had permanent failures, stop retrying"); } apnContext.setState(State.FAILED); - notifyDataConnection(Phone.REASON_APN_FAILED); + mPhone.notifyDataConnection(Phone.REASON_APN_FAILED, apnContext.getApnType()); } else { if (DBG) log("onDataSetupComplete: Not all permanent failures, retry"); startDelayedRetry(cause, apnContext); @@ -1684,10 +1661,6 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { apnContext.setState(State.IDLE); apnContext.setApnSetting(null); - // Check if APN disabled. - if (apnContext.getPendingAction() == ApnContext.PENDING_ACTION_APN_DISABLE) { - apnContext.setPendingAction(ApnContext.PENDING_ACTION_NONE); - } mPhone.notifyDataConnection(apnContext.getReason(), apnContext.getApnType()); // if all data connection are gone, check whether Airplane mode request was @@ -1701,10 +1674,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // If APN is still enabled, try to bring it back up automatically if (apnContext.isReady() && retryAfterDisconnected(apnContext.getReason())) { - SystemProperties.set("gsm.defaultpdpcontext.active", "false"); - if (apnContext.getPendingAction() == ApnContext.PENDING_ACTION_RECONNECT) { - apnContext.setPendingAction(ApnContext.PENDING_ACTION_NONE); - } + SystemProperties.set("gsm.defaultpdpcontext.active", "false"); // TODO - what the heck? This shoudld go // Wait a bit before trying the next APN, so that // we're not tying up the RIL command channel. // This also helps in any external dependency to turn off the context. |