Search in sources :

Example 1 with ImsConnectionState

use of com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method startNewSmsSessionIfNeeded.

/**
 * Create the SMS session if there isn't any existing one
 *
 * @param phoneId Phone id
 * @return The SMS session
 */
private synchronized InProgressSmsSession startNewSmsSessionIfNeeded(int phoneId) {
    InProgressSmsSession smsSession = mInProgressSmsSessions.get(phoneId);
    if (smsSession == null) {
        if (VDBG)
            Rlog.v(TAG, "Starting a new sms session on phone " + phoneId);
        smsSession = new InProgressSmsSession(phoneId);
        mInProgressSmsSessions.append(phoneId, smsSession);
        // Insert the latest service state, ims capabilities, and ims connection state as the
        // base.
        TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
        if (serviceState != null) {
            smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED).setServiceState(serviceState));
        }
        ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
        if (imsCapabilities != null) {
            smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED).setImsCapabilities(imsCapabilities));
        }
        ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
        if (imsConnectionState != null) {
            smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(imsConnectionState));
        }
    }
    return smsSession;
}
Also used : TelephonyServiceState(com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState) ImsConnectionState(com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState) ImsCapabilities(com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities)

Example 2 with ImsConnectionState

use of com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method startNewSmsSession.

/**
 * Create a new SMS session
 *
 * @param phoneId Phone id
 * @return The SMS session
 */
private InProgressSmsSession startNewSmsSession(int phoneId) {
    InProgressSmsSession smsSession = new InProgressSmsSession(phoneId);
    // Insert the latest service state, ims capabilities, and ims connection state as the
    // base.
    TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
    if (serviceState != null) {
        smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED).setServiceState(serviceState));
    }
    ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
    if (imsCapabilities != null) {
        smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CAPABILITIES_CHANGED).setImsCapabilities(imsCapabilities));
    }
    ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
    if (imsConnectionState != null) {
        smsSession.addEvent(smsSession.startElapsedTimeMs, new SmsSessionEventBuilder(SmsSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(imsConnectionState));
    }
    return smsSession;
}
Also used : TelephonyServiceState(com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState) ImsConnectionState(com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState) ImsCapabilities(com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities)

Example 3 with ImsConnectionState

use of com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState in project android_frameworks_opt_telephony by LineageOS.

the class TelephonyMetrics method startNewCallSessionIfNeeded.

/**
 * Create the call session if there isn't any existing one
 *
 * @param phoneId Phone id
 * @return The call session
 */
private synchronized InProgressCallSession startNewCallSessionIfNeeded(int phoneId) {
    InProgressCallSession callSession = mInProgressCallSessions.get(phoneId);
    if (callSession == null) {
        logv("Starting a new call session on phone " + phoneId);
        callSession = new InProgressCallSession(phoneId);
        mInProgressCallSessions.append(phoneId, callSession);
        // Insert the latest service state, ims capabilities, and ims connection states as the
        // base.
        TelephonyServiceState serviceState = mLastServiceState.get(phoneId);
        if (serviceState != null) {
            callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.RIL_SERVICE_STATE_CHANGED).setServiceState(serviceState));
        }
        ImsCapabilities imsCapabilities = mLastImsCapabilities.get(phoneId);
        if (imsCapabilities != null) {
            callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CAPABILITIES_CHANGED).setImsCapabilities(imsCapabilities));
        }
        ImsConnectionState imsConnectionState = mLastImsConnectionState.get(phoneId);
        if (imsConnectionState != null) {
            callSession.addEvent(callSession.startElapsedTimeMs, new CallSessionEventBuilder(TelephonyCallSession.Event.Type.IMS_CONNECTION_STATE_CHANGED).setImsConnectionState(imsConnectionState));
        }
    }
    return callSession;
}
Also used : TelephonyServiceState(com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState) ImsConnectionState(com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState) ImsCapabilities(com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities)

Example 4 with ImsConnectionState

use of com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState 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(android.telephony.ims.ImsReasonInfo)

Aggregations

ImsConnectionState (com.android.internal.telephony.nano.TelephonyProto.ImsConnectionState)4 ImsCapabilities (com.android.internal.telephony.nano.TelephonyProto.ImsCapabilities)3 TelephonyServiceState (com.android.internal.telephony.nano.TelephonyProto.TelephonyServiceState)3 ImsReasonInfo (android.telephony.ims.ImsReasonInfo)1 TelephonyProto (com.android.internal.telephony.nano.TelephonyProto)1 TelephonyEvent (com.android.internal.telephony.nano.TelephonyProto.TelephonyEvent)1