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

Commit 28cd9add authored by Grant Menke's avatar Grant Menke
Browse files

Ignore requests to remove a connMgr call when there are pending connection attempts.

This CL ensures Telecom checks that (1) a connection manager was used for one of the call attempts in CreateConnectionProcessor and (2) there are still pending attempts processing before ignoring the request to remove an emergency call. This logic change only affects the specific case of an emergency call placed over a connection manager (typically Fi) that still has remaining attempts processing.

Bug: 329462734
Test: manual
Flag: EXEMPT unflagged fix for high priority emergency calling bug targeting June QPR
Change-Id: Ie5867e11fd64681f7183a1bd5c58fa2a52b1717f
parent df621711
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -2540,6 +2540,20 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        }
    }

    boolean completedProcessingAllAttempts() {
        if (mCreateConnectionProcessor != null) {
            return (!mCreateConnectionProcessor.isCallTimedOut() &&
                    mCreateConnectionProcessor.isProcessingComplete());
        } else {
            // If mCreateConnectionProcessor is null then there are no attempts to process:
            return true;
        }
    }

    boolean haveAnyAttemptsUsedConnectionManager() {
        return mCreateConnectionProcessor.haveAnyAttemptsUsedConnectionManager();
    }

    /**
     * Starts the create connection sequence. Upon completion, there should exist an active
     * connection through a connection service (or the call will have failed).
+10 −1
Original line number Diff line number Diff line
@@ -385,9 +385,18 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                            mCallsManager.markCallAsDisconnected(
                                    call, new DisconnectCause(DisconnectCause.REMOTE));
                        }
                        if (!call.completedProcessingAllAttempts() && call.isEmergencyCall() &&
                                call.haveAnyAttemptsUsedConnectionManager()) {
                            // This is the first attempt of an emergency call via a connection
                            // manager. Skip removing the call for now to allow the second attempt
                            // to process OTT:
                            Log.i(this, "removeCall: emergency connMgr call has "
                                    + "not completed processing all attempts so skipping removal");
                        } else {
                            mCallsManager.markCallAsRemoved(call);
                        }
                    }
                }
            } catch (Throwable t) {
                Log.e(ConnectionServiceWrapper.this, t, "");
                throw t;
+15 −3
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {
        // The PhoneAccount which we will tell the target connection service to use
        // for attempting to make the actual phone call
        public final PhoneAccountHandle targetPhoneAccount;
        // This field will be set to true if this call attempt used a connection manager
        public boolean isConnectionManager = false;

        public CallAttemptRecord(
                PhoneAccountHandle connectionManagerPhoneAccount,
@@ -73,9 +75,9 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {

        @Override
        public String toString() {
            return "CallAttemptRecord("
                    + Objects.toString(connectionManagerPhoneAccount) + ","
                    + Objects.toString(targetPhoneAccount) + ")";
            return "CallAttemptRecord( isConnectionManager=[" + isConnectionManager + "], "
                    + "connMgrPhAcc=[" + connectionManagerPhoneAccount + "], targetPhAcc=["
                    + targetPhoneAccount + "])";
        }

        /**
@@ -200,6 +202,15 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {
        return mAttemptRecordIterator.hasNext();
    }

    boolean haveAnyAttemptsUsedConnectionManager() {
        for (CallAttemptRecord attemptRecord : mAttemptRecords) {
            if (attemptRecord.isConnectionManager) {
                return true;
            }
        }
        return false;
    }

    void continueProcessingIfPossible(CreateConnectionResponse response,
            DisconnectCause disconnectCause) {
        Log.v(this, "continueProcessingIfPossible");
@@ -511,6 +522,7 @@ public class CreateConnectionProcessor implements CreateConnectionResponse {
                            && !mAttemptRecords.contains(callAttemptRecord)) {
                        Log.i(this, "Will try Connection Manager account %s for emergency",
                                callManager);
                        callAttemptRecord.isConnectionManager = true;
                        mAttemptRecords.add(callAttemptRecord);
                    }
                }