Search in sources :

Example 1 with VoiceCallSession

use of com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method onRilSrvccStateChanged.

/**
 * Updates internal states when an IMS call is handover to a CS call.
 */
public synchronized void onRilSrvccStateChanged(int state) {
    List<Connection> handoverConnections = null;
    if (mPhone.getImsPhone() != null) {
        loge("onRilSrvccStateChanged: ImsPhone is null");
    } else {
        handoverConnections = mPhone.getImsPhone().getHandoverConnection();
    }
    List<Integer> imsConnIds;
    if (handoverConnections == null) {
        imsConnIds = getImsConnectionIds();
        loge("onRilSrvccStateChanged: ImsPhone has no handover, we have %d", imsConnIds.size());
    } else {
        imsConnIds = handoverConnections.stream().map(VoiceCallSessionStats::getConnectionId).collect(Collectors.toList());
    }
    switch(state) {
        case TelephonyManager.SRVCC_STATE_HANDOVER_COMPLETED:
            // connection will now be CS
            for (int id : imsConnIds) {
                VoiceCallSession proto = mCallProtos.get(id);
                proto.srvccCompleted = true;
                proto.bearerAtEnd = VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_CS;
            }
            break;
        case TelephonyManager.SRVCC_STATE_HANDOVER_FAILED:
            for (int id : imsConnIds) {
                mCallProtos.get(id).srvccFailureCount++;
            }
            break;
        case TelephonyManager.SRVCC_STATE_HANDOVER_CANCELED:
            for (int id : imsConnIds) {
                mCallProtos.get(id).srvccCancellationCount++;
            }
            break;
        // including STARTED and NONE, do nothing
        default:
    }
}
Also used : VoiceCallSession(com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession) ImsPhoneConnection(com.android.internal.telephony.imsphone.ImsPhoneConnection) GsmCdmaConnection(com.android.internal.telephony.GsmCdmaConnection) Connection(com.android.internal.telephony.Connection)

Example 2 with VoiceCallSession

use of com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method onAudioCodecChanged.

/* general & misc. */
/**
 * Updates internal states when audio codec for a call is changed.
 */
public synchronized void onAudioCodecChanged(Connection conn, int audioQuality) {
    VoiceCallSession proto = mCallProtos.get(getConnectionId(conn));
    if (proto == null) {
        loge("onAudioCodecChanged: untracked connection");
        return;
    }
    proto.codecBitmask |= audioQualityToCodecBitmask(proto.bearerAtEnd, audioQuality);
}
Also used : VoiceCallSession(com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession)

Example 3 with VoiceCallSession

use of com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method addCall.

/* internal */
/**
 * Adds a call connection.
 *
 * <p>Should be called when the call is created, and when setup begins (upon {@code
 * RilRequest.RIL_REQUEST_ANSWER} or {@code ImsCommand.IMS_CMD_ACCEPT}).
 */
private void addCall(Connection conn) {
    int id = getConnectionId(conn);
    if (mCallProtos.contains(id)) {
        // mostly handles ringing MT call getting accepted (MT call setup begins)
        logd("addCall: resetting setup info");
        VoiceCallSession proto = mCallProtos.get(id);
        proto.setupBeginMillis = getTimeMillis();
        proto.setupDuration = VOICE_CALL_SESSION__SETUP_DURATION__CALL_SETUP_DURATION_UNKNOWN;
    } else {
        int bearer = getBearer(conn);
        ServiceState serviceState = getServiceState();
        int rat = getRat(serviceState);
        VoiceCallSession proto = new VoiceCallSession();
        proto.bearerAtStart = bearer;
        proto.bearerAtEnd = bearer;
        proto.direction = getDirection(conn);
        proto.setupDuration = VOICE_CALL_SESSION__SETUP_DURATION__CALL_SETUP_DURATION_UNKNOWN;
        proto.setupFailed = true;
        proto.disconnectReasonCode = conn.getDisconnectCause();
        proto.disconnectExtraCode = conn.getPreciseDisconnectCause();
        proto.disconnectExtraMessage = conn.getVendorDisconnectCause();
        proto.ratAtStart = rat;
        proto.ratAtEnd = rat;
        proto.ratSwitchCount = 0L;
        proto.codecBitmask = 0L;
        proto.simSlotIndex = getSimSlotId();
        proto.isMultiSim = SimSlotState.getCurrentState().numActiveSims > 1;
        proto.isEsim = isEsim();
        proto.carrierId = mPhone.getCarrierId();
        proto.srvccCompleted = false;
        proto.srvccFailureCount = 0L;
        proto.srvccCancellationCount = 0L;
        proto.rttEnabled = false;
        proto.isEmergency = conn.isEmergencyCall();
        proto.isRoaming = serviceState != null ? serviceState.getVoiceRoaming() : false;
        // internal fields for tracking
        proto.setupBeginMillis = getTimeMillis();
        proto.concurrentCallCountAtStart = mCallProtos.size();
        mCallProtos.put(id, proto);
        // RAT call count needs to be updated
        updateRatTracker(serviceState);
    }
}
Also used : VoiceCallSession(com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession) ServiceState(android.telephony.ServiceState)

Example 4 with VoiceCallSession

use of com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method updateRatTracker.

private void updateRatTracker(ServiceState state) {
    int rat = getRat(state);
    mRatUsage.add(mPhone.getCarrierId(), rat, getTimeMillis(), getConnectionIds());
    for (int i = 0; i < mCallProtos.size(); i++) {
        VoiceCallSession proto = mCallProtos.valueAt(i);
        if (proto.ratAtEnd != rat) {
            proto.ratSwitchCount++;
            proto.ratAtEnd = rat;
        }
    // assuming that SIM carrier ID does not change during the call
    }
}
Also used : VoiceCallSession(com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession)

Example 5 with VoiceCallSession

use of com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession in project android_frameworks_opt_telephony by LineageOS.

the class VoiceCallSessionStats method setRttStarted.

private void setRttStarted(ImsPhoneConnection conn) {
    VoiceCallSession proto = mCallProtos.get(getConnectionId(conn));
    if (proto == null) {
        loge("onRttStarted: untracked connection");
        return;
    }
    // should be IMS w/o SRVCC
    if (proto.bearerAtStart != getBearer(conn) || proto.bearerAtEnd != getBearer(conn)) {
        loge("onRttStarted: connection bearer mismatch but proceeding");
    }
    proto.rttEnabled = true;
}
Also used : VoiceCallSession(com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession)

Aggregations

VoiceCallSession (com.android.internal.telephony.nano.PersistAtomsProto.VoiceCallSession)48 SmallTest (android.test.suitebuilder.annotation.SmallTest)36 TelephonyTest (com.android.internal.telephony.TelephonyTest)36 Test (org.junit.Test)36 RawVoiceCallRatUsage (com.android.internal.telephony.nano.PersistAtomsProto.RawVoiceCallRatUsage)28 ArrayList (java.util.ArrayList)24 ImsReasonInfo (android.telephony.ims.ImsReasonInfo)21 InOrder (org.mockito.InOrder)6 Connection (com.android.internal.telephony.Connection)2 GsmCdmaConnection (com.android.internal.telephony.GsmCdmaConnection)2 ImsPhoneConnection (com.android.internal.telephony.imsphone.ImsPhoneConnection)2 ServiceState (android.telephony.ServiceState)1 StatsEvent (android.util.StatsEvent)1 FileOutputStream (java.io.FileOutputStream)1