Search in sources :

Example 11 with TelephonyLog

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

the class TelephonyMetrics method buildProto.

/**
 * Build the telephony proto
 *
 * @return Telephony proto
 */
private synchronized TelephonyLog buildProto() {
    TelephonyLog log = new TelephonyLog();
    // Build telephony events
    log.events = new TelephonyEvent[mTelephonyEvents.size()];
    mTelephonyEvents.toArray(log.events);
    log.eventsDropped = mTelephonyEventsDropped;
    // Build call sessions
    log.callSessions = new TelephonyCallSession[mCompletedCallSessions.size()];
    mCompletedCallSessions.toArray(log.callSessions);
    // Build SMS sessions
    log.smsSessions = new SmsSession[mCompletedSmsSessions.size()];
    mCompletedSmsSessions.toArray(log.smsSessions);
    // Build histogram. Currently we only support RIL histograms.
    List<TelephonyHistogram> rilHistograms = RIL.getTelephonyRILTimingHistograms();
    log.histograms = new TelephonyProto.TelephonyHistogram[rilHistograms.size()];
    for (int i = 0; i < rilHistograms.size(); i++) {
        log.histograms[i] = new TelephonyProto.TelephonyHistogram();
        TelephonyHistogram rilHistogram = rilHistograms.get(i);
        TelephonyProto.TelephonyHistogram histogramProto = log.histograms[i];
        histogramProto.category = rilHistogram.getCategory();
        histogramProto.id = rilHistogram.getId();
        histogramProto.minTimeMillis = rilHistogram.getMinTime();
        histogramProto.maxTimeMillis = rilHistogram.getMaxTime();
        histogramProto.avgTimeMillis = rilHistogram.getAverageTime();
        histogramProto.count = rilHistogram.getSampleCount();
        histogramProto.bucketCount = rilHistogram.getBucketCount();
        histogramProto.bucketEndPoints = rilHistogram.getBucketEndPoints();
        histogramProto.bucketCounters = rilHistogram.getBucketCounters();
    }
    // Log the starting system time
    log.startTime = new TelephonyProto.Time();
    log.startTime.systemTimestampMillis = mStartSystemTimeMs;
    log.startTime.elapsedTimestampMillis = mStartElapsedTimeMs;
    log.endTime = new TelephonyProto.Time();
    log.endTime.systemTimestampMillis = System.currentTimeMillis();
    log.endTime.elapsedTimestampMillis = SystemClock.elapsedRealtime();
    return log;
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyHistogram(android.telephony.TelephonyHistogram) TelephonyProto(com.android.internal.telephony.nano.TelephonyProto)

Example 12 with TelephonyLog

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

the class TelephonyMetricsTest method testModemRestartEvent.

// Test write modem restart event
@Test
@SmallTest
public void testModemRestartEvent() throws Exception {
    mMetrics.writeModemRestartEvent(mPhone.getPhoneId(), "Test");
    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("Test", log.events[0].modemRestart.reason);
}
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 13 with TelephonyLog

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

the class TelephonyMetricsTest method buildProto.

private TelephonyLog buildProto() throws Exception {
    Method method = TelephonyMetrics.class.getDeclaredMethod("buildProto");
    method.setAccessible(true);
    return (TelephonyLog) method.invoke(mMetrics);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) Method(java.lang.reflect.Method)

Example 14 with TelephonyLog

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

the class TelephonyMetricsTest method testWriteImsCallState.

// Test write ims call state
@Test
@SmallTest
public void testWriteImsCallState() throws Exception {
    mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), mImsCallSession);
    mMetrics.writeImsCallState(mPhone.getPhoneId(), mImsCallSession, Call.State.ACTIVE);
    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(123, log.callSessions[0].events[1].callIndex);
    assertEquals(CallState.CALL_ACTIVE, log.callSessions[0].events[1].callState);
}
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 15 with TelephonyLog

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

the class TelephonyMetricsTest method testWriteOnImsConnectionState.

// Test write on ims connection state
@Test
@SmallTest
public void testWriteOnImsConnectionState() throws Exception {
    mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), mImsCallSession);
    mMetrics.writeOnImsConnectionState(mPhone.getPhoneId(), ImsConnectionState.State.CONNECTED, mImsReasonInfo);
    mMetrics.writeOnImsConnectionState(mPhone.getPhoneId(), ImsConnectionState.State.CONNECTED, mImsReasonInfo);
    mMetrics.writePhoneState(mPhone.getPhoneId(), PhoneConstants.State.IDLE);
    TelephonyLog log = buildProto();
    assertEquals(1, log.events.length);
    assertEquals(1, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertEquals(2, log.callSessions[0].events.length);
    assertFalse(log.eventsDropped);
    assertEquals(TelephonyEvent.Type.IMS_CONNECTION_STATE_CHANGED, log.events[0].type);
    assertEquals(ImsConnectionState.State.CONNECTED, log.events[0].imsConnectionState.state);
    assertEquals(123, log.events[0].imsConnectionState.reasonInfo.reasonCode);
    assertEquals(456, log.events[0].imsConnectionState.reasonInfo.extraCode);
    assertEquals("extramessage", log.events[0].imsConnectionState.reasonInfo.extraMessage);
    assertFalse(log.callSessions[0].eventsDropped);
    assertEquals(TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED, log.callSessions[0].events[1].type);
    assertEquals(ImsConnectionState.State.CONNECTED, log.callSessions[0].events[1].imsConnectionState.state);
}
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)

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