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

Commit 5b28132e authored by Ihab Awad's avatar Ihab Awad
Browse files

Attempt to unhold remaining holding call on disconnect (1/2)

Bug: 17480900
Change-Id: I9d16419a969f833aa830de7f9ab5df8772a935c4
parent 15608a8f
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.google.common.collect.ImmutableList;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
@@ -117,6 +118,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
@@ -566,6 +568,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();
        }
    }
@@ -704,7 +707,6 @@ public final class CallsManager extends Call.ListenerBase {
    void markCallAsDisconnected(Call call, DisconnectCause disconnectCause) {
        call.setDisconnectCause(disconnectCause);
        setCallState(call, CallState.DISCONNECTED);
        removeCall(call);
    }

    /**
@@ -712,6 +714,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();
            }
        }
    }

    /**
@@ -988,9 +996,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);
            }
+0 −1
Original line number Diff line number Diff line
@@ -426,7 +426,6 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
            logIncoming("removeCall %s", callId);
            if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) {
                mHandler.obtainMessage(MSG_REMOVE_CALL, callId).sendToTarget();
                mHandler.obtainMessage(MSG_REMOVE_CALL, callId);
            }
        }