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

Commit 8d7e1ff0 authored by joonhunshin's avatar joonhunshin Committed by Joonhun Shin
Browse files

Prevent hangup during call merge

Bug: 317070933
Flag: com.android.internal.telephony.flags.prevent_hangup_during_call_merge
Test: atest ImsPhoneCallTackerTest.java
      manual test with ATT SIM
Change-Id: I9811962dd02a085fe9a52dd8982690098e7d18bc
parent caace341
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -2878,6 +2878,14 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        ImsPhoneConnection conn = findConnection(imsCall);
        boolean rejectCall = false;

        if (mFeatureFlags.preventHangupDuringCallMerge()) {
            if (imsCall.isCallSessionMergePending()) {
                if (DBG) log("hangup call failed during call merge");

                throw new CallStateException("can not hangup during call merge");
            }
        }

        String logResult = "(undefined)";
        if (call == mRingingCall) {
            logResult = "(ringing) hangup incoming";
+26 −0
Original line number Diff line number Diff line
@@ -2774,6 +2774,32 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        assertNetworkStatsEquals(expectedStats, uidStatsCaptor.getValue());
    }

    @Test
    public void testPreventHangupDuringCallMerge() {
        // Enable feature flag
        doReturn(true).when(mFeatureFlags).preventHangupDuringCallMerge();

        // Change carrier config to allow call hold for 2nd call setup
        PersistableBundle bundle = mContextFixture.getCarrierConfigBundle();
        bundle.putBoolean(CarrierConfigManager.KEY_ALLOW_HOLD_VIDEO_CALL_BOOL, true);
        mCTUT.updateCarrierConfigCache(bundle);

        // Place a call.
        placeCallAndMakeActive();
        // Place a 2nd call
        ImsPhoneConnection imsPhoneConnection = placeCallAndMakeActive();

        // Try call merge
        mCTUT.conference();

        try {
            mCTUT.hangup(imsPhoneConnection.getCall());
            fail("Expect CallStateException but not");
        } catch  (CallStateException e) {
            // Expected exception
        }
    }

    private ImsPhoneConnection placeCallAndMakeActive() {
        ImsPhoneConnection connection = placeCall();
        ImsCall imsCall = connection.getImsCall();