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

Commit 600b0990 authored by Hall Liu's avatar Hall Liu
Browse files

Stop call waiting tone when call gets answered

If the call being answered is the only ringing call, stop the call
waiting tone even if it's still in the ringing state.

Bug: 27659457
Change-Id: I5afb3843fc1c27575947f933bb50e7b664c718dc
parent 65bd3e5a
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -184,10 +184,7 @@ public class CallAudioManager extends CallsManagerListenerBase {
            }
        }

        if (mRingingCalls.size() == 0) {
            mRinger.stopRinging();
            mRinger.stopCallWaiting();
        }
        maybeStopRingingAndCallWaitingForAnsweredOrRejectedCall(call);
    }

    @Override
@@ -248,13 +245,7 @@ public class CallAudioManager extends CallsManagerListenerBase {

    @Override
    public void onIncomingCallRejected(Call call, boolean rejectWithMessage, String message) {
        // This gets called after the UI rejects a call but before the CS processes the rejection.
        // Will get called before the state change from ringing to not ringing.

        if (mRingingCalls.size() == 0 || call == mRingingCalls.iterator().next()) {
            mRinger.stopRinging();
            mRinger.stopCallWaiting();
        }
        maybeStopRingingAndCallWaitingForAnsweredOrRejectedCall(call);
    }

    @Override
@@ -623,4 +614,14 @@ public class CallAudioManager extends CallsManagerListenerBase {
            if (call != null) pw.println(call.getId());
        }
    }

    private void maybeStopRingingAndCallWaitingForAnsweredOrRejectedCall(Call call) {
        // Check to see if the call being answered/rejected is the only ringing call, since this
        // will be called before the connection service acknowledges the state change.
        if (mRingingCalls.size() == 0 ||
                (mRingingCalls.size() == 1 && call == mRingingCalls.iterator().next())) {
            mRinger.stopRinging();
            mRinger.stopCallWaiting();
        }
    }
}
 No newline at end of file