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

Commit c9b6eb11 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Add support for rejecting Telecom call with a specified reason.

Adding a new Call API which supports passing a user-specified call
rejection reason down to the lower layers for reporting to the network.
Part of the VERSTAT spec involves support for this type of signaling, so
it makes sense to also support it here as well.
There are two potential types of reject reason:
declined - user declined the call because they want it to go to voicemail
or don't want to talk to the caller right now.
unwanted - this is a nuisance call and the user never wanted to receive it.

Bug: 135929421
Test: Added new CTS test to validate API pathways.
Test: Ran existing telecom and telephony unit tests.
Test: Modified test dialer app to use the new reject API and verified that
the reject reason signals down to the modem and translates to the correct
reject cause.

Change-Id: Ia09d73c72eb2a0be92195ab00bdbfe5a64ff16e0
parent b9072fec
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ public abstract class Call {
    @UnsupportedAppUsage
    public abstract void hangup() throws CallStateException;

    public abstract void hangup(@android.telecom.Call.RejectReason int rejectReason)
            throws CallStateException;

    /**
     * hasConnection
+10 −0
Original line number Diff line number Diff line
@@ -61,6 +61,16 @@ public class GsmCdmaCall extends Call {
        mOwner.hangup(this);
    }

    /**
     * Hangup the ringing call with a specified reason; reason is not supported on GSM/CDMA.
     * @param rejectReason
     */
    @Override
    public void hangup(@android.telecom.Call.RejectReason int rejectReason)
            throws CallStateException {
        mOwner.hangup(this);
    }

    @Override
    public String toString() {
        return mState.toString();
+6 −0
Original line number Diff line number Diff line
@@ -60,6 +60,12 @@ public class ImsExternalCall extends Call {

    }

    @Override
    public void hangup(@android.telecom.Call.RejectReason int rejectReason)
            throws CallStateException {
        // tumbleweed
    }

    /**
     * Sets the call state to active.
     */
+6 −0
Original line number Diff line number Diff line
@@ -122,6 +122,12 @@ public class ImsPhoneCall extends Call {
        mOwner.hangup(this);
    }

    @Override
    public void hangup(@android.telecom.Call.RejectReason int rejectReason)
            throws CallStateException {
        mOwner.hangup(this, rejectReason);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
+11 −2
Original line number Diff line number Diff line
@@ -1856,7 +1856,12 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
    //***** Called from ImsPhoneCall

    public void hangup (ImsPhoneCall call) throws CallStateException {
        if (DBG) log("hangup call");
        hangup(call, android.telecom.Call.REJECT_REASON_DECLINED);
    }

    public void hangup (ImsPhoneCall call, @android.telecom.Call.RejectReason int rejectReason)
            throws CallStateException {
        if (DBG) log("hangup call - reason=" + rejectReason);

        if (call.getConnections().size() == 0) {
            throw new CallStateException("no connections");
@@ -1893,7 +1898,11 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        try {
            if (imsCall != null) {
                if (rejectCall) {
                    if (rejectReason == android.telecom.Call.REJECT_REASON_UNWANTED) {
                        imsCall.reject(ImsReasonInfo.CODE_SIP_USER_MARKED_UNWANTED);
                    } else {
                        imsCall.reject(ImsReasonInfo.CODE_USER_DECLINE);
                    }
                    mMetrics.writeOnImsCommand(mPhone.getPhoneId(), imsCall.getSession(),
                            ImsCommand.IMS_CMD_REJECT);
                } else {
Loading