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

Commit 04fe1c57 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "IMS: Explicit Call transfer APIS." am: 5b30d4c6

Change-Id: I55b0485b63f41d31c5f57f722032082f21df6a3e
parents 768c2f92 5b30d4c6
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
@@ -486,6 +486,17 @@ public class ImsCall implements ICall {
        public void onRttAudioIndicatorChanged(ImsCall imsCall, ImsStreamMediaProfile profile) {
        }

        /**
         * Notifies the result of transfer request.
         *
         * @param imsCall ImsCall object
         */
        public void onCallSessionTransferred(ImsCall imsCall) {
        }

        public void onCallSessionTransferFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) {
        }

        /**
         * Called when the call quality has changed.
         *
@@ -1253,6 +1264,56 @@ public class ImsCall implements ICall {
        }
    }

    /**
     * Transfers a call.
     *
     * @param number number to be transferred to.
     * @param isConfirmationRequired indicates blind or assured transfer.
     * @throws ImsException if the IMS service fails to transfer the call.
     */
    public void transfer(String number, boolean isConfirmationRequired) throws ImsException {
        logi("transfer :: session=" + mSession + ", number=" + Rlog.pii(TAG, number) +
                ", isConfirmationRequired=" + isConfirmationRequired);

        synchronized(mLockObj) {
            if (mSession == null) {
                throw new ImsException("No call to transfer",
                        ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED);
            }

            try {
                mSession.transfer(number, isConfirmationRequired);
            } catch (Throwable t) {
                loge("transfer :: ", t);
                throw new ImsException("transfer()", t, 0);
            }
        }
    }

    /**
     * Transfers a call to another ongoing call.
     *
     * @param transferToImsCall the other ongoing call to which this call will be transferred.
     * @throws ImsException if the IMS service fails to transfer the call.
     */
    public void consultativeTransfer(ImsCall transferToImsCall) throws ImsException {
        logi("consultativeTransfer :: session=" + mSession + ", other call=" + transferToImsCall);

        synchronized(mLockObj) {
            if (mSession == null) {
                throw new ImsException("No call to transfer",
                        ImsReasonInfo.CODE_LOCAL_CALL_TERMINATED);
            }

            try {
                mSession.transfer(transferToImsCall.getSession());
            } catch (Throwable t) {
                loge("consultativeTransfer :: ", t);
                throw new ImsException("consultativeTransfer()", t, 0);
            }
        }
    }

    public void terminate(int reason, int overrideReason) {
        logi("terminate :: reason=" + reason + " ; overrideReason=" + overrideReason);
        mOverrideReason = overrideReason;
@@ -3238,6 +3299,40 @@ public class ImsCall implements ICall {
            }
        }

        @Override
        public void callSessionTransferred(ImsCallSession session) {
            ImsCall.Listener listener;

            synchronized(ImsCall.this) {
                listener = mListener;
            }

            if (listener != null) {
                try {
                    listener.onCallSessionTransferred(ImsCall.this);
                } catch (Throwable t) {
                    loge("callSessionTransferred:: ", t);
                }
            }
        }

        @Override
        public void callSessionTransferFailed(ImsCallSession session, ImsReasonInfo reasonInfo) {
            ImsCall.Listener listener;

            synchronized(ImsCall.this) {
                listener = mListener;
            }

            if (listener != null) {
                try {
                    listener.onCallSessionTransferFailed(ImsCall.this, reasonInfo);
                } catch (Throwable t) {
                    loge("callSessionTransferFailed:: ", t);
                }
            }
        }

        @Override
        public void callQualityChanged(CallQuality callQuality) {
            ImsCall.Listener listener;