Search in sources :

Example 1 with TelephonyLog

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

the class TelephonyMetricsTest method testWritePhoneState.

// Test write phone state
@Test
@SmallTest
public void testWritePhoneState() throws Exception {
    mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), mImsCallSession);
    mMetrics.writePhoneState(mPhone.getPhoneId(), PhoneConstants.State.OFFHOOK);
    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);
    assertFalse(log.eventsDropped);
    assertEquals(mPhone.getPhoneId(), log.callSessions[0].phoneId);
    assertEquals(2, log.callSessions[0].events.length);
    assertEquals(TelephonyCallSession.Event.Type.PHONE_STATE_CHANGED, log.callSessions[0].events[1].type);
    assertEquals(TelephonyCallSession.Event.PhoneState.STATE_OFFHOOK, log.callSessions[0].events[1].phoneState);
}
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 2 with TelephonyLog

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

the class TelephonyMetricsTest method testWriteRilDialHangup.

// Test write RIL dial and hangup
@Test
@SmallTest
public void testWriteRilDialHangup() throws Exception {
    doReturn(Call.State.DIALING).when(mConnection).getState();
    mMetrics.writeRilDial(mPhone.getPhoneId(), mConnection, 2, mUusInfo);
    doReturn(Call.State.DISCONNECTED).when(mConnection).getState();
    mMetrics.writeRilHangup(mPhone.getPhoneId(), mConnection, 3);
    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);
    assertFalse(log.eventsDropped);
    TelephonyCallSession.Event[] events = log.callSessions[0].events;
    assertEquals(2, events.length);
    assertEquals(TelephonyCallSession.Event.Type.RIL_REQUEST, events[0].type);
    assertEquals(TelephonyCallSession.Event.RilRequest.RIL_REQUEST_DIAL, events[0].rilRequest);
    RilCall[] calls = events[0].calls;
    assertEquals(CallState.CALL_DIALING, calls[0].state);
    assertEquals(TelephonyCallSession.Event.RilRequest.RIL_REQUEST_HANGUP, events[1].rilRequest);
    calls = events[1].calls;
    assertEquals(3, calls[0].index);
    assertEquals(CallState.CALL_DISCONNECTED, calls[0].state);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) RilCall(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall) 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 3 with TelephonyLog

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

the class TelephonyMetricsTest method testWriteImsSetFeatureValue.

// Test write ims set feature value
@Test
@SmallTest
public void testWriteImsSetFeatureValue() throws Exception {
    mMetrics.writeOnImsCallStart(mPhone.getPhoneId(), mImsCallSession);
    mMetrics.writeImsSetFeatureValue(mPhone.getPhoneId(), ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE, 0, 1, 0);
    mMetrics.writeImsSetFeatureValue(mPhone.getPhoneId(), ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE, 0, 1, 0);
    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.callSessions[0].eventsDropped);
    assertTrue(log.callSessions[0].events[1].settings.isEnhanced4GLteModeEnabled);
}
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 4 with TelephonyLog

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

the class TelephonyMetricsTest method testWriteServiceStateChanged.

// Test write service state changed
@Test
@SmallTest
public void testWriteServiceStateChanged() throws Exception {
    mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
    mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
    TelephonyLog log = buildProto();
    assertEquals(1, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertFalse(log.eventsDropped);
    TelephonyEvent event = log.events[0];
    assertEquals(TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED, event.type);
    TelephonyServiceState state = event.serviceState;
    assertEquals(RadioAccessTechnology.RAT_LTE, state.voiceRat);
    assertEquals(RadioAccessTechnology.RAT_LTE, state.dataRat);
    assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.voiceRoamingType);
    assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);
    assertEquals("voicelong", state.voiceOperator.alphaLong);
    assertEquals("voiceshort", state.voiceOperator.alphaShort);
    assertEquals("123456", state.voiceOperator.numeric);
    assertEquals("datalong", state.dataOperator.alphaLong);
    assertEquals("datashort", state.dataOperator.alphaShort);
    assertEquals("123456", state.dataOperator.numeric);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) TelephonyServiceState(com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState) 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 5 with TelephonyLog

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

the class TelephonyMetricsTest method testReset.

// Test reset scenario
@Test
@SmallTest
public void testReset() throws Exception {
    mMetrics.writeServiceStateChanged(mPhone.getPhoneId(), mServiceState);
    reset();
    TelephonyLog log = buildProto();
    assertEquals(1, log.events.length);
    assertEquals(0, log.callSessions.length);
    assertEquals(0, log.smsSessions.length);
    assertFalse(log.eventsDropped);
    TelephonyEvent event = log.events[0];
    assertEquals(TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED, event.type);
    TelephonyServiceState state = event.serviceState;
    assertEquals(RadioAccessTechnology.RAT_LTE, state.voiceRat);
    assertEquals(RadioAccessTechnology.RAT_LTE, state.dataRat);
    assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.voiceRoamingType);
    assertEquals(RoamingType.ROAMING_TYPE_DOMESTIC, state.dataRoamingType);
    assertEquals("voicelong", state.voiceOperator.alphaLong);
    assertEquals("voiceshort", state.voiceOperator.alphaShort);
    assertEquals("123456", state.voiceOperator.numeric);
    assertEquals("datalong", state.dataOperator.alphaLong);
    assertEquals("datashort", state.dataOperator.alphaShort);
    assertEquals("123456", state.dataOperator.numeric);
}
Also used : TelephonyLog(com.android.internal.telephony.nano.TelephonyProto.TelephonyLog) TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) TelephonyServiceState(com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState) 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