Search in sources :

Example 1 with RilCall

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method convertConnectionsToRilCalls.

private RilCall[] convertConnectionsToRilCalls(ArrayList<GsmCdmaConnection> mConnections) {
    RilCall[] calls = new RilCall[mConnections.size()];
    for (int i = 0; i < mConnections.size(); i++) {
        calls[i] = new RilCall();
        calls[i].index = i;
        convertConnectionToRilCall(mConnections.get(i), calls[i]);
    }
    return calls;
}
Also used : RilCall(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)

Example 2 with RilCall

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method printAllMetrics.

/**
 * Print all metrics data for debugging purposes
 *
 * @param rawWriter Print writer
 */
private synchronized void printAllMetrics(PrintWriter rawWriter) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(rawWriter, "  ");
    pw.println("Telephony metrics proto:");
    pw.println("------------------------------------------");
    pw.println("Telephony events:");
    pw.increaseIndent();
    for (TelephonyEvent event : mTelephonyEvents) {
        pw.print(event.timestampMillis);
        pw.print(" [");
        pw.print(event.phoneId);
        pw.print("] ");
        pw.print("T=");
        if (event.type == TelephonyEvent.Type.RIL_SERVICE_STATE_CHANGED) {
            pw.print(telephonyEventToString(event.type) + "(" + event.serviceState.dataRat + ")");
        } else {
            pw.print(telephonyEventToString(event.type));
        }
        pw.println("");
    }
    pw.decreaseIndent();
    pw.println("Call sessions:");
    pw.increaseIndent();
    for (TelephonyCallSession callSession : mCompletedCallSessions) {
        pw.println("Start time in minutes: " + callSession.startTimeMinutes);
        pw.println("Events dropped: " + callSession.eventsDropped);
        pw.println("Events: ");
        pw.increaseIndent();
        for (TelephonyCallSession.Event event : callSession.events) {
            pw.print(event.delay);
            pw.print(" T=");
            if (event.type == TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED) {
                pw.println(callSessionEventToString(event.type) + "(" + event.serviceState.dataRat + ")");
            } else if (event.type == TelephonyCallSession.Event.Type.RIL_CALL_LIST_CHANGED) {
                pw.println(callSessionEventToString(event.type));
                pw.increaseIndent();
                for (RilCall call : event.calls) {
                    pw.println(call.index + ". Type = " + call.type + " State = " + call.state + " End Reason " + call.callEndReason + " isMultiparty = " + call.isMultiparty);
                }
                pw.decreaseIndent();
            } else {
                pw.println(callSessionEventToString(event.type));
            }
        }
        pw.decreaseIndent();
    }
    pw.decreaseIndent();
    pw.println("Sms sessions:");
    pw.increaseIndent();
    int count = 0;
    for (SmsSession smsSession : mCompletedSmsSessions) {
        count++;
        pw.print("[" + count + "] Start time in minutes: " + smsSession.startTimeMinutes);
        if (smsSession.eventsDropped) {
            pw.println(", events dropped: " + smsSession.eventsDropped);
        }
        pw.println("Events: ");
        pw.increaseIndent();
        for (SmsSession.Event event : smsSession.events) {
            pw.print(event.delay);
            pw.print(" T=");
            pw.println(smsSessionEventToString(event.type));
        }
        pw.decreaseIndent();
    }
    pw.decreaseIndent();
}
Also used : TelephonyEvent(com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent) TelephonyCallSession(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter) RilCall(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall) SmsSession(com.android.internal.telephony.nano.TelephonyProto.SmsSession)

Example 3 with RilCall

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall 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 4 with RilCall

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method writeRilHangup.

/**
 * Write call hangup event
 *
 * @param phoneId Phone id
 * @param conn Connection object associated with the call that is being hung-up
 * @param callId Call id
 */
public void writeRilHangup(int phoneId, GsmCdmaConnection conn, int callId) {
    InProgressCallSession callSession = mInProgressCallSessions.get(phoneId);
    if (callSession == null) {
        Rlog.e(TAG, "writeRilHangup: Call session is missing");
    } else {
        RilCall[] calls = new RilCall[1];
        calls[0] = new RilCall();
        calls[0].index = callId;
        convertConnectionToRilCall(conn, calls[0]);
        callSession.addEvent(new CallSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_REQUEST).setRilRequest(TelephonyCallSession.Event.RilRequest.RIL_REQUEST_HANGUP).setRilCalls(calls));
        if (VDBG)
            Rlog.v(TAG, "Logged Hangup event");
    }
}
Also used : RilCall(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)

Example 5 with RilCall

use of com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method writeRilDial.

/**
 * Write dial event
 *
 * @param phoneId Phone id
 * @param conn Connection object created to track this call
 * @param clirMode CLIR (Calling Line Identification Restriction) mode
 * @param uusInfo User-to-User signaling Info
 */
public void writeRilDial(int phoneId, GsmCdmaConnection conn, int clirMode, UUSInfo uusInfo) {
    InProgressCallSession callSession = startNewCallSessionIfNeeded(phoneId);
    if (VDBG)
        Rlog.v(TAG, "Logging Dial Connection = " + conn);
    if (callSession == null) {
        Rlog.e(TAG, "writeRilDial: Call session is missing");
    } else {
        RilCall[] calls = new RilCall[1];
        calls[0] = new RilCall();
        calls[0].index = -1;
        convertConnectionToRilCall(conn, calls[0]);
        callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_REQUEST).setRilRequest(TelephonyCallSession.Event.RilRequest.RIL_REQUEST_DIAL).setRilCalls(calls));
        if (VDBG)
            Rlog.v(TAG, "Logged Dial event");
    }
}
Also used : RilCall(com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)

Aggregations

RilCall (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession.Event.RilCall)5 TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)2 FlakyTest (android.support.test.filters.FlakyTest)1 SmallTest (android.test.suitebuilder.annotation.SmallTest)1 TelephonyTest (com.android.internal.telephony.TelephonyTest)1 SmsSession (com.android.internal.telephony.nano.TelephonyProto.SmsSession)1 TelephonyCallSession (com.android.internal.telephony.nano.TelephonyProto.TelephonyCallSession)1 TelephonyLog (com.android.internal.telephony.nano.TelephonyProto.TelephonyLog)1 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)1 Test (org.junit.Test)1