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

Commit 71164c8d authored by Jack Yu's avatar Jack Yu
Browse files

Fixed that data unthrottling not working

The data unthrottling input from data service
is APN name, not APN type. DcTracker should convert
APN to APN types before sending unthrottling information
to data throttler.

Fix: 182885625
Test: atest DcTrackerTest#testDataUnthrottled
Change-Id: I32ad58bb01671cf4c19923cb3010cb5201c86d14
parent 8aa61e7b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ public interface PhoneInternalInterface {
    static final String REASON_DATA_ENABLED_OVERRIDE = "dataEnabledOverride";
    static final String REASON_IWLAN_DATA_SERVICE_DIED = "iwlanDataServiceDied";
    static final String REASON_VCN_REQUESTED_TEARDOWN = "vcnRequestedTeardown";
    static final String REASON_DATA_UNTHROTTLED = "dataUnthrottled";

    // Reasons for Radio being powered off
    int RADIO_POWER_REASON_USER = 0;
+7 −4
Original line number Diff line number Diff line
@@ -2516,14 +2516,17 @@ public class DcTracker extends Handler {

    private void onApnUnthrottled(String apn) {
        if (apn != null) {
            ApnContext ac = mApnContexts.get(apn);
            if (ac != null) {
                @ApnType int apnTypes = ac.getApnTypeBitmask();
            ApnSetting apnSetting = mAllApnSettings.stream()
                    .filter(as -> apn.equals(as.getApnName()))
                    .findFirst()
                    .orElse(null);
            if (apnSetting != null) {
                @ApnType int apnTypes = apnSetting.getApnTypeBitmask();
                mDataThrottler.setRetryTime(apnTypes, RetryManager.NO_SUGGESTED_RETRY_DELAY,
                        REQUEST_TYPE_NORMAL);
                // After data unthrottled, we should see if it's possible to bring up the data
                // again.
                trySetupData(ac, REQUEST_TYPE_NORMAL, null);
                setupDataOnAllConnectableApns(Phone.REASON_DATA_UNTHROTTLED, RetryFailures.ALWAYS);
            } else {
                loge("EVENT_APN_UNTHROTTLED: Invalid APN passed: " + apn);
            }
+17 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import com.android.internal.R;
import com.android.internal.telephony.DctConstants;
import com.android.internal.telephony.ISub;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.RetryManager;
import com.android.internal.telephony.TelephonyTest;

import org.junit.After;
@@ -2792,4 +2793,20 @@ public class DcTrackerTest extends TelephonyTest {
                any(Message.class), anyInt(), eq(DcTracker.REQUEST_TYPE_HANDOVER), anyInt(),
                anyBoolean());
    }

    @Test
    public void testDataUnthrottled() throws Exception {
        DataThrottler mockedDataThrottler = Mockito.mock(DataThrottler.class);
        replaceInstance(DcTracker.class, "mDataThrottler", mDct, mockedDataThrottler);
        mDct.enableApn(ApnSetting.TYPE_IMS, DcTracker.REQUEST_TYPE_NORMAL, null);
        sendInitializationEvents();
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_APN_UNTHROTTLED,
                new AsyncResult(null, FAKE_APN3, null)));
        waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());

        verify(mockedDataThrottler).setRetryTime(
                eq(ApnSetting.TYPE_IMS),
                eq(RetryManager.NO_SUGGESTED_RETRY_DELAY),
                eq(DcTracker.REQUEST_TYPE_NORMAL));
    }
}