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

Commit ea6c754e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed that data unthrottling not working" into sc-dev

parents 939f3d87 71164c8d
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));
    }
}