Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff73fcc7 authored by Kiwon Park's avatar Kiwon Park Committed by Android (Google) Code Review
Browse files

Merge "Add anomaly reports when there are too many concurrent calls at the...

Merge "Add anomaly reports when there are too many concurrent calls at the start of voice calls." into tm-qpr-dev
parents eaebe5ab 8f82d513
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -54,6 +54,7 @@ import android.os.SystemClock;
import android.telecom.VideoProfile;
import android.telecom.VideoProfile;
import android.telecom.VideoProfile.VideoState;
import android.telecom.VideoProfile.VideoState;
import android.telephony.Annotation.NetworkType;
import android.telephony.Annotation.NetworkType;
import android.telephony.AnomalyReporter;
import android.telephony.DisconnectCause;
import android.telephony.DisconnectCause;
import android.telephony.ServiceState;
import android.telephony.ServiceState;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
@@ -83,6 +84,7 @@ import java.util.Arrays;
import java.util.HashSet;
import java.util.HashSet;
import java.util.List;
import java.util.List;
import java.util.Set;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Collectors;


/** Collects voice call events per phone ID for the pulled atom. */
/** Collects voice call events per phone ID for the pulled atom. */
@@ -131,6 +133,13 @@ public class VoiceCallSessionStats {
    /** Holds call duration buckets with values as their upper bounds in milliseconds. */
    /** Holds call duration buckets with values as their upper bounds in milliseconds. */
    private static final SparseIntArray CALL_DURATION_MAP = buildCallDurationMap();
    private static final SparseIntArray CALL_DURATION_MAP = buildCallDurationMap();


    /** UUID for reporting concurrent call anomaly */
    private static final UUID CONCURRENT_CALL_ANOMALY_UUID =
            UUID.fromString("76780b5a-623e-48a4-be3f-925e05177c9c");

    /** If the number of concurrent calls exceeds this number, report anomaly*/
    private static final int MAX_NORMAL_CONCURRENT_CALLS = 3;

    /**
    /**
     * Tracks statistics for each call connection, indexed with ID returned by {@link
     * Tracks statistics for each call connection, indexed with ID returned by {@link
     * #getConnectionId}.
     * #getConnectionId}.
@@ -462,6 +471,10 @@ public class VoiceCallSessionStats {
        }
        }


        proto.concurrentCallCountAtStart = mCallProtos.size();
        proto.concurrentCallCountAtStart = mCallProtos.size();
        if (proto.concurrentCallCountAtStart > MAX_NORMAL_CONCURRENT_CALLS) {
            AnomalyReporter.reportAnomaly(
                    CONCURRENT_CALL_ANOMALY_UUID, "Anomalous number of concurrent calls");
        }
        mCallProtos.put(id, proto);
        mCallProtos.put(id, proto);


        // RAT call count needs to be updated
        // RAT call count needs to be updated