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

Commit 4b1861a4 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5694913 from c9171f64 to qt-c2f2-release

Change-Id: I8c6483043555608a75461266081cecaac446afa4
parents f5067677 c9171f64
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1293,6 +1293,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
@@ -170,7 +170,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
@@ -2920,10 +2920,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);
@@ -2931,6 +2932,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;
@@ -2939,9 +2941,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.
@@ -3588,8 +3592,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;
@@ -1174,6 +1175,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
@@ -1571,16 +1571,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
@@ -1612,16 +1613,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));
@@ -1654,11 +1656,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
@@ -1698,7 +1701,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
@@ -1735,7 +1738,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