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

Commit 7d58ba53 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

When bg call does not support hold, auto-unhold on disconnect of fg call.

When disconnecting a call and the new foreground call is a held call
that does not support hold, auto-unhold that call.  This handles the
scenario where a carrier (for example) does not support hold, and a call
disconnect causes a background call to be on hold.  Since the carrier does
not support hold/unhold, the UX will provide no means to unhold the call.

Bug: 28813047
Change-Id: I4fe7410e5ef49297bdfb968d2e03a1594fa0d897
parent 6df997ac
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -1390,12 +1390,21 @@ public class CallsManager extends Call.ListenerBase
     */
     */
    void markCallAsRemoved(Call call) {
    void markCallAsRemoved(Call call) {
        removeCall(call);
        removeCall(call);
        Call foregroundCall = mCallAudioManager.getPossiblyHeldForegroundCall();
        if (mLocallyDisconnectingCalls.contains(call)) {
        if (mLocallyDisconnectingCalls.contains(call)) {
            mLocallyDisconnectingCalls.remove(call);
            mLocallyDisconnectingCalls.remove(call);
            Call foregroundCall = mCallAudioManager.getPossiblyHeldForegroundCall();
            if (foregroundCall != null && foregroundCall.getState() == CallState.ON_HOLD) {
            if (foregroundCall != null && foregroundCall.getState() == CallState.ON_HOLD) {
                foregroundCall.unhold();
                foregroundCall.unhold();
            }
            }
        } else if (foregroundCall != null &&
                !foregroundCall.can(Connection.CAPABILITY_SUPPORT_HOLD)  &&
                foregroundCall.getState() == CallState.ON_HOLD) {

            // The new foreground call is on hold, however the carrier does not display the hold
            // button in the UI.  Therefore, we need to auto unhold the held call since the user has
            // no means of unholding it themselves.
            Log.i(this, "Auto-unholding held foreground call (call doesn't support hold)");
            foregroundCall.unhold();
        }
        }
    }
    }