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

Commit 5939975f authored by Hall Liu's avatar Hall Liu
Browse files

Add logic to handle resume failure

When a single call fails to resume, swap it back into the background in
ImsPhoneCallTracker, and don't retry the resumption -- wait for the user
to perform the operation again.

Fixes: 129450658
Test: manual
Change-Id: Ibd31558d2db6ae2eccef4d43f2a22486f33bb602
parent ecdd22b5
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -1252,7 +1252,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    }

    /**
     * Unhold the currently held call, possibly putting the already-active call on hold if present.
     * Unhold the currently held call.
     */
    void unholdHeldCall() throws CallStateException {
        try {
@@ -1265,6 +1265,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
            if (imsCall != null) {
                mCallExpectedToResume = imsCall;
                mHoldSwitchingState = HoldSwapState.PENDING_SINGLE_CALL_UNHOLD;
                mForegroundCall.switchWith(mBackgroundCall);
                logHoldSwapState("unholdCurrentCall");
                imsCall.resume();
                mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(),
@@ -2552,8 +2553,8 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        @Override
        public void onCallResumeFailed(ImsCall imsCall, ImsReasonInfo reasonInfo) {
            if (mHoldSwitchingState == HoldSwapState.SWAPPING_ACTIVE_AND_HELD
                    || mHoldSwitchingState == HoldSwapState.PENDING_RESUME_FOREGROUND_AFTER_FAILURE
                    || mHoldSwitchingState == HoldSwapState.PENDING_SINGLE_CALL_UNHOLD) {
                    || mHoldSwitchingState
                    == HoldSwapState.PENDING_RESUME_FOREGROUND_AFTER_FAILURE) {
                // If we are in the midst of swapping the FG and BG calls and
                // we got a resume fail, we need to swap back the FG and BG calls.
                // Since the FG call was held, will also try to resume the same.
@@ -2571,7 +2572,21 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
                //Call swap is done, reset the relevant variables
                mCallExpectedToResume = null;
                mHoldSwitchingState = HoldSwapState.INACTIVE;
                logHoldSwapState("onCallResumeFailed");
                logHoldSwapState("onCallResumeFailed: multi calls");
            } else if (mHoldSwitchingState == HoldSwapState.PENDING_SINGLE_CALL_UNHOLD) {
                if (imsCall == mCallExpectedToResume) {
                    if (DBG) {
                        log("onCallResumeFailed: single call unhold case");
                    }
                    mForegroundCall.switchWith(mBackgroundCall);

                    mCallExpectedToResume = null;
                    mHoldSwitchingState = HoldSwapState.INACTIVE;
                    logHoldSwapState("onCallResumeFailed: single call");
                } else {
                    Rlog.w(LOG_TAG, "onCallResumeFailed: got a resume failed for a different call"
                            + " in the single call unhold case");
                }
            }
            mPhone.notifySuppServiceFailed(Phone.SuppService.RESUME);
            mMetrics.writeOnImsCallResumeFailed(mPhone.getPhoneId(), imsCall.getCallSession(),