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

Commit 0d647917 authored by Hariprasad Jayakumar's avatar Hariprasad Jayakumar Committed by Linux Build Service Account
Browse files

Telephony: CDMA - Handle call collision scenarios

There can be 2 types of call collisions
    - Modem/RIL dropping an existing call and replace it with
      another one with the same call id (index)
    - Modem/RIL, after ending the previous call, reports the new
      call with a different call id
Both these above cases have been handled to avert undesirable
behavior at telephony layer.
CRs-Fixed: 453390

Change-Id: I65d8d941ccec63be754ca79c36bef34618fb1fb1
parent 62e1e103
Loading
Loading
Loading
Loading
+44 −20
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.RegistrantList;
import android.telephony.PhoneNumberUtils;
import android.telephony.ServiceState;
import android.telephony.Rlog;
import android.text.TextUtils;
import android.os.SystemProperties;

import com.android.internal.telephony.CallStateException;
@@ -53,7 +54,7 @@ public final class CdmaCallTracker extends CallTracker {

    //***** Constants

    static final int MAX_CONNECTIONS = 1;   // only 1 connection allowed in CDMA
    static final int MAX_CONNECTIONS = 2;   // only 2 connections allowed in CDMA
    static final int MAX_CONNECTIONS_PER_CALL = 1; // only 1 connection allowed per call

    //***** Instance Variables
@@ -515,6 +516,19 @@ public final class CdmaCallTracker extends CallTracker {
            if (DBG_POLL) log("poll: conn[i=" + i + "]=" +
                    conn+", dc=" + dc);

            if (conn != null && dc != null && !TextUtils.isEmpty(conn.mAddress)
                    && !conn.compareTo(dc)) {
                // This means we received a different call than we expected in the call list.
                // Drop the call, and set conn to null, so that the dc can be processed as a new
                // call by the logic below.
                // This may happen if for some reason the modem drops the call, and replaces it
                // with another one, but still using the same index (for instance, if BS drops our
                // MO and replaces with an MT due to priority rules)
                log("New call with same index. Dropping old call");
                mDroppedDuringPoll.add(conn);
                conn = null;
            }

            if (conn == null && dc != null) {
                // Connection appeared in CLCC response that we don't know about
                if (mPendingMO != null && mPendingMO.compareTo(dc)) {
@@ -560,13 +574,21 @@ public final class CdmaCallTracker extends CallTracker {
                }
                hasNonHangupStateChanged = true;
            } else if (conn != null && dc == null) {
                if (dcSize != 0)
                {
                    // This happens if the call we are looking at (index i)
                    // got dropped but the call list is not yet empty.
                    log("conn != null, dc == null. Still have connections in the call list");
                    mDroppedDuringPoll.add(conn);
                } else {
                    // This case means the RIL has no more active call anymore and
                    // we need to clean up the foregroundCall and ringingCall.
                    // Loop through foreground call connections as
                    // it contains the known logical connections.
                    int count = mForegroundCall.mConnections.size();
                    for (int n = 0; n < count; n++) {
                    if (Phone.DEBUG_PHONE) log("adding fgCall cn " + n + " to droppedDuringPoll");
                        if (Phone.DEBUG_PHONE)
                            log("adding fgCall cn " + n + " to droppedDuringPoll");
                        CdmaConnection cn = (CdmaConnection) mForegroundCall.mConnections.get(n);
                        mDroppedDuringPoll.add(cn);
                    }
@@ -574,12 +596,14 @@ public final class CdmaCallTracker extends CallTracker {
                    // Loop through ringing call connections as
                    // it may contain the known logical connections.
                    for (int n = 0; n < count; n++) {
                    if (Phone.DEBUG_PHONE) log("adding rgCall cn " + n + " to droppedDuringPoll");
                        if (Phone.DEBUG_PHONE)
                            log("adding rgCall cn " + n + " to droppedDuringPoll");
                        CdmaConnection cn = (CdmaConnection) mRingingCall.mConnections.get(n);
                        mDroppedDuringPoll.add(cn);
                    }
                    mForegroundCall.setGeneric(false);
                    mRingingCall.setGeneric(false);
                }

                // Re-start Ecm timer when the connected emergency call ends
                if (mIsEcmTimerCanceled) {