Search in sources :

Example 6 with DataCallResponse

use of android.telephony.data.DataCallResponse in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method writeOnRilSolicitedResponse.

/**
 * Write RIL solicited response event
 *
 * @param phoneId Phone id
 * @param rilSerial RIL request serial number
 * @param rilError RIL error
 * @param rilRequest RIL request
 * @param ret The returned RIL response
 */
public void writeOnRilSolicitedResponse(int phoneId, int rilSerial, int rilError, int rilRequest, Object ret) {
    switch(rilRequest) {
        case RIL_REQUEST_SETUP_DATA_CALL:
            DataCallResponse response = (DataCallResponse) ret;
            writeOnSetupDataCallResponse(phoneId, rilSerial, rilError, rilRequest, response);
            break;
        case RIL_REQUEST_DEACTIVATE_DATA_CALL:
            writeOnDeactivateDataCallResponse(phoneId, rilError);
            break;
        case RIL_REQUEST_HANGUP:
        case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND:
        case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND:
        case RIL_REQUEST_DIAL:
        case RIL_REQUEST_ANSWER:
            writeOnCallSolicitedResponse(phoneId, rilSerial, rilError, rilRequest);
            break;
        case RIL_REQUEST_SEND_SMS:
        case RIL_REQUEST_SEND_SMS_EXPECT_MORE:
        case RIL_REQUEST_CDMA_SEND_SMS:
        case RIL_REQUEST_IMS_SEND_SMS:
            SmsResponse smsResponse = (SmsResponse) ret;
            writeOnSmsSolicitedResponse(phoneId, rilSerial, rilError, smsResponse);
            break;
    }
}
Also used : DataCallResponse(android.telephony.data.DataCallResponse) RilSetupDataCallResponse(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCallResponse) SmsResponse(com.android.internal.telephony.SmsResponse)

Example 7 with DataCallResponse

use of android.telephony.data.DataCallResponse in project android_frameworks_opt_telephony by LineageOS.

the class DataCallResponseTest method testEquals.

@SmallTest
public void testEquals() throws Exception {
    DataCallResponse response = new DataCallResponse.Builder().setCause(0).setSuggestedRetryTime(-1).setId(1).setLinkStatus(2).setProtocolType(ApnSetting.PROTOCOL_IP).setInterfaceName(FAKE_IFNAME).setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))).setMtuV4(1440).setMtuV6(1400).build();
    DataCallResponse response1 = new DataCallResponse.Builder().setCause(0).setSuggestedRetryTime(-1).setId(1).setLinkStatus(2).setProtocolType(ApnSetting.PROTOCOL_IP).setInterfaceName(FAKE_IFNAME).setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))).setMtuV4(1440).setMtuV6(1400).build();
    assertEquals(response, response);
    assertEquals(response, response1);
    DataCallResponse response2 = new DataCallResponse.Builder().setCause(1).setSuggestedRetryTime(-1).setId(1).setLinkStatus(3).setProtocolType(ApnSetting.PROTOCOL_IP).setInterfaceName(FAKE_IFNAME).setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS), InetAddresses.parseNumericAddress(FAKE_DNS))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS), InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))).setMtuV4(1441).setMtuV6(1440).build();
    assertNotSame(response1, response2);
    assertNotSame(response1, null);
    assertNotSame(response1, new String[1]);
}
Also used : DataCallResponse(android.telephony.data.DataCallResponse) LinkAddress(android.net.LinkAddress) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 8 with DataCallResponse

use of android.telephony.data.DataCallResponse in project android_frameworks_opt_telephony by LineageOS.

the class DataCallResponseTest method testParcel.

@SmallTest
public void testParcel() throws Exception {
    DataCallResponse response = new DataCallResponse.Builder().setCause(0).setSuggestedRetryTime(-1).setId(1).setLinkStatus(2).setProtocolType(ApnSetting.PROTOCOL_IP).setInterfaceName(FAKE_IFNAME).setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress(FAKE_ADDRESS), 0))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_DNS))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_GATEWAY))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress(FAKE_PCSCF_ADDRESS))).setMtuV4(1440).setMtuV6(1440).build();
    Parcel p = Parcel.obtain();
    response.writeToParcel(p, 0);
    p.setDataPosition(0);
    DataCallResponse newResponse = new DataCallResponse(p);
    assertEquals(response, newResponse);
}
Also used : DataCallResponse(android.telephony.data.DataCallResponse) LinkAddress(android.net.LinkAddress) Parcel(android.os.Parcel) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 9 with DataCallResponse

