Search in sources :

Example 1 with SetupDataCallResult

use of android.hardware.radio.V1_0.SetupDataCallResult in project android_frameworks_opt_telephony by LineageOS.

the class DcTrackerTest method testDataRetry.

// Test the scenario where the first data call setup is failed, and then retry the setup later.
@Test
@MediumTest
public void testDataRetry() throws Exception {
    AsyncResult ar = new AsyncResult(null, new Pair<>(true, DataEnabledSettings.REASON_USER_DATA_ENABLED), null);
    mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_ENABLED_CHANGED, ar));
    waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
    // LOST_CONNECTION(0x10004) is a non-permanent failure, so we'll retry data setup later.
    SetupDataCallResult result = createSetupDataCallResult();
    result.status = 0x10004;
    // Simulate RIL fails the data call setup
    mSimulatedCommands.setDataCallResult(true, result);
    DataConnectionReasons dataConnectionReasons = new DataConnectionReasons();
    boolean allowed = isDataAllowed(dataConnectionReasons);
    assertFalse(dataConnectionReasons.toString(), allowed);
    logd("Sending EVENT_ENABLE_APN");
    // APN id 0 is APN_TYPE_DEFAULT
    mDct.enableApn(ApnSetting.TYPE_DEFAULT, DcTracker.REQUEST_TYPE_NORMAL, null);
    waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
    sendInitializationEvents();
    dataConnectionReasons = new DataConnectionReasons();
    allowed = isDataAllowed(dataConnectionReasons);
    assertTrue(dataConnectionReasons.toString(), allowed);
    ArgumentCaptor<DataProfile> dpCaptor = ArgumentCaptor.forClass(DataProfile.class);
    // Verify if RIL command was sent properly.
    verify(mSimulatedCommandsVerifier, times(1)).setupDataCall(eq(AccessNetworkType.EUTRAN), dpCaptor.capture(), eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(), any(Message.class));
    verifyDataProfile(dpCaptor.getValue(), FAKE_APN1, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);
    // This time we'll let RIL command succeed.
    mSimulatedCommands.setDataCallResult(true, createSetupDataCallResult());
    // Send event for reconnecting data
    initApns(PhoneConstants.APN_TYPE_DEFAULT, new String[] { PhoneConstants.APN_TYPE_ALL });
    mDct.sendMessage(mDct.obtainMessage(DctConstants.EVENT_DATA_RECONNECT, mPhone.getPhoneId(), AccessNetworkConstants.TRANSPORT_TYPE_WWAN, mApnContext));
    waitForLastHandlerAction(mDcTrackerTestHandler.getThreadHandler());
    // Data connection is running on a different thread. Have to wait.
    waitForMs(200);
    dpCaptor = ArgumentCaptor.forClass(DataProfile.class);
    // Verify if RIL command was sent properly.
    verify(mSimulatedCommandsVerifier, times(2)).setupDataCall(eq(AccessNetworkType.EUTRAN), dpCaptor.capture(), eq(false), eq(false), eq(DataService.REQUEST_REASON_NORMAL), any(), any(Message.class));
    verifyDataProfile(dpCaptor.getValue(), FAKE_APN2, 0, 21, 1, NETWORK_TYPE_LTE_BITMASK);
    // Verify connected with APN2 setting.
    verifyDataConnected(FAKE_APN2);
}
Also used : DataProfile(android.telephony.data.DataProfile) Message(android.os.Message) AsyncResult(android.os.AsyncResult) SetupDataCallResult(android.hardware.radio.V1_0.SetupDataCallResult) FlakyTest(androidx.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) MediumTest(android.test.suitebuilder.annotation.MediumTest) SmallTest(android.test.suitebuilder.annotation.SmallTest) Test(org.junit.Test) MediumTest(android.test.suitebuilder.annotation.MediumTest)

Example 2 with SetupDataCallResult

use of android.hardware.radio.V1_0.SetupDataCallResult in project android_frameworks_opt_telephony by LineageOS.

the class SimulatedCommands method setupDataCall.

