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

Commit 16235dcc authored by Tyler Gunn's avatar Tyler Gunn Committed by Thomas Stuart
Browse files

Cleanup pending MO call when it disconnects before alerting.

Ensure that where a call is in the pending MO state and gets
disconnected prior to alerting that it will be cleaned up so that other
calls can be placed.

Test: Wrote new unit test for this case.
Fixes: 250229749
Change-Id: I4daa33915fcc3fa5b128175c19827fc332c05d1d
Merged-In: I4daa33915fcc3fa5b128175c19827fc332c05d1d
(cherry picked from commit d62284ae)
parent 1559a67c
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -2827,6 +2827,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            conn.getCall().detach(conn);
            conn.getCall().detach(conn);
            removeConnection(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
            // remove conference participants from the cached list when call is disconnected
            List<ConferenceParticipant> cpList = imsCall.getConferenceParticipants();
            List<ConferenceParticipant> cpList = imsCall.getConferenceParticipants();
            if (cpList != null) {
            if (cpList != null) {
+24 −0
Original line number Original line Diff line number Diff line
@@ -1899,6 +1899,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() {
    private void sendCarrierConfigChanged() {
        Intent intent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        Intent intent = new Intent(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        intent.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, mPhone.getSubId());
        intent.putExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, mPhone.getSubId());