Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4dead1a authored by Ling Ma's avatar Ling Ma Committed by Android (Google) Code Review
Browse files

Merge "Check transport for setup retry" into udc-dev

parents fd6aafd8 e176f656
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -1189,13 +1189,14 @@ public class DataRetryManager extends Handler {
                        return;
                    }

                    int failedCount = getRetryFailedCount(capability, retryRule);
                    int failedCount = getRetryFailedCount(capability, retryRule, transport);
                    log("For capability " + DataUtils.networkCapabilityToString(capability)
                            + ", found matching rule " + retryRule + ", failed count="
                            + failedCount);
                    if (failedCount == retryRule.getMaxRetries()) {
                        log("Data retry failed for " + failedCount + " times. Stopped "
                                + "timer-based data retry for "
                        log("Data retry failed for " + failedCount + " times on "
                                + AccessNetworkConstants.transportTypeToString(transport)
                                + ". Stopped timer-based data retry for "
                                + DataUtils.networkCapabilityToString(capability)
                                + ". Condition-based retry will still happen when condition "
                                + "changes.");
@@ -1368,16 +1369,18 @@ public class DataRetryManager extends Handler {
     *
     * @param networkCapability The network capability to check.
     * @param dataRetryRule The data retry rule.
     * @param transport The transport on which setup failure has occurred.
     * @return The failed count since last successful data setup.
     */
    private int getRetryFailedCount(@NetCapability int networkCapability,
            @NonNull DataSetupRetryRule dataRetryRule) {
            @NonNull DataSetupRetryRule dataRetryRule, @TransportType int transport) {
        int count = 0;
        for (int i = mDataRetryEntries.size() - 1; i >= 0; i--) {
            if (mDataRetryEntries.get(i) instanceof DataSetupRetryEntry) {
                DataSetupRetryEntry entry = (DataSetupRetryEntry) mDataRetryEntries.get(i);
                // count towards the last succeeded data setup.
                if (entry.setupRetryType == DataSetupRetryEntry.RETRY_TYPE_NETWORK_REQUESTS) {
                if (entry.setupRetryType == DataSetupRetryEntry.RETRY_TYPE_NETWORK_REQUESTS
                        && entry.transport == transport) {
                    if (entry.networkRequestList.isEmpty()) {
                        String msg = "Invalid data retry entry detected";
                        logl(msg);
+10 −0
Original line number Diff line number Diff line
@@ -587,6 +587,16 @@ public class DataRetryManagerTest extends TelephonyTest {
        // Verify there is no retry.
        verify(mDataRetryManagerCallbackMock, never())
                .onDataNetworkSetupRetry(any(DataSetupRetryEntry.class));

        // 4th failed on a different transport and retry.
        mDataRetryManagerUT.evaluateDataSetupRetry(mDataProfile1,
                AccessNetworkConstants.TRANSPORT_TYPE_WLAN, networkRequestList, 123,
                DataCallResponse.RETRY_DURATION_UNDEFINED);
        processAllFutureMessages();

        // Verify retry occurs
        verify(mDataRetryManagerCallbackMock)
                .onDataNetworkSetupRetry(any(DataSetupRetryEntry.class));
    }

    @Test