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

Commit 6decf69d authored by Jayachandran Chinnakkannu's avatar Jayachandran Chinnakkannu Committed by Gerrit Code Review
Browse files

Merge "Skip handling validation status for non default data connections"

parents 12b94a5c 616fe42f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1329,6 +1329,16 @@ public class DataConnection extends StateMachine {
        return result;
    }

    /** @return {@code true} if validation is required, {@code false} otherwise. */
    public boolean isValidationRequired() {
        final NetworkCapabilities nc = getNetworkCapabilities();
        return nc != null
                && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
                && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED)
                && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN);
    }

    /**
     * @return {@code True} if 464xlat should be skipped.
     */
+1 −1
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ public class DcNetworkAgent extends NetworkAgent {
        DcTracker dct = mPhone.getDcTracker(mTransportType);
        if (dct != null) {
            Message msg = dct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                    status, 0, redirectUrl);
                    status, mDataConnection.getCid(), redirectUrl);
            msg.sendToTarget();
        }
    }
+8 −3
Original line number Diff line number Diff line
@@ -2868,10 +2868,11 @@ public class DcTracker extends Handler {
     *
     * @param status One of {@code NetworkAgent.VALID_NETWORK} or
     * {@code NetworkAgent.INVALID_NETWORK}.
     * @param cid context id {@code cid}
     * @param redirectUrl If the Internet probe was redirected, this
     * is the destination it was redirected to, otherwise {@code null}
     */
    private void onNetworkStatusChanged(int status, String redirectUrl) {
    private void onNetworkStatusChanged(int status, int cid, String redirectUrl) {
        if (!TextUtils.isEmpty(redirectUrl)) {
            Intent intent = new Intent(TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED);
            intent.putExtra(TelephonyIntents.EXTRA_REDIRECTION_URL_KEY, redirectUrl);
@@ -2879,6 +2880,7 @@ public class DcTracker extends Handler {
            log("Notify carrier signal receivers with redirectUrl: " + redirectUrl);
        } else {
            final boolean isValid = status == NetworkAgent.VALID_NETWORK;
            final DataConnection dc = getDataConnectionByContextId(cid);
            if (!mDsRecoveryHandler.isRecoveryOnBadNetworkEnabled()) {
                if (DBG) log("Skip data stall recovery on network status change with in threshold");
                return;
@@ -2887,9 +2889,11 @@ public class DcTracker extends Handler {
                if (DBG) log("Skip data stall recovery on non WWAN");
                return;
            }
            if (dc != null && dc.isValidationRequired()) {
                mDsRecoveryHandler.processNetworkStatusChanged(isValid);
            }
        }
    }

    /**
     * Called when EVENT_DISCONNECT_DONE is received.
@@ -3531,8 +3535,9 @@ public class DcTracker extends Handler {

            case DctConstants.EVENT_NETWORK_STATUS_CHANGED:
                int status = msg.arg1;
                int cid = msg.arg2;
                String url = (String) msg.obj;
                onNetworkStatusChanged(status, url);
                onNetworkStatusChanged(status, cid, url);
                break;

            case DctConstants.EVENT_RADIO_AVAILABLE:
+9 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import android.telephony.data.ApnSetting;
import android.telephony.data.DataCallResponse;
import android.telephony.data.DataProfile;
import android.telephony.emergency.EmergencyNumber;
@@ -1179,6 +1180,14 @@ public class SimulatedCommands extends BaseCommands
            }
        }

        // Store different cids to simulate concurrent IMS and default data calls
        if ((dataProfile.getSupportedApnTypesBitmask() & ApnSetting.TYPE_IMS)
            == ApnSetting.TYPE_IMS) {
            mSetupDataCallResult.cid = 0;
        } else {
            mSetupDataCallResult.cid = 1;
        }

        DataCallResponse response = RIL.convertDataCallResult(mSetupDataCallResult);
        if (mDcSuccess) {
            resultSuccess(result, response);
+10 −7
Original line number Diff line number Diff line
@@ -1587,16 +1587,17 @@ public class DcTrackerTest extends TelephonyTest {
                eq(AccessNetworkType.EUTRAN), dpCaptor.capture(),
                eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(),
                any(Message.class));
        waitForMs(200);
        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);

        logd("Sending EVENT_NETWORK_STATUS_CHANGED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.VALID_NETWORK, 0, null));
                NetworkAgent.VALID_NETWORK, 1, null));
        waitForMs(200);

        logd("Sending EVENT_NETWORK_STATUS_CHANGED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.INVALID_NETWORK, 0, null));
                NetworkAgent.INVALID_NETWORK, 1, null));
        waitForMs(200);

        // Verify that its no-op when the new data stall detection feature is disabled
@@ -1628,16 +1629,17 @@ public class DcTrackerTest extends TelephonyTest {
                eq(AccessNetworkType.EUTRAN), dpCaptor.capture(),
                eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(),
                any(Message.class));
        waitForMs(200);
        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);

        logd("Sending EVENT_NETWORK_STATUS_CHANGED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.VALID_NETWORK, 0, null));
                NetworkAgent.VALID_NETWORK, 1, null));
        waitForMs(200);

        logd("Sending EVENT_NETWORK_STATUS_CHANGED");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.INVALID_NETWORK, 0, null));
                NetworkAgent.INVALID_NETWORK, 1, null));
        waitForMs(200);

        verify(mSimulatedCommandsVerifier, times(1)).getDataCallList(any(Message.class));
@@ -1670,11 +1672,12 @@ public class DcTrackerTest extends TelephonyTest {
                eq(AccessNetworkType.EUTRAN), dpCaptor.capture(),
                eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(),
                any(Message.class));
        waitForMs(200);
        verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);

        logd("Sending EVENT_NETWORK_STATUS_CHANGED false");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.INVALID_NETWORK, 0, null));
                NetworkAgent.INVALID_NETWORK, 1, null));
        waitForMs(200);

        // expected tear down all DataConnections
@@ -1714,7 +1717,7 @@ public class DcTrackerTest extends TelephonyTest {

        logd("Sending EVENT_NETWORK_STATUS_CHANGED false");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.INVALID_NETWORK, 0, null));
                NetworkAgent.INVALID_NETWORK, 1, null));
        waitForMs(200);

        // expected to get preferred network type
@@ -1751,7 +1754,7 @@ public class DcTrackerTest extends TelephonyTest {

        logd("Sending EVENT_NETWORK_STATUS_CHANGED false");
        mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_NETWORK_STATUS_CHANGED,
                NetworkAgent.INVALID_NETWORK, 0, null));
                NetworkAgent.INVALID_NETWORK, 1, null));
        waitForMs(200);

        // expected to get preferred network type