@Override
public void setupDataCall(int accessNetworkType, DataProfile dataProfile, boolean isRoaming, boolean allowRoaming, int reason, LinkProperties linkProperties, Message result) {
    SimulatedCommandsVerifier.getInstance().setupDataCall(accessNetworkType, dataProfile, isRoaming, allowRoaming, reason, linkProperties, result);
    if (mSetupDataCallResult == null) {
        try {
            mSetupDataCallResult = new SetupDataCallResult();
            mSetupDataCallResult.status = 0;
            mSetupDataCallResult.suggestedRetryTime = -1;
            mSetupDataCallResult.cid = 1;
            mSetupDataCallResult.active = 2;
            mSetupDataCallResult.type = "IP";
            mSetupDataCallResult.ifname = "rmnet_data7";
            mSetupDataCallResult.addresses = "12.34.56.78";
            mSetupDataCallResult.dnses = "98.76.54.32";
            mSetupDataCallResult.gateways = "11.22.33.44";
            mSetupDataCallResult.pcscf = "fd00:976a:c305:1d::8 fd00:976a:c202:1d::7 fd00:976a:c305:1d::5";
            mSetupDataCallResult.mtu = 1440;
        } catch (Exception e) {
        }
    }
    // 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);
    } else {
        resultFail(result, response, new RuntimeException("Setup data call failed!"));
    }
}
Also used : DataCallResponse(android.telephony.data.DataCallResponse) SetupDataCallResult(android.hardware.radio.V1_0.SetupDataCallResult) CommandException(com.android.internal.telephony.CommandException)

Example 3 with SetupDataCallResult

use of android.hardware.radio.V1_0.SetupDataCallResult in project android_frameworks_opt_telephony by LineageOS.

the class RadioIndication method dataCallListChanged.

public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) {
    mRil.processIndication(indicationType);
    ArrayList<DataCallResponse> response = new ArrayList<>();
    for (SetupDataCallResult dcResult : dcList) {
        response.add(RIL.convertDataCallResult(dcResult));
    }
    if (RIL.RILJ_LOGD)
        mRil.unsljLogRet(RIL_UNSOL_DATA_CALL_LIST_CHANGED, response);
    mRil.mDataCallListChangedRegistrants.notifyRegistrants(new AsyncResult(null, response, null));
}
Also used : DataCallResponse(com.android.internal.telephony.dataconnection.DataCallResponse) ArrayList(java.util.ArrayList) AsyncResult(android.os.AsyncResult) SetupDataCallResult(android.hardware.radio.V1_0.SetupDataCallResult)

Example 4 with SetupDataCallResult

use of android.hardware.radio.V1_0.SetupDataCallResult in project android_frameworks_opt_telephony by LineageOS.

the class RadioResponse method responseDataCallList.

private void responseDataCallList(RadioResponseInfo responseInfo, ArrayList<SetupDataCallResult> dataCallResultList) {
    RILRequest rr = mRil.processResponse(responseInfo);
    if (rr != null) {
        ArrayList<DataCallResponse> dcResponseList = new ArrayList<>();
        for (SetupDataCallResult dcResult : dataCallResultList) {
            dcResponseList.add(RIL.convertDataCallResult(dcResult));
        }
        if (responseInfo.error == RadioError.NONE) {
            sendMessageResponse(rr.mResult, dcResponseList);
        }
        mRil.processResponseDone(rr, responseInfo, dcResponseList);
    }
}
Also used : DataCallResponse(com.android.internal.telephony.dataconnection.DataCallResponse) ArrayList(java.util.ArrayList) SetupDataCallResult(android.hardware.radio.V1_0.SetupDataCallResult)

Example 5 with SetupDataCallResult

use of android.hardware.radio.V1_0.SetupDataCallResult in project android_frameworks_opt_telephony by LineageOS.

the class DcTrackerTest method createSetupDataCallResult.

// Create a successful data response
private static SetupDataCallResult createSetupDataCallResult() throws Exception {
    SetupDataCallResult result = new SetupDataCallResult();
    result.status = 0;
    result.suggestedRetryTime = -1;
    result.cid = 1;
    result.active = 2;
    result.type = "IP";
    result.ifname = FAKE_IFNAME;
    result.addresses = FAKE_ADDRESS;
    result.dnses = FAKE_DNS;
    result.gateways = FAKE_GATEWAY;
    result.pcscf = FAKE_PCSCF_ADDRESS;
    result.mtu = 1440;
    return result;
}
Also used : SetupDataCallResult(android.hardware.radio.V1_0.SetupDataCallResult)

Aggregations

SetupDataCallResult (android.hardware.radio.V1_0.SetupDataCallResult)5 AsyncResult (android.os.AsyncResult)2 DataCallResponse (com.android.internal.telephony.dataconnection.DataCallResponse)2 ArrayList (java.util.ArrayList)2 Message (android.os.Message)1 DataCallResponse (android.telephony.data.DataCallResponse)1 DataProfile (android.telephony.data.DataProfile)1 MediumTest (android.test.suitebuilder.annotation.MediumTest)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 FlakyTest (androidx.test.filters.FlakyTest)1 CommandException (com.android.internal.telephony.CommandException)1 TelephonyTest (com.android.internal.telephony.TelephonyTest)1 Test (org.junit.Test)1