Loading src/java/com/android/internal/telephony/data/DataEvaluation.java +5 −10 Original line number Diff line number Diff line Loading @@ -145,18 +145,13 @@ public class DataEvaluation { } /** * Check if only the given reasons present in the disallowed reasons if there are any. * Check if only one disallowed reason prevent data connection. * * @param reasons The given reasons to check * @return {@code true} if the disallowed reasons contain no disallowed reasons other than the * given reasons. */ public boolean containsOnly(DataDisallowedReason... reasons) { int matched = 0; for (DataDisallowedReason requestedReason : reasons) { if (mDataDisallowedReasons.contains(requestedReason)) matched++; } return matched == mDataDisallowedReasons.size(); * @param reason The given reason to check * @return {@code true} if the given reason is the only one that prevents data connection */ public boolean containsOnly(DataDisallowedReason reason) { return mDataDisallowedReasons.size() == 1 && contains(reason); } /** Loading src/java/com/android/internal/telephony/data/DataNetworkController.java +6 −7 Original line number Diff line number Diff line Loading @@ -3236,18 +3236,16 @@ public class DataNetworkController extends Handler { logl("Start handover " + dataNetwork + " to " + AccessNetworkConstants.transportTypeToString(targetTransport)); dataNetwork.startHandover(targetTransport, dataHandoverRetryEntry); } else if (dataNetwork.shouldDelayImsTearDownDueToInCall() && dataEvaluation.containsOnly( DataDisallowedReason.NOT_IN_SERVICE, DataDisallowedReason.NOT_ALLOWED_BY_POLICY)) { // We try our best to preserve the voice call by retrying later } else if (dataEvaluation.containsOnly(DataDisallowedReason.NOT_IN_SERVICE) && dataNetwork.shouldDelayImsTearDownDueToInCall()) { // We try to preserve voice call in the case of temporary preferred transport mismatch if (dataHandoverRetryEntry != null) { dataHandoverRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } mDataRetryManager.evaluateDataHandoverRetry(dataNetwork, DataFailCause.HANDOVER_FAILED, DataCallResponse.RETRY_DURATION_UNDEFINED /* retry mills */); logl("tryHandoverDataNetwork: Scheduled retry due to in voice call"); logl("tryHandoverDataNetwork: Scheduled retry due to in voice call and target OOS"); } else if (dataEvaluation.containsAny(DataDisallowedReason.NOT_ALLOWED_BY_POLICY, DataDisallowedReason.NOT_IN_SERVICE, DataDisallowedReason.VOPS_NOT_SUPPORTED)) { Loading @@ -3256,7 +3254,8 @@ public class DataNetworkController extends Handler { + AccessNetworkConstants.transportTypeToString(targetTransport)); tearDownGracefully(dataNetwork, DataNetwork.TEAR_DOWN_REASON_HANDOVER_NOT_ALLOWED); } else if (dataEvaluation.containsAny(DataDisallowedReason.ILLEGAL_STATE)) { } else if (dataEvaluation.containsAny(DataDisallowedReason.ILLEGAL_STATE, DataDisallowedReason.RETRY_SCHEDULED)) { logl("tryHandoverDataNetwork: Handover not allowed. " + dataNetwork + " will remain on " + AccessNetworkConstants.transportTypeToString( dataNetwork.getTransport())); Loading tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +3 −30 Original line number Diff line number Diff line Loading @@ -2459,7 +2459,9 @@ public class DataNetworkControllerTest extends TelephonyTest { new String[]{"source=EUTRAN, target=IWLAN, type=disallowed, capabilities=MMS|IMS", "source=IWLAN, target=EUTRAN, type=disallowed, capabilities=MMS"}); // Force data config manager to reload the carrier config. carrierConfigChanged(); mDataNetworkControllerUT.getDataConfigManager().obtainMessage( 1/*EVENT_CARRIER_CONFIG_CHANGED*/).sendToTarget(); processAllMessages(); testSetupImsDataNetwork(); Loading Loading @@ -2498,35 +2500,6 @@ public class DataNetworkControllerTest extends TelephonyTest { any()); } @Test public void testHandoverDataNetworkNotAllowedByPolicyDelayDueToVoiceCall() throws Exception { // Config delay IMS tear down enabled mCarrierConfig.putBoolean(CarrierConfigManager.KEY_DELAY_IMS_TEAR_DOWN_UNTIL_CALL_END_BOOL, true); mCarrierConfig.putStringArray(CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, new String[]{"source=EUTRAN, target=IWLAN, type=disallowed, capabilities=MMS|IMS"}); carrierConfigChanged(); testSetupImsDataNetwork(); // Ringing an active call, should delay handover tear down doReturn(PhoneConstants.State.RINGING).when(mCT).getState(); updateTransport(NetworkCapabilities.NET_CAPABILITY_IMS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN); // Verify network is still connected due to active voice call verify(mMockedWwanDataServiceManager, never()).deactivateDataCall(anyInt(), eq(DataService.REQUEST_REASON_NORMAL), any(Message.class)); // Verify tear down after call ends doReturn(PhoneConstants.State.IDLE).when(mCT).getState(); mDataNetworkControllerUT.obtainMessage(EVENT_VOICE_CALL_ENDED).sendToTarget(); processAllFutureMessages(); verify(mMockedWwanDataServiceManager).deactivateDataCall(anyInt(), eq(DataService.REQUEST_REASON_NORMAL), any(Message.class)); } @Test public void testHandoverDataNetworkNotAllowedByRoamingPolicy() throws Exception { mCarrierConfig.putStringArray(CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, Loading Loading
src/java/com/android/internal/telephony/data/DataEvaluation.java +5 −10 Original line number Diff line number Diff line Loading @@ -145,18 +145,13 @@ public class DataEvaluation { } /** * Check if only the given reasons present in the disallowed reasons if there are any. * Check if only one disallowed reason prevent data connection. * * @param reasons The given reasons to check * @return {@code true} if the disallowed reasons contain no disallowed reasons other than the * given reasons. */ public boolean containsOnly(DataDisallowedReason... reasons) { int matched = 0; for (DataDisallowedReason requestedReason : reasons) { if (mDataDisallowedReasons.contains(requestedReason)) matched++; } return matched == mDataDisallowedReasons.size(); * @param reason The given reason to check * @return {@code true} if the given reason is the only one that prevents data connection */ public boolean containsOnly(DataDisallowedReason reason) { return mDataDisallowedReasons.size() == 1 && contains(reason); } /** Loading
src/java/com/android/internal/telephony/data/DataNetworkController.java +6 −7 Original line number Diff line number Diff line Loading @@ -3236,18 +3236,16 @@ public class DataNetworkController extends Handler { logl("Start handover " + dataNetwork + " to " + AccessNetworkConstants.transportTypeToString(targetTransport)); dataNetwork.startHandover(targetTransport, dataHandoverRetryEntry); } else if (dataNetwork.shouldDelayImsTearDownDueToInCall() && dataEvaluation.containsOnly( DataDisallowedReason.NOT_IN_SERVICE, DataDisallowedReason.NOT_ALLOWED_BY_POLICY)) { // We try our best to preserve the voice call by retrying later } else if (dataEvaluation.containsOnly(DataDisallowedReason.NOT_IN_SERVICE) && dataNetwork.shouldDelayImsTearDownDueToInCall()) { // We try to preserve voice call in the case of temporary preferred transport mismatch if (dataHandoverRetryEntry != null) { dataHandoverRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } mDataRetryManager.evaluateDataHandoverRetry(dataNetwork, DataFailCause.HANDOVER_FAILED, DataCallResponse.RETRY_DURATION_UNDEFINED /* retry mills */); logl("tryHandoverDataNetwork: Scheduled retry due to in voice call"); logl("tryHandoverDataNetwork: Scheduled retry due to in voice call and target OOS"); } else if (dataEvaluation.containsAny(DataDisallowedReason.NOT_ALLOWED_BY_POLICY, DataDisallowedReason.NOT_IN_SERVICE, DataDisallowedReason.VOPS_NOT_SUPPORTED)) { Loading @@ -3256,7 +3254,8 @@ public class DataNetworkController extends Handler { + AccessNetworkConstants.transportTypeToString(targetTransport)); tearDownGracefully(dataNetwork, DataNetwork.TEAR_DOWN_REASON_HANDOVER_NOT_ALLOWED); } else if (dataEvaluation.containsAny(DataDisallowedReason.ILLEGAL_STATE)) { } else if (dataEvaluation.containsAny(DataDisallowedReason.ILLEGAL_STATE, DataDisallowedReason.RETRY_SCHEDULED)) { logl("tryHandoverDataNetwork: Handover not allowed. " + dataNetwork + " will remain on " + AccessNetworkConstants.transportTypeToString( dataNetwork.getTransport())); Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +3 −30 Original line number Diff line number Diff line Loading @@ -2459,7 +2459,9 @@ public class DataNetworkControllerTest extends TelephonyTest { new String[]{"source=EUTRAN, target=IWLAN, type=disallowed, capabilities=MMS|IMS", "source=IWLAN, target=EUTRAN, type=disallowed, capabilities=MMS"}); // Force data config manager to reload the carrier config. carrierConfigChanged(); mDataNetworkControllerUT.getDataConfigManager().obtainMessage( 1/*EVENT_CARRIER_CONFIG_CHANGED*/).sendToTarget(); processAllMessages(); testSetupImsDataNetwork(); Loading Loading @@ -2498,35 +2500,6 @@ public class DataNetworkControllerTest extends TelephonyTest { any()); } @Test public void testHandoverDataNetworkNotAllowedByPolicyDelayDueToVoiceCall() throws Exception { // Config delay IMS tear down enabled mCarrierConfig.putBoolean(CarrierConfigManager.KEY_DELAY_IMS_TEAR_DOWN_UNTIL_CALL_END_BOOL, true); mCarrierConfig.putStringArray(CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, new String[]{"source=EUTRAN, target=IWLAN, type=disallowed, capabilities=MMS|IMS"}); carrierConfigChanged(); testSetupImsDataNetwork(); // Ringing an active call, should delay handover tear down doReturn(PhoneConstants.State.RINGING).when(mCT).getState(); updateTransport(NetworkCapabilities.NET_CAPABILITY_IMS, AccessNetworkConstants.TRANSPORT_TYPE_WLAN); // Verify network is still connected due to active voice call verify(mMockedWwanDataServiceManager, never()).deactivateDataCall(anyInt(), eq(DataService.REQUEST_REASON_NORMAL), any(Message.class)); // Verify tear down after call ends doReturn(PhoneConstants.State.IDLE).when(mCT).getState(); mDataNetworkControllerUT.obtainMessage(EVENT_VOICE_CALL_ENDED).sendToTarget(); processAllFutureMessages(); verify(mMockedWwanDataServiceManager).deactivateDataCall(anyInt(), eq(DataService.REQUEST_REASON_NORMAL), any(Message.class)); } @Test public void testHandoverDataNetworkNotAllowedByRoamingPolicy() throws Exception { mCarrierConfig.putStringArray(CarrierConfigManager.KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, Loading