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