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

Commit d31b3d69 authored by Joonhun Shin's avatar Joonhun Shin Committed by Android (Google) Code Review
Browse files

Merge "Prevent hangup during call merge" into main

parents e6279007 8d7e1ff0
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();