use of com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent 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);
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method writeImsSetFeatureValue.
/**
* Write IMS feature settings changed event
*
* @param phoneId Phone id
* @param feature IMS feature
* @param network The IMS network type
* @param value The settings. 0 indicates disabled, otherwise enabled.
* @param status IMS operation status. See OperationStatusConstants for details.
*/
public void writeImsSetFeatureValue(int phoneId, int feature, int network, int value, int status) {
TelephonySettings s = new TelephonySettings();
switch(feature) {
case ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_LTE:
s.isEnhanced4GLteModeEnabled = (value != 0);
break;
case ImsConfig.FeatureConstants.FEATURE_TYPE_VOICE_OVER_WIFI:
s.isWifiCallingEnabled = (value != 0);
break;
case ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_LTE:
s.isVtOverLteEnabled = (value != 0);
break;
case ImsConfig.FeatureConstants.FEATURE_TYPE_VIDEO_OVER_WIFI:
s.isVtOverWifiEnabled = (value != 0);
break;
}
// If the settings don't change, we don't log the event.
if (mLastSettings.get(phoneId) != null && Arrays.equals(TelephonySettings.toByteArray(mLastSettings.get(phoneId)), TelephonySettings.toByteArray(s))) {
return;
}
mLastSettings.put(phoneId, s);
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setSettings(s).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.SETTINGS_CHANGED).setSettings(s));
annotateInProgressSmsSession(event.timestampMillis, phoneId, new SmsSessionEventBuilder(SmsSession.Event.Type.SETTINGS_CHANGED).setSettings(s));
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method writeOnImsConnectionState.
/**
* Write the IMS connection state changed event
*
* @param phoneId Phone id
* @param state IMS connection state
* @param reasonInfo The reason info. Only used for disconnected state.
*/
public synchronized void writeOnImsConnectionState(int phoneId, int state, ImsReasonInfo reasonInfo) {
ImsConnectionState imsState = new ImsConnectionState();
imsState.state = state;
if (reasonInfo != null) {
TelephonyProto.ImsReasonInfo ri = new TelephonyProto.ImsReasonInfo();
ri.reasonCode = reasonInfo.getCode();
ri.extraCode = reasonInfo.getExtraCode();
String extraMessage = reasonInfo.getExtraMessage();
if (extraMessage != null) {
ri.extraMessage = extraMessage;
}
imsState.reasonInfo = ri;
}
// If the connection state does not change, do not log it.
if (mLastImsConnectionState.get(phoneId) != null && Arrays.equals(ImsConnectionState.toByteArray(mLastImsConnectionState.get(phoneId)), ImsConnectionState.toByteArray(imsState))) {
return;
}
mLastImsConnectionState.put(phoneId, imsState);
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setImsConnectionState(imsState).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(event.imsConnectionState));
annotateInProgressSmsSession(event.timestampMillis, phoneId, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(event.imsConnectionState));
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method writeModemRestartEvent.
/**
* Write Modem Restart event
*
* @param phoneId Phone id
* @param reason Reason for the modem reset.
*/
public void writeModemRestartEvent(int phoneId, String reason) {
final ModemRestart modemRestart = new ModemRestart();
String basebandVersion = Build.getRadioVersion();
if (basebandVersion != null)
modemRestart.basebandVersion = basebandVersion;
if (reason != null)
modemRestart.reason = reason;
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setModemRestart(modemRestart).build();
addTelephonyEvent(event);
}
use of com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent in project android_frameworks_opt_telephony by LineageOS.
the class TelephonyMetrics method writeNITZEvent.
/**
* Write NITZ event
*
* @param phoneId Phone id
* @param timestamp NITZ time in milliseconds
*/
public void writeNITZEvent(int phoneId, long timestamp) {
TelephonyEvent event = new TelephonyEventBuilder(phoneId).setNITZ(timestamp).build();
addTelephonyEvent(event);
annotateInProgressCallSession(event.timestampMillis, phoneId, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.NITZ_TIME).setNITZ(timestamp));
}
Aggregations