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

Commit 8df44561 authored by Ihab Awad's avatar Ihab Awad Committed by Android Git Automerger
Browse files

am bb907d48: Merge "Attempt to unhold remaining holding call on disconnect (1/2)" into lmp-dev

* commit 'bb907d48':
  Attempt to unhold remaining holding call on disconnect (1/2)
parents e4caa11d bb907d48
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableList;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -114,6 +115,7 @@ public final class CallsManager extends Call.ListenerBase {
    private final Context mContext;
    private final PhoneAccountRegistrar mPhoneAccountRegistrar;
    private final MissedCallNotifier mMissedCallNotifier;
    private final Set<Call> mLocallyDisconnectingCalls = new HashSet<>();

    /**
     * The call the user is currently interacting with. This is the call that should have audio
@@ -571,6 +573,7 @@ public final class CallsManager extends Call.ListenerBase {
        if (!mCalls.contains(call)) {
            Log.w(this, "Unknown call (%s) asked to disconnect", call);
        } else {
            mLocallyDisconnectingCalls.add(call);
            call.disconnect();
        }
    }
@@ -709,7 +712,6 @@ public final class CallsManager extends Call.ListenerBase {
    void markCallAsDisconnected(Call call, DisconnectCause disconnectCause) {
        call.setDisconnectCause(disconnectCause);
        setCallState(call, CallState.DISCONNECTED);
        removeCall(call);
    }

    /**
@@ -717,6 +719,12 @@ public final class CallsManager extends Call.ListenerBase {
     */
    void markCallAsRemoved(Call call) {
        removeCall(call);
        if (mLocallyDisconnectingCalls.contains(call)) {
            mLocallyDisconnectingCalls.remove(call);
            if (mForegroundCall != null && mForegroundCall.getState() == CallState.ON_HOLD) {
                mForegroundCall.unhold();
            }
        }
    }

    /**
@@ -1009,9 +1017,7 @@ public final class CallsManager extends Call.ListenerBase {
            Log.v(this, "Updating foreground call, %s -> %s.", mForegroundCall, newForegroundCall);
            Call oldForegroundCall = mForegroundCall;
            mForegroundCall = newForegroundCall;
            if (mForegroundCall != null && mForegroundCall.getState() == CallState.ON_HOLD) {
                mForegroundCall.unhold();
            }

            for (CallsManagerListener listener : mListeners) {
                listener.onForegroundCallChanged(oldForegroundCall, mForegroundCall);
            }