Loading src/java/com/android/internal/telephony/data/DataProfileManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,16 @@ public class DataProfileManager extends Handler { .build(); } /** * Called by {@link DataRetryManager} to clear all permanent failures upon reset. */ public void clearAllDataProfilePermanentFailures() { mAllDataProfiles.stream() .map(DataProfile::getApnSetting) .filter(Objects::nonNull) .forEach(apnSetting -> apnSetting.setPermanentFailed(false)); } /** * Check if the provided data profile is still compatible with the current environment. Note * this method ignores APN id check and traffic descriptor check. A data profile with traffic Loading src/java/com/android/internal/telephony/data/DataRetryManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,9 @@ public class DataRetryManager extends Handler { logl("Remove all retry and throttling entries, reason=" + resetReasonToString(reason)); removeMessages(EVENT_DATA_SETUP_RETRY); removeMessages(EVENT_DATA_HANDOVER_RETRY); mDataProfileManager.clearAllDataProfilePermanentFailures(); mDataRetryEntries.stream() .filter(entry -> entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED) .forEach(entry -> entry.setState(DataRetryEntry.RETRY_STATE_CANCELLED)); Loading tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -1462,4 +1462,20 @@ public class DataProfileManagerTest extends TelephonyTest { mSimInserted = simState == TelephonyManager.SIM_STATE_LOADED; mDataNetworkControllerCallback.onSimStateChanged(simState); } @Test public void testClearAllDataProfilePermanentFailures() { testPermanentFailureWithPreferredDataProfile(); // Reset all data profiles mDataProfileManagerUT.clearAllDataProfilePermanentFailures(); NetworkRequest request = new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(); // Verify the we can get the previously permanent failed data profile again. assertThat(mDataProfileManagerUT.getDataProfileForNetworkRequest( new TelephonyNetworkRequest(request, mPhone), TelephonyManager.NETWORK_TYPE_LTE, false)).isNotNull(); } } tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java +6 −3 Original line number Diff line number Diff line Loading @@ -781,7 +781,7 @@ public class DataRetryManagerTest extends TelephonyTest { @Test public void testRilCrashedReset() { testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(8/*EVENT_RADIO_ON*/, Loading @@ -801,12 +801,13 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } @Test public void testModemCrashedReset() { testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(10 /*EVENT_TAC_CHANGED*/, Loading @@ -826,6 +827,7 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } @Test Loading @@ -833,7 +835,7 @@ public class DataRetryManagerTest extends TelephonyTest { doReturn(true).when(mDataConfigManager).shouldResetDataThrottlingWhenTacChanges(); testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(9/*EVENT_MODEM_RESET*/, Loading @@ -853,5 +855,6 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } } Loading
src/java/com/android/internal/telephony/data/DataProfileManager.java +10 −0 Original line number Diff line number Diff line Loading @@ -993,6 +993,16 @@ public class DataProfileManager extends Handler { .build(); } /** * Called by {@link DataRetryManager} to clear all permanent failures upon reset. */ public void clearAllDataProfilePermanentFailures() { mAllDataProfiles.stream() .map(DataProfile::getApnSetting) .filter(Objects::nonNull) .forEach(apnSetting -> apnSetting.setPermanentFailed(false)); } /** * Check if the provided data profile is still compatible with the current environment. Note * this method ignores APN id check and traffic descriptor check. A data profile with traffic Loading
src/java/com/android/internal/telephony/data/DataRetryManager.java +3 −0 Original line number Diff line number Diff line Loading @@ -1304,6 +1304,9 @@ public class DataRetryManager extends Handler { logl("Remove all retry and throttling entries, reason=" + resetReasonToString(reason)); removeMessages(EVENT_DATA_SETUP_RETRY); removeMessages(EVENT_DATA_HANDOVER_RETRY); mDataProfileManager.clearAllDataProfilePermanentFailures(); mDataRetryEntries.stream() .filter(entry -> entry.getState() == DataRetryEntry.RETRY_STATE_NOT_RETRIED) .forEach(entry -> entry.setState(DataRetryEntry.RETRY_STATE_CANCELLED)); Loading
tests/telephonytests/src/com/android/internal/telephony/data/DataProfileManagerTest.java +16 −0 Original line number Diff line number Diff line Loading @@ -1462,4 +1462,20 @@ public class DataProfileManagerTest extends TelephonyTest { mSimInserted = simState == TelephonyManager.SIM_STATE_LOADED; mDataNetworkControllerCallback.onSimStateChanged(simState); } @Test public void testClearAllDataProfilePermanentFailures() { testPermanentFailureWithPreferredDataProfile(); // Reset all data profiles mDataProfileManagerUT.clearAllDataProfilePermanentFailures(); NetworkRequest request = new NetworkRequest.Builder() .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(); // Verify the we can get the previously permanent failed data profile again. assertThat(mDataProfileManagerUT.getDataProfileForNetworkRequest( new TelephonyNetworkRequest(request, mPhone), TelephonyManager.NETWORK_TYPE_LTE, false)).isNotNull(); } }
tests/telephonytests/src/com/android/internal/telephony/data/DataRetryManagerTest.java +6 −3 Original line number Diff line number Diff line Loading @@ -781,7 +781,7 @@ public class DataRetryManagerTest extends TelephonyTest { @Test public void testRilCrashedReset() { testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(8/*EVENT_RADIO_ON*/, Loading @@ -801,12 +801,13 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } @Test public void testModemCrashedReset() { testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(10 /*EVENT_TAC_CHANGED*/, Loading @@ -826,6 +827,7 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } @Test Loading @@ -833,7 +835,7 @@ public class DataRetryManagerTest extends TelephonyTest { doReturn(true).when(mDataConfigManager).shouldResetDataThrottlingWhenTacChanges(); testDataSetupRetryNetworkSuggestedNeverRetry(); Mockito.clearInvocations(mDataRetryManagerCallbackMock); Mockito.clearInvocations(mDataRetryManagerCallbackMock, mDataProfileManager); // RIL crashed and came back online. mDataRetryManagerUT.obtainMessage(9/*EVENT_MODEM_RESET*/, Loading @@ -853,5 +855,6 @@ public class DataRetryManagerTest extends TelephonyTest { assertThat(throttleStatus.getThrottleExpiryTimeMillis()).isEqualTo(-1); assertThat(throttleStatus.getTransportType()) .isEqualTo(AccessNetworkConstants.TRANSPORT_TYPE_WWAN); verify(mDataProfileManager).clearAllDataProfilePermanentFailures(); } }