Loading src/java/com/android/internal/telephony/data/DataNetworkController.java +3 −0 Original line number Diff line number Diff line Loading @@ -2153,7 +2153,10 @@ public class DataNetworkController extends Handler { evaluation.getDataAllowedReason()); } else { loge("onDataNetworkSetupRetry: Not able to find a suitable data profile to retry."); dataSetupRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } } else { dataSetupRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } } Loading tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +51 −0 Original line number Diff line number Diff line Loading @@ -1352,6 +1352,57 @@ public class DataNetworkControllerTest extends TelephonyTest { any(), any(), anyBoolean(), any(Message.class)); } @Test public void testSetupDataNetworkRetryFailed() { mDataNetworkControllerUT.getDataRetryManager() .registerCallback(mMockedDataRetryManagerCallback); setFailedSetupDataResponse(mMockedWwanDataServiceManager, DataFailCause.CONGESTION, DataCallResponse.RETRY_DURATION_UNDEFINED); mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET)); processAllMessages(); verify(mMockedWwanDataServiceManager, times(1)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); // Process first retry moveTimeForward(2500); processAllMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); ArgumentCaptor<DataRetryManager.DataSetupRetryEntry> retryEntry = ArgumentCaptor.forClass(DataRetryManager.DataSetupRetryEntry.class); verify(mMockedDataRetryManagerCallback, times(1)) .onDataNetworkSetupRetry(retryEntry.capture()); assertThat(retryEntry.getValue().getState()).isEqualTo( DataRetryManager.DataRetryEntry.RETRY_STATE_FAILED); // Cause data network setup failed due to RADIO_DISABLED_BY_CARRIER doReturn(false).when(mSST).getPowerStateFromCarrier(); // Process second retry and ensure data network setup failed moveTimeForward(3000); processAllMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); verify(mMockedDataRetryManagerCallback, times(2)) .onDataNetworkSetupRetry(retryEntry.capture()); assertThat(retryEntry.getValue().getState()).isEqualTo( DataRetryManager.DataRetryEntry.RETRY_STATE_FAILED); // Data network setup allowed again doReturn(true).when(mSST).getPowerStateFromCarrier(); // Should not retry again after retry failure processAllFutureMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); } @Test public void testSetupDataNetworkPermanentFailure() { setFailedSetupDataResponse(mMockedWwanDataServiceManager, DataFailCause.PROTOCOL_ERRORS, Loading Loading
src/java/com/android/internal/telephony/data/DataNetworkController.java +3 −0 Original line number Diff line number Diff line Loading @@ -2153,7 +2153,10 @@ public class DataNetworkController extends Handler { evaluation.getDataAllowedReason()); } else { loge("onDataNetworkSetupRetry: Not able to find a suitable data profile to retry."); dataSetupRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } } else { dataSetupRetryEntry.setState(DataRetryEntry.RETRY_STATE_FAILED); } } Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataNetworkControllerTest.java +51 −0 Original line number Diff line number Diff line Loading @@ -1352,6 +1352,57 @@ public class DataNetworkControllerTest extends TelephonyTest { any(), any(), anyBoolean(), any(Message.class)); } @Test public void testSetupDataNetworkRetryFailed() { mDataNetworkControllerUT.getDataRetryManager() .registerCallback(mMockedDataRetryManagerCallback); setFailedSetupDataResponse(mMockedWwanDataServiceManager, DataFailCause.CONGESTION, DataCallResponse.RETRY_DURATION_UNDEFINED); mDataNetworkControllerUT.addNetworkRequest( createNetworkRequest(NetworkCapabilities.NET_CAPABILITY_INTERNET)); processAllMessages(); verify(mMockedWwanDataServiceManager, times(1)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); // Process first retry moveTimeForward(2500); processAllMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); ArgumentCaptor<DataRetryManager.DataSetupRetryEntry> retryEntry = ArgumentCaptor.forClass(DataRetryManager.DataSetupRetryEntry.class); verify(mMockedDataRetryManagerCallback, times(1)) .onDataNetworkSetupRetry(retryEntry.capture()); assertThat(retryEntry.getValue().getState()).isEqualTo( DataRetryManager.DataRetryEntry.RETRY_STATE_FAILED); // Cause data network setup failed due to RADIO_DISABLED_BY_CARRIER doReturn(false).when(mSST).getPowerStateFromCarrier(); // Process second retry and ensure data network setup failed moveTimeForward(3000); processAllMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); verify(mMockedDataRetryManagerCallback, times(2)) .onDataNetworkSetupRetry(retryEntry.capture()); assertThat(retryEntry.getValue().getState()).isEqualTo( DataRetryManager.DataRetryEntry.RETRY_STATE_FAILED); // Data network setup allowed again doReturn(true).when(mSST).getPowerStateFromCarrier(); // Should not retry again after retry failure processAllFutureMessages(); verify(mMockedWwanDataServiceManager, times(2)).setupDataCall(anyInt(), any(DataProfile.class), anyBoolean(), anyBoolean(), anyInt(), any(), anyInt(), any(), any(), anyBoolean(), any(Message.class)); } @Test public void testSetupDataNetworkPermanentFailure() { setFailedSetupDataResponse(mMockedWwanDataServiceManager, DataFailCause.PROTOCOL_ERRORS, Loading