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

Commit d8f62ec4 authored by John Wang's avatar John Wang Committed by Android Git Automerger
Browse files

am a48dc39b: Add hangupForegroundResumeBackground().

Merge commit 'a48dc39b' into gingerbread-plus-aosp

* commit 'a48dc39b':
  Add hangupForegroundResumeBackground().
parents f2bf6d6e a48dc39b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -465,6 +465,33 @@ public final class CallManager {
        }
    }

    /**
     * Hangup foreground call and resume the specific background call
     *
     * Note: this is noop if there is no foreground call or the heldCall is null
     *
     * @param heldCall to become foreground
     * @throws CallStateException
     */
    public void hangupForegroundResumeBackground(Call heldCall) throws CallStateException {
        Phone foregroundPhone = null;
        Phone backgroundPhone = null;

        if (hasActiveFgCall()) {
            foregroundPhone = getFgPhone();
            if (heldCall != null) {
                backgroundPhone = heldCall.getPhone();
                if (foregroundPhone == backgroundPhone) {
                    getActiveFgCall().hangup();
                } else {
                // the call to be hangup and resumed belongs to different phones
                    getActiveFgCall().hangup();
                    switchHoldingAndActive(heldCall);
                }
            }
        }
    }

    /**
     * Whether or not the phone can conference in the current phone
     * state--that is, one call holding and one call active.