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

Commit 2f48e3d6 authored by Ling Ma's avatar Ling Ma
Browse files

Fix setPermanentFailed on unthrottle

Since the data profile telephony received as part of unthrottle is reconstructed, the proper data profile to be updated is the data profile instance kept by data profile manager.

Fix: 278201016
Test: manual phone call + data browsing
Change-Id: Ieadf1dab4cc37560cb33d2a8f72feca7d6ab2c14
parent cbd03b17
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1580,7 +1580,6 @@ public class DataRetryManager extends Handler {
            Stream<DataThrottlingEntry> stream = mDataThrottlingEntries.stream();
            stream = stream.filter(entry -> entry.expirationTimeMillis > now);
            if (dataProfile.getApnSetting() != null) {
                dataProfile.getApnSetting().setPermanentFailed(false);
                stream = stream
                        .filter(entry -> entry.dataProfile.getApnSetting() != null)
                        .filter(entry -> entry.dataProfile.getApnSetting().getApnName()
@@ -1621,6 +1620,7 @@ public class DataRetryManager extends Handler {
        final int dataRetryType = retryType;

        if (unthrottledProfile != null && unthrottledProfile.getApnSetting() != null) {
            unthrottledProfile.getApnSetting().setPermanentFailed(false);
            throttleStatusList.addAll(unthrottledProfile.getApnSetting().getApnTypes().stream()
                    .map(apnType -> new ThrottleStatus.Builder()
                            .setApnType(apnType)
+15 −1
Original line number Diff line number Diff line
@@ -365,14 +365,28 @@ public class DataRetryManagerTest extends TelephonyTest {
                .setSetupRetryType(1)
                .build();
        mDataRetryEntries.addAll(List.of(scheduledRetry1, scheduledRetry2));
        // Suppose we set the data profile as permanently failed.
        mDataProfile3.getApnSetting().setPermanentFailed(true);

        DataProfile dataProfile3ReconstructedFromModem = new DataProfile.Builder()
                .setApnSetting(new ApnSetting.Builder()
                        .setEntryName("some_fake_ims")
                        .setApnName("fake_ims")
                        .setApnTypeBitmask(ApnSetting.TYPE_IMS)
                        .setProtocol(ApnSetting.PROTOCOL_IPV6)
                        .setRoamingProtocol(ApnSetting.PROTOCOL_IP)
                        .build())
                .build();

        // unthrottle the data profile, expect previous retries of the same transport is cancelled
        mDataRetryManagerUT.obtainMessage(6/*EVENT_DATA_PROFILE_UNTHROTTLED*/,
                new AsyncResult(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, mDataProfile3, null))
                new AsyncResult(AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
                        dataProfile3ReconstructedFromModem, null))
                .sendToTarget();
        processAllMessages();

        // check unthrottle
        assertThat(mDataProfile3.getApnSetting().getPermanentFailed()).isFalse();
        ArgumentCaptor<List<ThrottleStatus>> throttleStatusCaptor =
                ArgumentCaptor.forClass(List.class);
        verify(mDataRetryManagerCallbackMock).onThrottleStatusChanged(