Loading telephony/java/com/android/internal/telephony/ApnContext.java +6 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,12 @@ public class ApnContext { return mState; } public boolean isDisconnected() { DataConnectionTracker.State currentState = getState(); return ((currentState == DataConnectionTracker.State.IDLE) || currentState == DataConnectionTracker.State.FAILED); } public synchronized void setReason(String reason) { if (DBG) { log("set reason as " + reason + ", for type " + mApnType + ",current state " + mState); Loading telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +19 −10 Original line number Diff line number Diff line Loading @@ -787,9 +787,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } DataConnectionAc dcac = apnContext.getDataConnectionAc(); if (tearDown) { boolean isConnected = (apnContext.getState() != State.IDLE && apnContext.getState() != State.FAILED); if (!isConnected) { if (apnContext.isDisconnected()) { // The request is tearDown and but ApnContext is not connected. // If apnContext is not enabled anymore, break the linkage to the DCAC/DC. apnContext.setState(State.IDLE); Loading Loading @@ -1019,11 +1017,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { */ private void onApnChanged() { // TODO: How to handle when multiple APNs are active? boolean isConnected; ApnContext defaultApnContext = mApnContexts.get(Phone.APN_TYPE_DEFAULT); isConnected = (defaultApnContext.getState() != State.IDLE && defaultApnContext.getState() != State.FAILED); boolean defaultApnIsDisconnected = defaultApnContext.isDisconnected(); if (mPhone instanceof GSMPhone) { // The "current" may no longer be valid. MMS depends on this to send properly. TBD Loading @@ -1034,8 +1030,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // match the current operator. if (DBG) log("onApnChanged: createAllApnList and cleanUpAllConnections"); createAllApnList(); cleanUpAllConnections(isConnected, Phone.REASON_APN_CHANGED); if (!isConnected) { cleanUpAllConnections(!defaultApnIsDisconnected, Phone.REASON_APN_CHANGED); if (defaultApnIsDisconnected) { setupDataOnReadyApns(Phone.REASON_APN_CHANGED); } } Loading Loading @@ -1885,7 +1881,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // if all data connection are gone, check whether Airplane mode request was // pending. if (!isConnected()) { if (isDisconnected()) { if (mPhone.getServiceStateTracker().processPendingRadioPowerOffAfterDataOff()) { // Radio will be turned off. No need to retry data setup apnContext.setApnSetting(null); Loading Loading @@ -1957,12 +1953,25 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected boolean isConnected() { for (ApnContext apnContext : mApnContexts.values()) { if (apnContext.getState() == State.CONNECTED) { // At least one context is connected, return true return true; } } // There are not any contexts connected, return false return false; } protected boolean isDisconnected() { for (ApnContext apnContext : mApnContexts.values()) { if (!apnContext.isDisconnected()) { // At least one context was not disconnected return false return false; } } // All contexts were disconnected so return true return true; } @Override protected void notifyDataConnection(String reason) { if (DBG) log("notifyDataConnection: reason=" + reason); Loading Loading
telephony/java/com/android/internal/telephony/ApnContext.java +6 −0 Original line number Diff line number Diff line Loading @@ -154,6 +154,12 @@ public class ApnContext { return mState; } public boolean isDisconnected() { DataConnectionTracker.State currentState = getState(); return ((currentState == DataConnectionTracker.State.IDLE) || currentState == DataConnectionTracker.State.FAILED); } public synchronized void setReason(String reason) { if (DBG) { log("set reason as " + reason + ", for type " + mApnType + ",current state " + mState); Loading
telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +19 −10 Original line number Diff line number Diff line Loading @@ -787,9 +787,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { } DataConnectionAc dcac = apnContext.getDataConnectionAc(); if (tearDown) { boolean isConnected = (apnContext.getState() != State.IDLE && apnContext.getState() != State.FAILED); if (!isConnected) { if (apnContext.isDisconnected()) { // The request is tearDown and but ApnContext is not connected. // If apnContext is not enabled anymore, break the linkage to the DCAC/DC. apnContext.setState(State.IDLE); Loading Loading @@ -1019,11 +1017,9 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { */ private void onApnChanged() { // TODO: How to handle when multiple APNs are active? boolean isConnected; ApnContext defaultApnContext = mApnContexts.get(Phone.APN_TYPE_DEFAULT); isConnected = (defaultApnContext.getState() != State.IDLE && defaultApnContext.getState() != State.FAILED); boolean defaultApnIsDisconnected = defaultApnContext.isDisconnected(); if (mPhone instanceof GSMPhone) { // The "current" may no longer be valid. MMS depends on this to send properly. TBD Loading @@ -1034,8 +1030,8 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // match the current operator. if (DBG) log("onApnChanged: createAllApnList and cleanUpAllConnections"); createAllApnList(); cleanUpAllConnections(isConnected, Phone.REASON_APN_CHANGED); if (!isConnected) { cleanUpAllConnections(!defaultApnIsDisconnected, Phone.REASON_APN_CHANGED); if (defaultApnIsDisconnected) { setupDataOnReadyApns(Phone.REASON_APN_CHANGED); } } Loading Loading @@ -1885,7 +1881,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // if all data connection are gone, check whether Airplane mode request was // pending. if (!isConnected()) { if (isDisconnected()) { if (mPhone.getServiceStateTracker().processPendingRadioPowerOffAfterDataOff()) { // Radio will be turned off. No need to retry data setup apnContext.setApnSetting(null); Loading Loading @@ -1957,12 +1953,25 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { protected boolean isConnected() { for (ApnContext apnContext : mApnContexts.values()) { if (apnContext.getState() == State.CONNECTED) { // At least one context is connected, return true return true; } } // There are not any contexts connected, return false return false; } protected boolean isDisconnected() { for (ApnContext apnContext : mApnContexts.values()) { if (!apnContext.isDisconnected()) { // At least one context was not disconnected return false return false; } } // All contexts were disconnected so return true return true; } @Override protected void notifyDataConnection(String reason) { if (DBG) log("notifyDataConnection: reason=" + reason); Loading