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

Commit bae87a00 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "IMS-VT: Add support that controls holding a video call" am: 3e88893c...

Merge "IMS-VT: Add support that controls holding a video call" am: 3e88893c am: b1f16e1c am: 580a18b9

Change-Id: Iaab74cb4bfda5036b009c0a21f0270866614fe9e
parents a4756bc7 580a18b9
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ public abstract class Connection {
    private int mPhoneType;
    private boolean mAnsweringDisconnectsActiveCall;
    private boolean mAllowAddCallDuringVideoCall;
    private boolean mAllowHoldingVideoCall;

    private boolean mIsEmergencyCall;

@@ -1079,6 +1080,14 @@ public abstract class Connection {
        mAllowAddCallDuringVideoCall = allowAddCallDuringVideoCall;
    }

    public boolean shouldAllowHoldingVideoCall() {
        return mAllowHoldingVideoCall;
    }

    public void setAllowHoldingVideoCall(boolean allowHoldingVideoCall) {
        mAllowHoldingVideoCall = allowHoldingVideoCall;
    }

    /**
     * Sets whether the connection is the result of an external call which was pulled to the local
     * device.
+34 −0
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    }
                }
                conn.setAllowAddCallDuringVideoCall(mAllowAddCallDuringVideoCall);
                conn.setAllowHoldingVideoCall(mAllowHoldingVideoCall);
                addConnection(conn);

                setVideoCallProvider(conn, imsCall);
@@ -469,6 +470,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
     */
    private boolean mAllowAddCallDuringVideoCall = true;

    /**
     * Carrier configuration option which determines whether holding a video call
     * should be allowed.
     */
    private boolean mAllowHoldingVideoCall = true;

    /**
     * Carrier configuration option which determines whether to notify the connection if a handover
     * to wifi fails.
@@ -830,6 +837,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        // if there is.
        checkForDialIssues();

        if (!canAddVideoCallDuringImsAudioCall(videoState)) {
            throw new CallStateException("cannot dial in current state");
        }

        if (isPhoneInEcmMode && isEmergencyNumber) {
            handleEcmTimer(ImsPhone.CANCEL_ECM_TIMER);
        }
@@ -1015,6 +1026,9 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        mAllowAddCallDuringVideoCall =
                carrierConfig.getBoolean(
                        CarrierConfigManager.KEY_ALLOW_ADD_CALL_DURING_VIDEO_CALL_BOOL);
        mAllowHoldingVideoCall =
                carrierConfig.getBoolean(
                        CarrierConfigManager.KEY_ALLOW_HOLDING_VIDEO_CALL_BOOL);
        mNotifyVtHandoverToWifiFail = carrierConfig.getBoolean(
                CarrierConfigManager.KEY_NOTIFY_VT_HANDOVER_TO_WIFI_FAILURE_BOOL);
        mSupportDowngradeVtToAudio = carrierConfig.getBoolean(
@@ -1156,6 +1170,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {

            setVideoCallProvider(conn, imsCall);
            conn.setAllowAddCallDuringVideoCall(mAllowAddCallDuringVideoCall);
            conn.setAllowHoldingVideoCall(mAllowHoldingVideoCall);
        } catch (ImsException e) {
            loge("dialInternal : " + e);
            mOperationLocalLog.log("dialInternal exception: " + e);
@@ -1561,6 +1576,25 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            && !mForegroundCall.isFull();
    }

    private boolean canAddVideoCallDuringImsAudioCall(int videoState) {
        if (mAllowHoldingVideoCall) {
            return true;
        }

        ImsCall call = mForegroundCall.getImsCall();
        if (call == null) {
            call = mBackgroundCall.getImsCall();
        }

        boolean isImsAudioCallActiveOrHolding = (mForegroundCall.getState() == Call.State.ACTIVE ||
               mBackgroundCall.getState() == Call.State.HOLDING) && call != null &&
               !call.isVideoCall();

        /* return TRUE if there doesn't exist ims audio call in either active
           or hold states */
        return !isImsAudioCallActiveOrHolding || !VideoProfile.isVideo(videoState);
    }

    /**
     * Determines if there are issues which would preclude dialing an outgoing call.  Throws a
     * {@link CallStateException} if there is an issue.