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

Commit 4a0de328 authored by Virkumar Karavate's avatar Virkumar Karavate Committed by Android (Google) Code Review
Browse files

Merge "Send UNHELD event to connection after SRVCC complets" into udc-dev

parents 28e2f4e2 e9bc0883
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -469,6 +469,15 @@ public class ImsPhoneCall extends Call {
        return mIsRingbackTonePlaying;
    }

    public void maybeClearRemotelyHeldStatus() {
        for (Connection conn : getConnections()) {
            ImsPhoneConnection c = (ImsPhoneConnection) conn;
            if (c.isHeldByRemote()) {
                c.setRemotelyUnheld();
            }
        }
    }

    private void takeOver(ImsPhoneCall that) {
        copyConnectionFrom(that);
        mState = that.mState;
+4 −2
Original line number Diff line number Diff line
@@ -4041,7 +4041,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    mPhone.stopOnHoldTone(conn);
                    mOnHoldToneStarted = false;
                }
                conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_UNHELD, null);
                conn.setRemotelyUnheld();
                mImsCallInfoTracker.updateImsCallStatus(conn, false, true);
            }

@@ -4722,6 +4722,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                // If the dialing call had ringback, ensure it stops now,
                // otherwise it'll keep playing afer the SRVCC completes.
                mForegroundCall.maybeStopRingback();
                mForegroundCall.maybeClearRemotelyHeldStatus();
                mBackgroundCall.maybeClearRemotelyHeldStatus();

                resetState();
                transferHandoverConnections(mForegroundCall);
@@ -5822,7 +5824,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                mOnHoldToneStarted = true;
                mOnHoldToneId = System.identityHashCode(conn);
            }
            conn.onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_HELD, null);
            conn.setRemotelyHeld();
            mImsCallInfoTracker.updateImsCallStatus(conn, true, false);

            boolean useVideoPauseWorkaround = mPhone.getContext().getResources().getBoolean(
+29 −0
Original line number Diff line number Diff line
@@ -152,6 +152,11 @@ public class ImsPhoneConnection extends Connection implements
     */
    private ImsReasonInfo mImsReasonInfo;

    /**
     * Used to indicate that this call is held by remote party.
     */
    private boolean mIsHeldByRemote = false;

    //***** Event Constants
    private static final int EVENT_DTMF_DONE = 1;
    private static final int EVENT_PAUSE_DONE = 2;
@@ -1591,6 +1596,30 @@ public class ImsPhoneConnection extends Connection implements
        onConnectionEvent(android.telecom.Connection.EVENT_MERGE_COMPLETE, null);
    }

    /**
     * Mark the call is held by remote party and inform to the UI.
     */
    public void setRemotelyHeld() {
        mIsHeldByRemote = true;
        onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_HELD, null);
    }

    /**
     * Mark the call is Unheld by remote party and inform to the UI.
     */
    public void setRemotelyUnheld() {
        mIsHeldByRemote = false;
        onConnectionEvent(android.telecom.Connection.EVENT_CALL_REMOTELY_UNHELD, null);
    }

    /**
     * @return whether the remote party is holding the call.
     */
    public boolean isHeldByRemote() {
        Rlog.i(LOG_TAG, "isHeldByRemote=" + mIsHeldByRemote);
        return mIsHeldByRemote;
    }

    public void changeToPausedState() {
        int newVideoState = getVideoState() | VideoProfile.STATE_PAUSED;
        Rlog.i(LOG_TAG, "ImsPhoneConnection: changeToPausedState - setting paused bit; "
+20 −0
Original line number Diff line number Diff line
@@ -317,4 +317,24 @@ public class ImsPhoneCallTest extends TelephonyTest {
            fail("Exception unexpected");
        }
    }

    @Test
    public void testMaybeClearRemotelyHeldStatus() {
        mImsCallUT.attach(mConnection1, Call.State.ACTIVE);
        when(mConnection1.isHeldByRemote()).thenReturn(true);
        mImsCallUT.maybeClearRemotelyHeldStatus();
        verify(mConnection1, times(1)).setRemotelyUnheld();

        mImsCallUT.attach(mConnection2, Call.State.ACTIVE);
        when(mConnection2.isHeldByRemote()).thenReturn(true);
        mImsCallUT.maybeClearRemotelyHeldStatus();
        verify(mConnection1, times(2)).setRemotelyUnheld();
        verify(mConnection2, times(1)).setRemotelyUnheld();

        when(mConnection1.isHeldByRemote()).thenReturn(false);
        when(mConnection2.isHeldByRemote()).thenReturn(false);
        mImsCallUT.maybeClearRemotelyHeldStatus();
        verify(mConnection1, times(2)).setRemotelyUnheld();
        verify(mConnection2, times(1)).setRemotelyUnheld();
    }
}