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

Commit 07a279af authored by Hall Liu's avatar Hall Liu
Browse files

Fix issues associated with hold failure

Upon hold failure, reset all ANSWERED calls back to RINGING so that the
user can attempt the operation again.

Fixes: 128275255
Test: manual
Change-Id: I860a493bf1e514c06f7d9bc3122eb777cd1ca487
parent e211c69d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        void onConferenceStateChanged(Call call, boolean isConference);
        boolean onCanceledViaNewOutgoingCallBroadcast(Call call, long disconnectionTimeout);
        void onHoldToneRequested(Call call);
        void onCallHoldFailed(Call call);
        void onConnectionEvent(Call call, String event, Bundle extras);
        void onExternalCallChanged(Call call, boolean isExternalCall);
        void onRttInitiationFailure(Call call, int reason);
@@ -210,6 +211,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
        @Override
        public void onHoldToneRequested(Call call) {}
        @Override
        public void onCallHoldFailed(Call call) {}
        @Override
        public void onConnectionEvent(Call call, String event, Bundle extras) {}
        @Override
        public void onExternalCallChanged(Call call, boolean isExternalCall) {}
@@ -3043,6 +3046,10 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
            for (Listener l : mListeners) {
                l.onHoldToneRequested(this);
            }
        } else if (Connection.EVENT_CALL_HOLD_FAILED.equals(event)) {
            for (Listener l : mListeners) {
                l.onCallHoldFailed(this);
            }
        } else {
            for (Listener l : mListeners) {
                l.onConnectionEvent(this, event, extras);
+1 −0
Original line number Diff line number Diff line
@@ -534,6 +534,7 @@ public class CallAudioManager extends CallsManagerListenerBase {
                onCallLeavingActiveDialingOrConnecting();
                break;
            case CallState.RINGING:
            case CallState.ANSWERED:
                onCallLeavingRinging();
                break;
            case CallState.ON_HOLD:
+12 −0
Original line number Diff line number Diff line
@@ -913,6 +913,18 @@ public class CallsManager extends Call.ListenerBase
        return mCallAudioManager.getForegroundCall();
    }

    @Override
    public void onCallHoldFailed(Call call) {
        // Normally, we don't care whether a call hold has failed. However, if a call was held in
        // order to answer an incoming call, that incoming call needs to be brought out of the
        // ANSWERED state so that the user can try the operation again.
        for (Call call1 : mCalls) {
            if (call1 != call && call1.getState() == CallState.ANSWERED) {
                setCallState(call1, CallState.RINGING, "hold failed on other call");
            }
        }
    }

    @Override
    public UserHandle getCurrentUserHandle() {
        return mCurrentUserHandle;