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