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

Commit 8fc5dc68 authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Cleanup pending MO call when it disconnects before alerting. am: 16235dcc

parents 690d25e2 16235dcc
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2799,6 +2799,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            conn.getCall().detach(conn);
            removeConnection(conn);

            // If the call being disconnected was the pending MO call we should clear it.
            if (mPendingMO == conn) {
                mPendingMO.finalize();
                mPendingMO = null;
            }

            // remove conference participants from the cached list when call is disconnected
            List<ConferenceParticipant> cpList = imsCall.getConferenceParticipants();
            if (cpList != null) {
+24 −0
Original line number Diff line number Diff line
@@ -1902,6 +1902,30 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        }
    }

    /**
     * Tests the case where a dialed call has not yet moved beyond the "pending MO" phase, but the
     * user then disconnects.  In such a case we need to ensure that the pending MO reference is
     * cleared so that another call can be placed.
     */
    @Test
    @SmallTest
    public void testCallDisconnectBeforeActive() {
        ImsPhoneConnection connection = placeCall();
        assertEquals(1, mCTUT.getConnections().size());
        // Call is the pending MO right now.
        assertEquals(connection, mCTUT.getPendingMO());
        assertEquals(Call.State.DIALING, mCTUT.mForegroundCall.getState());
        assertEquals(PhoneConstants.State.OFFHOOK, mCTUT.getState());

        mImsCallListener.onCallTerminated(connection.getImsCall(),
                new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED_BY_REMOTE, 0));
        // Make sure pending MO got nulled out.
        assertNull(mCTUT.getPendingMO());

        // Try making another call; it should not fail.
        ImsPhoneConnection connection2 = placeCall();
    }

    private void sendCarrierConfigChanged() {
        Intent intent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        intent.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, mPhone.getSubId());