Loading src/java/com/android/internal/telephony/dataconnection/ApnContext.java +2 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ public class ApnContext { } else { mLocalLogs.add(log); mNetworkRequests.add(networkRequest); mDcTracker.setEnabled(ApnSetting.getApnTypesBitmaskFromString(mApnType), true); mDcTracker.enableApn(ApnSetting.getApnTypesBitmaskFromString(mApnType)); } } } Loading @@ -439,7 +439,7 @@ public class ApnContext { log.log("ApnContext.releaseNetwork left with " + mNetworkRequests.size() + " requests."); if (mNetworkRequests.size() == 0) { mDcTracker.setEnabled(ApnSetting.getApnTypesBitmaskFromString(mApnType), false); mDcTracker.disableApn(ApnSetting.getApnTypesBitmaskFromString(mApnType)); } } } Loading src/java/com/android/internal/telephony/dataconnection/DcTracker.java +114 −91 Original line number Diff line number Diff line Loading @@ -2117,83 +2117,6 @@ public class DcTracker extends Handler { setDataProfilesAsNeeded(); } private void applyNewState(ApnContext apnContext, boolean enabled) { boolean cleanup = false; boolean trySetup = false; boolean met = apnContext.isDependencyMet(); String str = "applyNewState(" + apnContext.getApnType() + ", " + enabled + "(" + apnContext.isEnabled() + "), " + met + "(" + apnContext.isDependencyMet() + "))"; if (DBG) log(str); apnContext.requestLog(str); if (apnContext.isReady()) { cleanup = true; if (enabled && met) { DctConstants.State state = apnContext.getState(); switch(state) { case CONNECTING: case CONNECTED: case DISCONNECTING: // We're "READY" and active so just return if (DBG) log("applyNewState: 'ready' so return"); apnContext.requestLog("applyNewState state=" + state + ", so return"); return; case IDLE: // fall through: this is unexpected but if it happens cleanup and try setup case FAILED: case RETRYING: // We're "READY" but not active so disconnect (cleanup = true) and // connect (trySetup = true) to be sure we retry the connection. trySetup = true; apnContext.setReason(Phone.REASON_DATA_ENABLED); break; } } else if (met) { apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL); // If ConnectivityService has disabled this network, stop trying to bring // it up, but do not tear it down - ConnectivityService will do that // directly by talking with the DataConnection. // // This doesn't apply to DUN, however. Those connections have special // requirements from carriers and we need stop using them when the dun // request goes away. This applies to both CDMA and GSM because they both // can declare the DUN APN sharable by default traffic, thus still satisfying // those requests and not torn down organically. if ((apnContext.getApnType() == PhoneConstants.APN_TYPE_DUN && teardownForDun()) || apnContext.getState() != DctConstants.State.CONNECTED) { str = "Clean up the connection. Apn type = " + apnContext.getApnType() + ", state = " + apnContext.getState(); if (DBG) log(str); apnContext.requestLog(str); cleanup = true; } else { cleanup = false; } } else { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); } } else { if (enabled && met) { if (apnContext.isEnabled()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_MET); } else { apnContext.setReason(Phone.REASON_DATA_ENABLED); } if (apnContext.getState() == DctConstants.State.FAILED) { apnContext.setState(DctConstants.State.IDLE); } trySetup = true; } } apnContext.setEnabled(enabled); if (cleanup) cleanUpConnectionInternal(true, apnContext); if (trySetup) { apnContext.resetErrorCodeRetries(); trySetupData(apnContext); } } private DataConnection checkForCompatibleConnectedApnContext(ApnContext apnContext) { int apnType = apnContext.getApnTypeBitmask(); ArrayList<ApnSetting> dunSettings = null; Loading Loading @@ -2269,28 +2192,125 @@ public class DcTracker extends Handler { return null; } public void setEnabled(int apnType, boolean enable) { Message msg = obtainMessage(DctConstants.EVENT_ENABLE_NEW_APN); public void enableApn(int apnType) { Message msg = obtainMessage(DctConstants.EVENT_ENABLE_APN); msg.arg1 = apnType; sendMessage(msg); } private void onEnableApn(int apnType) { ApnContext apnContext = mApnContextsByType.get(apnType); if (apnContext == null) { loge("onEnableApn(" + apnType + "): NO ApnContext"); return; } boolean trySetup = false; String str = "onEnableApn: apnType=" + ApnSetting.getApnTypeString(apnType); if (DBG) log(str); apnContext.requestLog(str); if (!apnContext.isDependencyMet()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); apnContext.setEnabled(true); str = "onEnableApn: dependency is not met."; if (DBG) log(str); apnContext.requestLog(str); return; } if (apnContext.isReady()) { DctConstants.State state = apnContext.getState(); switch(state) { case CONNECTING: case CONNECTED: case DISCONNECTING: // We're "READY" and active so just return if (DBG) log("onEnableApn: 'ready' so return"); apnContext.requestLog("onEnableApn state=" + state + ", so return"); return; case IDLE: // fall through: this is unexpected but if it happens cleanup and try setup case FAILED: case RETRYING: // We're "READY" but not active so disconnect (cleanup = true) and // connect (trySetup = true) to be sure we retry the connection. trySetup = true; apnContext.setReason(Phone.REASON_DATA_ENABLED); break; } } else { if (apnContext.isEnabled()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_MET); } else { apnContext.setReason(Phone.REASON_DATA_ENABLED); } if (apnContext.getState() == DctConstants.State.FAILED) { apnContext.setState(DctConstants.State.IDLE); } trySetup = true; } apnContext.setEnabled(true); if (trySetup) { apnContext.resetErrorCodeRetries(); trySetupData(apnContext); } } public void disableApn(int apnType) { Message msg = obtainMessage(DctConstants.EVENT_DISABLE_APN); msg.arg1 = apnType; msg.arg2 = (enable ? DctConstants.ENABLED : DctConstants.DISABLED); sendMessage(msg); } private void onEnableApn(int apnType, int enabled) { private void onDisableApn(int apnType) { ApnContext apnContext = mApnContextsByType.get(apnType); if (apnContext == null) { loge("onEnableApn(" + apnType + ", " + enabled + "): NO ApnContext"); loge("disableApn(" + apnType + "): NO ApnContext"); return; } // TODO change our retry manager to use the appropriate numbers for the new APN if (DBG) log("onEnableApn: apnContext=" + apnContext + " call applyNewState"); applyNewState(apnContext, enabled == DctConstants.ENABLED); if ((enabled == DctConstants.DISABLED) && isOnlySingleDcAllowed(mPhone.getServiceState().getRilDataRadioTechnology()) && !isHigherPriorityApnContextActive(apnContext)) { boolean cleanup = false; String str = "onDisableApn: apnType=" + ApnSetting.getApnTypeString(apnType); if (DBG) log(str); apnContext.requestLog(str); if(DBG) log("onEnableApn: isOnlySingleDcAllowed true & higher priority APN disabled"); if (apnContext.isReady()) { cleanup = true; if (apnContext.isDependencyMet()) { apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL); // If ConnectivityService has disabled this network, stop trying to bring // it up, but do not tear it down - ConnectivityService will do that // directly by talking with the DataConnection. // // This doesn't apply to DUN, however. Those connections have special // requirements from carriers and we need stop using them when the dun // request goes away. This applies to both CDMA and GSM because they both // can declare the DUN APN sharable by default traffic, thus still satisfying // those requests and not torn down organically. if ((PhoneConstants.APN_TYPE_DUN.equals(apnContext.getApnType()) && teardownForDun()) || apnContext.getState() != DctConstants.State.CONNECTED) { str = "Clean up the connection. Apn type = " + apnContext.getApnType() + ", state = " + apnContext.getState(); if (DBG) log(str); apnContext.requestLog(str); } else { cleanup = false; } } else { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); } } apnContext.setEnabled(false); if (cleanup) { cleanUpConnectionInternal(true, apnContext); } if (isOnlySingleDcAllowed(mPhone.getServiceState().getRilDataRadioTechnology()) && !isHigherPriorityApnContextActive(apnContext)) { if (DBG) log("disableApn:isOnlySingleDcAllowed true & higher priority APN disabled"); // If the highest priority APN is disabled and only single // data call is allowed, try to setup data call on other connectable APN. setupDataOnConnectableApns(Phone.REASON_SINGLE_PDN_ARBITRATION, RetryFailures.ALWAYS); Loading Loading @@ -3396,8 +3416,11 @@ public class DcTracker extends Handler { mProvisioningSpinner = null; } break; case DctConstants.EVENT_ENABLE_NEW_APN: onEnableApn(msg.arg1, msg.arg2); case DctConstants.EVENT_ENABLE_APN: onEnableApn(msg.arg1); break; case DctConstants.EVENT_DISABLE_APN: onDisableApn(msg.arg1); break; case DctConstants.EVENT_DATA_STALL_ALARM: Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/ApnContextTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -119,14 +119,14 @@ public class ApnContextTest extends TelephonyTest { NetworkRequest nr = new NetworkRequest.Builder().build(); mApnContext.requestNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(true)); verify(mDcTracker, times(1)).enableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.requestNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(true)); verify(mDcTracker, times(1)).enableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.releaseNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(false)); verify(mDcTracker, times(1)).disableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.releaseNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(false)); verify(mDcTracker, times(1)).disableApn(eq(ApnSetting.TYPE_DEFAULT)); } @Test Loading tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java +14 −14 Original line number Diff line number Diff line Loading @@ -580,9 +580,9 @@ public class DcTrackerTest extends TelephonyTest { mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null)); waitForMs(200); logd("Sending EVENT_ENABLE_NEW_APN"); logd("Sending EVENT_ENABLE_APN"); // APN id 0 is APN_TYPE_DEFAULT mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); waitForMs(200); dataConnectionReasons = new DataConnectionReasons(); Loading Loading @@ -629,9 +629,9 @@ public class DcTrackerTest extends TelephonyTest { mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null)); waitForMs(200); logd("Sending EVENT_ENABLE_NEW_APN"); logd("Sending EVENT_ENABLE_APN"); // APN id 0 is APN_TYPE_DEFAULT mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); waitForMs(200); dataConnectionReasons = new DataConnectionReasons(); Loading Loading @@ -685,8 +685,8 @@ public class DcTrackerTest extends TelephonyTest { //set Default and MMS to be metered in the CarrierConfigManager mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -734,8 +734,8 @@ public class DcTrackerTest extends TelephonyTest { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -786,8 +786,8 @@ public class DcTrackerTest extends TelephonyTest { //set Default and MMS to be metered in the CarrierConfigManager mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending DISABLE_ROAMING_CMD"); mDct.setDataRoamingEnabledByUser(false); Loading Loading @@ -898,8 +898,8 @@ public class DcTrackerTest extends TelephonyTest { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -1187,7 +1187,7 @@ public class DcTrackerTest extends TelephonyTest { .getRilDataRadioTechnology(); mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT}); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); initApns(PhoneConstants.APN_TYPE_DEFAULT, new String[]{PhoneConstants.APN_TYPE_ALL}); logd("Sending EVENT_RECORDS_LOADED"); Loading Loading @@ -1307,7 +1307,7 @@ public class DcTrackerTest extends TelephonyTest { .getRilDataRadioTechnology(); mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT}); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); initApns(PhoneConstants.APN_TYPE_DEFAULT, new String[]{PhoneConstants.APN_TYPE_ALL}); logd("Sending EVENT_RECORDS_LOADED"); Loading Loading
src/java/com/android/internal/telephony/dataconnection/ApnContext.java +2 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ public class ApnContext { } else { mLocalLogs.add(log); mNetworkRequests.add(networkRequest); mDcTracker.setEnabled(ApnSetting.getApnTypesBitmaskFromString(mApnType), true); mDcTracker.enableApn(ApnSetting.getApnTypesBitmaskFromString(mApnType)); } } } Loading @@ -439,7 +439,7 @@ public class ApnContext { log.log("ApnContext.releaseNetwork left with " + mNetworkRequests.size() + " requests."); if (mNetworkRequests.size() == 0) { mDcTracker.setEnabled(ApnSetting.getApnTypesBitmaskFromString(mApnType), false); mDcTracker.disableApn(ApnSetting.getApnTypesBitmaskFromString(mApnType)); } } } Loading
src/java/com/android/internal/telephony/dataconnection/DcTracker.java +114 −91 Original line number Diff line number Diff line Loading @@ -2117,83 +2117,6 @@ public class DcTracker extends Handler { setDataProfilesAsNeeded(); } private void applyNewState(ApnContext apnContext, boolean enabled) { boolean cleanup = false; boolean trySetup = false; boolean met = apnContext.isDependencyMet(); String str = "applyNewState(" + apnContext.getApnType() + ", " + enabled + "(" + apnContext.isEnabled() + "), " + met + "(" + apnContext.isDependencyMet() + "))"; if (DBG) log(str); apnContext.requestLog(str); if (apnContext.isReady()) { cleanup = true; if (enabled && met) { DctConstants.State state = apnContext.getState(); switch(state) { case CONNECTING: case CONNECTED: case DISCONNECTING: // We're "READY" and active so just return if (DBG) log("applyNewState: 'ready' so return"); apnContext.requestLog("applyNewState state=" + state + ", so return"); return; case IDLE: // fall through: this is unexpected but if it happens cleanup and try setup case FAILED: case RETRYING: // We're "READY" but not active so disconnect (cleanup = true) and // connect (trySetup = true) to be sure we retry the connection. trySetup = true; apnContext.setReason(Phone.REASON_DATA_ENABLED); break; } } else if (met) { apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL); // If ConnectivityService has disabled this network, stop trying to bring // it up, but do not tear it down - ConnectivityService will do that // directly by talking with the DataConnection. // // This doesn't apply to DUN, however. Those connections have special // requirements from carriers and we need stop using them when the dun // request goes away. This applies to both CDMA and GSM because they both // can declare the DUN APN sharable by default traffic, thus still satisfying // those requests and not torn down organically. if ((apnContext.getApnType() == PhoneConstants.APN_TYPE_DUN && teardownForDun()) || apnContext.getState() != DctConstants.State.CONNECTED) { str = "Clean up the connection. Apn type = " + apnContext.getApnType() + ", state = " + apnContext.getState(); if (DBG) log(str); apnContext.requestLog(str); cleanup = true; } else { cleanup = false; } } else { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); } } else { if (enabled && met) { if (apnContext.isEnabled()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_MET); } else { apnContext.setReason(Phone.REASON_DATA_ENABLED); } if (apnContext.getState() == DctConstants.State.FAILED) { apnContext.setState(DctConstants.State.IDLE); } trySetup = true; } } apnContext.setEnabled(enabled); if (cleanup) cleanUpConnectionInternal(true, apnContext); if (trySetup) { apnContext.resetErrorCodeRetries(); trySetupData(apnContext); } } private DataConnection checkForCompatibleConnectedApnContext(ApnContext apnContext) { int apnType = apnContext.getApnTypeBitmask(); ArrayList<ApnSetting> dunSettings = null; Loading Loading @@ -2269,28 +2192,125 @@ public class DcTracker extends Handler { return null; } public void setEnabled(int apnType, boolean enable) { Message msg = obtainMessage(DctConstants.EVENT_ENABLE_NEW_APN); public void enableApn(int apnType) { Message msg = obtainMessage(DctConstants.EVENT_ENABLE_APN); msg.arg1 = apnType; sendMessage(msg); } private void onEnableApn(int apnType) { ApnContext apnContext = mApnContextsByType.get(apnType); if (apnContext == null) { loge("onEnableApn(" + apnType + "): NO ApnContext"); return; } boolean trySetup = false; String str = "onEnableApn: apnType=" + ApnSetting.getApnTypeString(apnType); if (DBG) log(str); apnContext.requestLog(str); if (!apnContext.isDependencyMet()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); apnContext.setEnabled(true); str = "onEnableApn: dependency is not met."; if (DBG) log(str); apnContext.requestLog(str); return; } if (apnContext.isReady()) { DctConstants.State state = apnContext.getState(); switch(state) { case CONNECTING: case CONNECTED: case DISCONNECTING: // We're "READY" and active so just return if (DBG) log("onEnableApn: 'ready' so return"); apnContext.requestLog("onEnableApn state=" + state + ", so return"); return; case IDLE: // fall through: this is unexpected but if it happens cleanup and try setup case FAILED: case RETRYING: // We're "READY" but not active so disconnect (cleanup = true) and // connect (trySetup = true) to be sure we retry the connection. trySetup = true; apnContext.setReason(Phone.REASON_DATA_ENABLED); break; } } else { if (apnContext.isEnabled()) { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_MET); } else { apnContext.setReason(Phone.REASON_DATA_ENABLED); } if (apnContext.getState() == DctConstants.State.FAILED) { apnContext.setState(DctConstants.State.IDLE); } trySetup = true; } apnContext.setEnabled(true); if (trySetup) { apnContext.resetErrorCodeRetries(); trySetupData(apnContext); } } public void disableApn(int apnType) { Message msg = obtainMessage(DctConstants.EVENT_DISABLE_APN); msg.arg1 = apnType; msg.arg2 = (enable ? DctConstants.ENABLED : DctConstants.DISABLED); sendMessage(msg); } private void onEnableApn(int apnType, int enabled) { private void onDisableApn(int apnType) { ApnContext apnContext = mApnContextsByType.get(apnType); if (apnContext == null) { loge("onEnableApn(" + apnType + ", " + enabled + "): NO ApnContext"); loge("disableApn(" + apnType + "): NO ApnContext"); return; } // TODO change our retry manager to use the appropriate numbers for the new APN if (DBG) log("onEnableApn: apnContext=" + apnContext + " call applyNewState"); applyNewState(apnContext, enabled == DctConstants.ENABLED); if ((enabled == DctConstants.DISABLED) && isOnlySingleDcAllowed(mPhone.getServiceState().getRilDataRadioTechnology()) && !isHigherPriorityApnContextActive(apnContext)) { boolean cleanup = false; String str = "onDisableApn: apnType=" + ApnSetting.getApnTypeString(apnType); if (DBG) log(str); apnContext.requestLog(str); if(DBG) log("onEnableApn: isOnlySingleDcAllowed true & higher priority APN disabled"); if (apnContext.isReady()) { cleanup = true; if (apnContext.isDependencyMet()) { apnContext.setReason(Phone.REASON_DATA_DISABLED_INTERNAL); // If ConnectivityService has disabled this network, stop trying to bring // it up, but do not tear it down - ConnectivityService will do that // directly by talking with the DataConnection. // // This doesn't apply to DUN, however. Those connections have special // requirements from carriers and we need stop using them when the dun // request goes away. This applies to both CDMA and GSM because they both // can declare the DUN APN sharable by default traffic, thus still satisfying // those requests and not torn down organically. if ((PhoneConstants.APN_TYPE_DUN.equals(apnContext.getApnType()) && teardownForDun()) || apnContext.getState() != DctConstants.State.CONNECTED) { str = "Clean up the connection. Apn type = " + apnContext.getApnType() + ", state = " + apnContext.getState(); if (DBG) log(str); apnContext.requestLog(str); } else { cleanup = false; } } else { apnContext.setReason(Phone.REASON_DATA_DEPENDENCY_UNMET); } } apnContext.setEnabled(false); if (cleanup) { cleanUpConnectionInternal(true, apnContext); } if (isOnlySingleDcAllowed(mPhone.getServiceState().getRilDataRadioTechnology()) && !isHigherPriorityApnContextActive(apnContext)) { if (DBG) log("disableApn:isOnlySingleDcAllowed true & higher priority APN disabled"); // If the highest priority APN is disabled and only single // data call is allowed, try to setup data call on other connectable APN. setupDataOnConnectableApns(Phone.REASON_SINGLE_PDN_ARBITRATION, RetryFailures.ALWAYS); Loading Loading @@ -3396,8 +3416,11 @@ public class DcTracker extends Handler { mProvisioningSpinner = null; } break; case DctConstants.EVENT_ENABLE_NEW_APN: onEnableApn(msg.arg1, msg.arg2); case DctConstants.EVENT_ENABLE_APN: onEnableApn(msg.arg1); break; case DctConstants.EVENT_DISABLE_APN: onDisableApn(msg.arg1); break; case DctConstants.EVENT_DATA_STALL_ALARM: Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/ApnContextTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -119,14 +119,14 @@ public class ApnContextTest extends TelephonyTest { NetworkRequest nr = new NetworkRequest.Builder().build(); mApnContext.requestNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(true)); verify(mDcTracker, times(1)).enableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.requestNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(true)); verify(mDcTracker, times(1)).enableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.releaseNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(false)); verify(mDcTracker, times(1)).disableApn(eq(ApnSetting.TYPE_DEFAULT)); mApnContext.releaseNetwork(nr, log); verify(mDcTracker, times(1)).setEnabled(eq(ApnSetting.TYPE_DEFAULT), eq(false)); verify(mDcTracker, times(1)).disableApn(eq(ApnSetting.TYPE_DEFAULT)); } @Test Loading
tests/telephonytests/src/com/android/internal/telephony/dataconnection/DcTrackerTest.java +14 −14 Original line number Diff line number Diff line Loading @@ -580,9 +580,9 @@ public class DcTrackerTest extends TelephonyTest { mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null)); waitForMs(200); logd("Sending EVENT_ENABLE_NEW_APN"); logd("Sending EVENT_ENABLE_APN"); // APN id 0 is APN_TYPE_DEFAULT mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); waitForMs(200); dataConnectionReasons = new DataConnectionReasons(); Loading Loading @@ -629,9 +629,9 @@ public class DcTrackerTest extends TelephonyTest { mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_CONNECTION_ATTACHED, null)); waitForMs(200); logd("Sending EVENT_ENABLE_NEW_APN"); logd("Sending EVENT_ENABLE_APN"); // APN id 0 is APN_TYPE_DEFAULT mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); waitForMs(200); dataConnectionReasons = new DataConnectionReasons(); Loading Loading @@ -685,8 +685,8 @@ public class DcTrackerTest extends TelephonyTest { //set Default and MMS to be metered in the CarrierConfigManager mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -734,8 +734,8 @@ public class DcTrackerTest extends TelephonyTest { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -786,8 +786,8 @@ public class DcTrackerTest extends TelephonyTest { //set Default and MMS to be metered in the CarrierConfigManager mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_ROAMING_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending DISABLE_ROAMING_CMD"); mDct.setDataRoamingEnabledByUser(false); Loading Loading @@ -898,8 +898,8 @@ public class DcTrackerTest extends TelephonyTest { mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT, PhoneConstants.APN_TYPE_MMS}); mDct.setEnabled(ApnSetting.TYPE_IMS, true); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_IMS); mDct.enableApn(ApnSetting.TYPE_DEFAULT); logd("Sending EVENT_RECORDS_LOADED"); mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_RECORDS_LOADED, null)); Loading Loading @@ -1187,7 +1187,7 @@ public class DcTrackerTest extends TelephonyTest { .getRilDataRadioTechnology(); mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT}); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); initApns(PhoneConstants.APN_TYPE_DEFAULT, new String[]{PhoneConstants.APN_TYPE_ALL}); logd("Sending EVENT_RECORDS_LOADED"); Loading Loading @@ -1307,7 +1307,7 @@ public class DcTrackerTest extends TelephonyTest { .getRilDataRadioTechnology(); mBundle.putStringArray(CarrierConfigManager.KEY_CARRIER_METERED_APN_TYPES_STRINGS, new String[]{PhoneConstants.APN_TYPE_DEFAULT}); mDct.setEnabled(ApnSetting.TYPE_DEFAULT, true); mDct.enableApn(ApnSetting.TYPE_DEFAULT); initApns(PhoneConstants.APN_TYPE_DEFAULT, new String[]{PhoneConstants.APN_TYPE_ALL}); logd("Sending EVENT_RECORDS_LOADED"); Loading