Search in sources :

Example 16 with TelephonyLog

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyLog in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetricsTest method testWriteOnImsCapabilities.

// Test write ims capabilities changed
@Test
@SmallTest
public void testWriteOnImsCapabilities() throws Exception {
    boolean[] caps1 = new boolean[] { true, false, true, false, true, false };
    mMetrics.writeOnImsCapabilities(mPhone.getPhoneId(), caps1);
    boolean[] caps2 = new boolean[] { true, false, true, false, true, false };
    // The duplicate one should be filtered out.
    mMetrics.writeOnImsCapabilities(mPhone.getPhoneId(), caps2);
    boolean[] caps3 = new boolean[] { false, true, false, true, false, true };
    mMetrics.writeOnImsCapabilities(mPhone.getPhoneId(), caps3);
    TelephonyLog log = buildProto();
    assertEquals(2, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    TelephonyEvent event = log.events[0];
    assertEquals(TelephonyEvent.Type.IMS_CAPABILITIES_CHANGED, event.type);
    assertEquals(caps1[0], event.imsCapabilities.voiceOverLte);
    assertEquals(caps1[1], event.imsCapabilities.videoOverLte);
    assertEquals(caps1[2], event.imsCapabilities.voiceOverWifi);
    assertEquals(caps1[3], event.imsCapabilities.videoOverWifi);
    assertEquals(caps1[4], event.imsCapabilities.utOverLte);
    assertEquals(caps1[5], event.imsCapabilities.utOverWifi);
    event = log.events[1];
    assertEquals(TelephonyEvent.Type.IMS_CAPABILITIES_CHANGED, event.type);
    assertEquals(caps3[0], event.imsCapabilities.voiceOverLte);
    assertEquals(caps3[1], event.imsCapabilities.videoOverLte);
    assertEquals(caps3[2], event.imsCapabilities.voiceOverWifi);
    assertEquals(caps3[3], event.imsCapabilities.videoOverWifi);
    assertEquals(caps3[4], event.imsCapabilities.utOverLte);
    assertEquals(caps3[5], event.imsCapabilities.utOverWifi);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 17 with TelephonyLog

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyLog in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetricsTest method testWriteRilSendSms.

// Test write RIL send SMS
@Test
@SmallTest
public void testWriteRilSendSms() throws Exception {
    mMetrics.writeRilSendSms(mPhone.getPhoneId(), 1, 2, 1);
    mMetrics.writeRilSendSms(mPhone.getPhoneId(), 4, 5, 2);
    SmsResponse response = new SmsResponse(0, null, 123);
    mMetrics.writeOnRilSolicitedResponse(mPhone.getPhoneId(), 1, 0, RIL_REQUEST_SEND_SMS, response);
    response = new SmsResponse(0, null, 456);
    mMetrics.writeOnRilSolicitedResponse(mPhone.getPhoneId(), 4, 0, RIL_REQUEST_SEND_SMS, response);
    TelephonyLog log = buildProto();
    assertEquals(0, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(1, log.smsSessions.length);
    assertFalse(log.eventsDropped);
    SmsSession.Event[] events = log.smsSessions[0].events;
    assertEquals(4, events.length);
    assertEquals(SmsSession.Event.Type.SMS_SEND, events[0].type);
    assertEquals(1, events[0].rilRequestId);
    assertEquals(2, events[0].tech);
    assertEquals(1, events[0].format);
    assertEquals(SmsSession.Event.Type.SMS_SEND, events[1].type);
    assertEquals(4, events[1].rilRequestId);
    assertEquals(5, events[1].tech);
    assertEquals(2, events[1].format);
    assertEquals(SmsSession.Event.Type.SMS_SEND_RESULT, events[2].type);
    assertEquals(1, events[2].rilRequestId);
    assertEquals(1, events[2].error);
    assertEquals(123, events[2].errorCode);
    assertEquals(SmsSession.Event.Type.SMS_SEND_RESULT, events[3].type);
    assertEquals(4, events[3].rilRequestId);
    assertEquals(1, events[3].error);
    assertEquals(456, events[3].errorCode);
}
Also used : SmsResponse(com.android.internal.telephony.SmsResponse) TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 18 with TelephonyLog

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyLog in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetricsTest method testWriteOnImsCommand.

// Test write on ims command
@Test
@SmallTest
public void testWriteOnImsCommand() throws Exception {
    mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), mImsCallSession);
    mMetrics.writeOnImsCommand(mPhone.getPhoneId(), mImsCallSession, 123);
    mMetrics.writePhoneState(mPhone.getPhoneId(), PhoneConstants.State.IDLE);
    TelephonyLog log = buildProto();
    assertEquals(0, log.events.length);
    assertEquals(1, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertEquals(2, log.callSessions[0].events.length);
    assertFalse(log.callSessions[0].eventsDropped);
    assertEquals(TelephonyCallSession.Event.Type.IMS_COMMAND, log.callSessions[0].events[1].type);
    assertEquals(123, log.callSessions[0].events[1].imsCommand);
    assertEquals(123, log.callSessions[0].events[1].callIndex);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 19 with TelephonyLog

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyLog in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetricsTest method testWriteDataStallEvent.

// Test write data stall event
@Test
@SmallTest
public void testWriteDataStallEvent() throws Exception {
    mMetrics.writeDataStallEvent(mPhone.getPhoneId(), 3);
    TelephonyLog log = buildProto();
    assertEquals(1, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertEquals(mPhone.getPhoneId(), log.events[0].phoneId);
    assertEquals(3, log.events[0].dataStallAction);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 20 with TelephonyLog

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyLog in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetricsTest method testWriteOnSetupDataCallResponse.

// Test write on setup data call response
@Test
@SmallTest
public void testWriteOnSetupDataCallResponse() throws Exception {
    DataCallResponse response = new DataCallResponse(5, 6, 7, 8, "IPV4V6", FAKE_IFNAME, FAKE_ADDRESS, FAKE_DNS, FAKE_GATEWAY, FAKE_PCSCF_ADDRESS, 1440);
    mMetrics.writeOnRilSolicitedResponse(mPhone.getPhoneId(), 1, 2, RIL_REQUEST_SETUP_DATA_CALL, response);
    TelephonyLog log = buildProto();
    assertEquals(1, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertFalse(log.eventsDropped);
    TelephonyEvent.RilSetupDataCallResponse respProto = log.events[0].setupDataCallResponse;
    assertEquals(5, respProto.status);
    assertEquals(6, respProto.suggestedRetryTimeMillis);
    assertEquals(7, respProto.call.cid);
    assertEquals(PDP_TYPE_IPV4V6, respProto.call.type);
    assertEquals(FAKE_IFNAME, respProto.call.iframe);
}
Also used : DataCallResponse(com.android.internal.telephony.dataconnection.DataCallResponse) TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) SmallTest(android.test.suitebuilder.annotation.SmallTest) FlakyTest(android.support.test.filters.FlakyTest) TelephonyTest(com.android.internal.telephony.TelephonyTest) Test(org.junit.Test) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Aggregations

TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)22 FlakyTest (android.support.test.filters.FlakyTest)20 SmallTest (android.test.suitebuilder.annotation.SmallTest)20 TelephonyTest (com.android.internal.telephony.TelephonyTest)20 Test (org.junit.Test)20 TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)7 TelephonyServiceState (com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState)2 TelephonyHistogram (android.telephony.TelephonyHistogram)1 SmsResponse (com.android.internal.telephony.SmsResponse)1 DataCallResponse (com.android.internal.telephony.dataconnection.DataCallResponse)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 RilCall (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)1 Method (java.lang.reflect.Method)1