use of android.telephony.data.DataCallResponse in project android_frameworks_opt_telephony by LineageOS.

the class RILTest method testConvertDataCallResult.

@Test
public void testConvertDataCallResult() {
    // Test V1.0 SetupDataCallResult
    android.hardware.radio.V1_0.SetupDataCallResult result10 = new android.hardware.radio.V1_0.SetupDataCallResult();
    result10.status = android.hardware.radio.V1_0.DataCallFailCause.NONE;
    result10.suggestedRetryTime = -1;
    result10.cid = 0;
    result10.active = 2;
    result10.type = "IPV4V6";
    result10.ifname = "ifname";
    result10.addresses = "10.0.2.15 2607:fb90:a620:651d:eabe:f8da:c107:44be/64";
    result10.dnses = "10.0.2.3 fd00:976a::9";
    result10.gateways = "10.0.2.15 fe80::2";
    result10.pcscf = "fd00:976a:c206:20::6   fd00:976a:c206:20::9    fd00:976a:c202:1d::9";
    result10.mtu = 1500;
    DataCallResponse response = new DataCallResponse.Builder().setCause(0).setSuggestedRetryTime(-1).setId(0).setLinkStatus(2).setProtocolType(ApnSetting.PROTOCOL_IPV4V6).setInterfaceName("ifname").setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64"))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), InetAddresses.parseNumericAddress("fd00:976a::9"))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), InetAddresses.parseNumericAddress("fe80::2"))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9"))).setMtu(1500).setMtuV4(1500).setMtuV6(1500).build();
    assertEquals(response, RIL.convertDataCallResult(result10));
    // Test V1.4 SetupDataCallResult
    android.hardware.radio.V1_4.SetupDataCallResult result14 = new android.hardware.radio.V1_4.SetupDataCallResult();
    result14.cause = android.hardware.radio.V1_4.DataCallFailCause.NONE;
    result14.suggestedRetryTime = -1;
    result14.cid = 0;
    result14.active = android.hardware.radio.V1_4.DataConnActiveStatus.ACTIVE;
    result14.type = android.hardware.radio.V1_4.PdpProtocolType.IPV4V6;
    result14.ifname = "ifname";
    result14.addresses = new ArrayList<>(Arrays.asList("10.0.2.15", "2607:fb90:a620:651d:eabe:f8da:c107:44be/64"));
    result14.dnses = new ArrayList<>(Arrays.asList("10.0.2.3", "fd00:976a::9"));
    result14.gateways = new ArrayList<>(Arrays.asList("10.0.2.15", "fe80::2"));
    result14.pcscf = new ArrayList<>(Arrays.asList("fd00:976a:c206:20::6", "fd00:976a:c206:20::9", "fd00:976a:c202:1d::9"));
    result14.mtu = 1500;
    assertEquals(response, RIL.convertDataCallResult(result14));
    // Test V1.5 SetupDataCallResult
    android.hardware.radio.V1_5.SetupDataCallResult result15 = new android.hardware.radio.V1_5.SetupDataCallResult();
    result15.cause = android.hardware.radio.V1_4.DataCallFailCause.NONE;
    result15.suggestedRetryTime = -1;
    result15.cid = 0;
    result15.active = android.hardware.radio.V1_4.DataConnActiveStatus.ACTIVE;
    result15.type = android.hardware.radio.V1_4.PdpProtocolType.IPV4V6;
    result15.ifname = "ifname";
    android.hardware.radio.V1_5.LinkAddress la1 = new android.hardware.radio.V1_5.LinkAddress();
    la1.address = "10.0.2.15";
    la1.properties = 0;
    la1.deprecationTime = -1;
    la1.expirationTime = -1;
    android.hardware.radio.V1_5.LinkAddress la2 = new android.hardware.radio.V1_5.LinkAddress();
    la2.address = "2607:fb90:a620:651d:eabe:f8da:c107:44be/64";
    la2.properties = 0;
    la2.deprecationTime = -1;
    la2.expirationTime = -1;
    result15.addresses = new ArrayList<>(Arrays.asList(la1, la2));
    result15.dnses = new ArrayList<>(Arrays.asList("10.0.2.3", "fd00:976a::9"));
    result15.gateways = new ArrayList<>(Arrays.asList("10.0.2.15", "fe80::2"));
    result15.pcscf = new ArrayList<>(Arrays.asList("fd00:976a:c206:20::6", "fd00:976a:c206:20::9", "fd00:976a:c202:1d::9"));
    result15.mtuV4 = 1500;
    result15.mtuV6 = 3000;
    response = new DataCallResponse.Builder().setCause(0).setSuggestedRetryTime(-1).setId(0).setLinkStatus(2).setProtocolType(ApnSetting.PROTOCOL_IPV4V6).setInterfaceName("ifname").setAddresses(Arrays.asList(new LinkAddress(InetAddresses.parseNumericAddress("10.0.2.15"), 32), new LinkAddress("2607:fb90:a620:651d:eabe:f8da:c107:44be/64"))).setDnsAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.3"), InetAddresses.parseNumericAddress("fd00:976a::9"))).setGatewayAddresses(Arrays.asList(InetAddresses.parseNumericAddress("10.0.2.15"), InetAddresses.parseNumericAddress("fe80::2"))).setPcscfAddresses(Arrays.asList(InetAddresses.parseNumericAddress("fd00:976a:c206:20::6"), InetAddresses.parseNumericAddress("fd00:976a:c206:20::9"), InetAddresses.parseNumericAddress("fd00:976a:c202:1d::9"))).setMtu(3000).setMtuV4(1500).setMtuV6(3000).build();
    assertEquals(response, RIL.convertDataCallResult(result15));
}
Also used : LinkAddress(android.net.LinkAddress) DataCallResponse(android.telephony.data.DataCallResponse) FlakyTest(androidx.test.filters.FlakyTest) Test(org.junit.Test)

