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

Commit 8b11674d authored by Hall Liu's avatar Hall Liu Committed by Android (Google) Code Review
Browse files

Merge "Stop call waiting tone when call gets answered" into nyc-dev

parents 7776877a 600b0990
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -185,10 +185,7 @@ public class CallAudioManager extends CallsManagerListenerBase {
            }
        }

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

    @Override
@@ -249,13 +246,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
@@ -634,4 +625,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