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

Commit 0a6544f2 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Merge "End call after hold failure for emergency calls"

am: ae96ca5d

Change-Id: If8ef375c501dfeb96d363d0de21a710efad8b9ca
parents a33b4c17 ae96ca5d
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.telephony.PreciseDisconnectCause;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.telephony.ims.ImsCallProfile;
import android.telephony.ims.ImsMmTelManager;
@@ -63,7 +64,6 @@ import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsConfigImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
@@ -1891,11 +1891,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    public void cancelUSSD() {
        if (mUssdSession == null) return;

        try {
        mUssdSession.terminate(ImsReasonInfo.CODE_USER_TERMINATED);
        } catch (ImsException e) {
        }

    }

    private synchronized ImsPhoneConnection findConnection(final ImsCall imsCall) {
@@ -2574,6 +2570,16 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    if (mPendingMO != null) {
                        dialPendingMO();
                    }
                    mHoldSwitchingState = HoldSwapState.INACTIVE;
                } else if (mPendingMO.isEmergency()) {
                    // If mPendingMO is an emergency call, disconnect the call that we tried to
                    // hold.
                    mBackgroundCall.getImsCall().terminate(ImsReasonInfo.CODE_UNSPECIFIED);
                    if (imsCall != mCallExpectedToResume) {
                        mCallExpectedToResume = null;
                    }
                    // Leave mHoldSwitchingState as is for now -- we'll reset it
                    // in onCallTerminated, which will also dial the outgoing emergency call.
                } else if (bgState == ImsPhoneCall.State.ACTIVE) {
                    mForegroundCall.switchWith(mBackgroundCall);

@@ -2584,8 +2590,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                    if (imsCall != mCallExpectedToResume) {
                        mCallExpectedToResume = null;
                    }
                }
                    mHoldSwitchingState = HoldSwapState.INACTIVE;
                }
                mPhone.notifySuppServiceFailed(Phone.SuppService.HOLD);
            }
            mMetrics.writeOnImsCallHoldFailed(mPhone.getPhoneId(), imsCall.getCallSession(),
@@ -3984,11 +3990,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                log("downgradeVideoCall :: callId=" + conn.getTelecomCallId()
                        + " Disconnect call.");
                // At this point the only choice we have is to terminate the call.
                try {
                imsCall.terminate(ImsReasonInfo.CODE_USER_TERMINATED, reasonCode);
                } catch (ImsException ie) {
                    loge("Couldn't terminate call " + imsCall);
                }
            }
        }
    }