diff options
Diffstat (limited to 'src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java')
-rw-r--r-- | src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java | 68 |
1 files changed, 67 insertions, 1 deletions
diff --git a/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java b/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java index ba07fa035a..5d8e027e09 100644 --- a/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java +++ b/src/java/com/android/internal/telephony/metrics/VoiceCallSessionStats.java @@ -47,8 +47,10 @@ import android.telephony.Annotation.NetworkType; import android.telephony.AnomalyReporter; import android.telephony.DisconnectCause; import android.telephony.NetworkRegistrationInfo; +import android.telephony.PreciseDataConnectionState; import android.telephony.ServiceState; import android.telephony.TelephonyManager; +import android.telephony.data.ApnSetting; import android.telephony.ims.ImsReasonInfo; import android.telephony.ims.ImsStreamMediaProfile; import android.util.LongSparseArray; @@ -163,6 +165,8 @@ public class VoiceCallSessionStats { public VoiceCallSessionStats(int phoneId, Phone phone) { mPhoneId = phoneId; mPhone = phone; + + DataConnectionStateTracker.getInstance(phoneId).start(phone); } /* CS calls */ @@ -395,6 +399,14 @@ public class VoiceCallSessionStats { } } + /** Updates internal states when IMS/Emergency PDN/PDU state changes */ + public synchronized void onPreciseDataConnectionStateChanged( + PreciseDataConnectionState connectionState) { + if (hasCalls()) { + updateVoiceCallSessionBearerState(connectionState); + } + } + /* internal */ /** Handles ringing MT call getting accepted. */ @@ -426,6 +438,7 @@ public class VoiceCallSessionStats { int bearer = getBearer(conn); ServiceState serviceState = getServiceState(); @NetworkType int rat = getVoiceRatWithVoNRFix(mPhone, serviceState, bearer); + @VideoState int videoState = conn.getVideoState(); VoiceCallSession proto = new VoiceCallSession(); proto.bearerAtStart = bearer; @@ -439,6 +452,7 @@ public class VoiceCallSessionStats { proto.ratAtConnected = TelephonyManager.NETWORK_TYPE_UNKNOWN; proto.ratAtEnd = rat; proto.ratSwitchCount = 0L; + proto.ratSwitchCountAfterConnected = 0L; proto.codecBitmask = 0L; proto.simSlotIndex = mPhoneId; proto.isMultiSim = SimSlotState.isMultiSim(); @@ -449,9 +463,11 @@ public class VoiceCallSessionStats { proto.srvccCancellationCount = 0L; proto.rttEnabled = false; proto.isEmergency = conn.isEmergencyCall() || conn.isNetworkIdentifiedEmergencyCall(); - proto.isRoaming = serviceState != null ? serviceState.getVoiceRoaming() : false; + proto.isRoaming = ServiceStateStats.isNetworkRoaming(serviceState); proto.isMultiparty = conn.isMultiparty(); proto.lastKnownRat = rat; + proto.videoEnabled = videoState != VideoProfile.STATE_AUDIO_ONLY ? true : false; + proto.handoverInProgress = isHandoverInProgress(bearer, proto.isEmergency); // internal fields for tracking if (getDirection(conn) == VOICE_CALL_SESSION__DIRECTION__CALL_DIRECTION_MT) { @@ -607,6 +623,9 @@ public class VoiceCallSessionStats { private void updateRatAtEnd(VoiceCallSession proto, @NetworkType int rat) { if (proto.ratAtEnd != rat) { proto.ratSwitchCount++; + if (!proto.setupFailed) { + proto.ratSwitchCountAfterConnected++; + } proto.ratAtEnd = rat; if (rat != TelephonyManager.NETWORK_TYPE_UNKNOWN) { proto.lastKnownRat = rat; @@ -680,6 +699,17 @@ public class VoiceCallSessionStats { return mPhone.getSignalStrength().getLevel(); } + private boolean isHandoverInProgress(int bearer, boolean isEmergency) { + // If the call is not IMS, the bearer will not be able to handover + if (bearer != VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_IMS) { + return false; + } + + int apnType = isEmergency ? ApnSetting.TYPE_EMERGENCY : ApnSetting.TYPE_IMS; + int dataState = DataConnectionStateTracker.getInstance(mPhoneId).getDataState(apnType); + return dataState == TelephonyManager.DATA_HANDOVER_IN_PROGRESS; + } + /** * This is a copy of ServiceStateStats.getVoiceRat(Phone, ServiceState, int) with minimum fix * required for tracking EPSFB correctly. @@ -922,4 +952,40 @@ public class VoiceCallSessionStats { return map; } + + private void updateVoiceCallSessionBearerState(PreciseDataConnectionState connectionState) { + ApnSetting apnSetting = connectionState.getApnSetting(); + if (apnSetting == null) { + return; + } + + int apnTypes = apnSetting.getApnTypeBitmask(); + if ((apnTypes & ApnSetting.TYPE_IMS) == 0 + && (apnTypes & ApnSetting.TYPE_EMERGENCY) == 0) { + return; + } + + for (int i = 0; i < mCallProtos.size(); i++) { + VoiceCallSession proto = mCallProtos.valueAt(i); + if (proto.bearerAtEnd == VOICE_CALL_SESSION__BEARER_AT_END__CALL_BEARER_IMS) { + if (!proto.isEmergency && (apnTypes & ApnSetting.TYPE_IMS) != 0) { + updateHandoverState(proto, connectionState.getState()); + } + if (proto.isEmergency && (apnTypes & ApnSetting.TYPE_EMERGENCY) != 0) { + updateHandoverState(proto, connectionState.getState()); + } + } + } + } + + private void updateHandoverState(VoiceCallSession proto, int dataState) { + switch (dataState) { + case TelephonyManager.DATA_HANDOVER_IN_PROGRESS: + proto.handoverInProgress = true; + break; + default: + // All other states are considered as not in handover + proto.handoverInProgress = false; + } + } } |