Search in sources :

Example 6 with TelephonyEvent

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);
}
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 7 with TelephonyEvent

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));
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) TelephonySettings(com.android.internal.telephony.nano.TelephonyProto.TelephonySettings)

Example 8 with TelephonyEvent

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));
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) ImsConnectionState(com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState) TelephonyProto(com.android.internal.telephony.nano.TelephonyProto) ImsReasonInfo(com.android.ims.ImsReasonInfo)

Example 9 with TelephonyEvent

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);
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) ModemRestart(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart)

Example 10 with TelephonyEvent

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));
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)

Aggregations

TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)11 FlakyTest (android.support.test.filters.FlakyTest)3 SmallTest (android.test.suitebuilder.annotation.SmallTest)3 TelephonyTest (com.android.internal.telephony.TelephonyTest)3 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)3 Test (org.junit.Test)3 TelephonyServiceState (com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState)2 ImsReasonInfo (com.android.ims.ImsReasonInfo)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 ImsCapabilities (com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities)1 ImsConnectionState (com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState)1 SmsSession (com.android.internal.telephony.nano.TelephonyProto.SmsSession)1 TelephonyCallSession (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession)1 RilCall (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)1 ModemRestart (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent.ModemRestart)1 TelephonySettings (com.android.internal.telephony.nano.TelephonyProto.TelephonySettings)1 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)1