Example 10 with DataCallResponse

use of android.telephony.data.DataCallResponse in project android_frameworks_opt_telephony by LineageOS.

the class RadioResponse method responseSetupDataCall.

private void responseSetupDataCall(RadioResponseInfo responseInfo, Object setupDataCallResult) {
    RILRequest rr = mRil.processResponse(responseInfo);
    if (rr != null) {
        DataCallResponse response = RIL.convertDataCallResult(setupDataCallResult);
        if (responseInfo.error == RadioError.NONE) {
            sendMessageResponse(rr.mResult, response);
        }
        mRil.processResponseDone(rr, responseInfo, response);
    }
}
Also used : DataCallResponse(android.telephony.data.DataCallResponse)

Aggregations

DataCallResponse (android.telephony.data.DataCallResponse)16 LinkAddress (android.net.LinkAddress)10 SmallTest (android.test.suitebuilder.annotation.SmallTest)10 Test (org.junit.Test)9 TelephonyTest (com.android.internal.telephony.TelephonyTest)8 MediumTest (android.test.suitebuilder.annotation.MediumTest)6 LinkProperties (android.net.LinkProperties)4 AsyncResult (android.os.AsyncResult)2 SetupDataCallResult (android.hardware.radio.V1_0.SetupDataCallResult)1 Message (android.os.Message)1 Parcel (android.os.Parcel)1 DataFailureCause (android.telephony.Annotation.DataFailureCause)1 DataProfile (android.telephony.data.DataProfile)1 FlakyTest (androidx.test.filters.FlakyTest)1 CommandException (com.android.internal.telephony.CommandException)1 SmsResponse (com.android.internal.telephony.SmsResponse)1 TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)1 RilSetupDataCallResponse (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.RilSetupDataCallResponse)1 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)1 ArrayList (java.util.ArrayList)1