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;
}
}
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]);
}
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);
}
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));
}
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);
}
}
Aggregations