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

Commit ddd966e7 authored by Bryce Lee's avatar Bryce Lee
Browse files

Properly route rejection reply when capability is set.

The telephony stack can be present on devices that do not have a cellular
radio. For example, connections can be established over wifi. In these
scenarios, having the replies handled by the default sms app is not
sufficient.

This CL works in conjunction with a framework change to allow connections
to mark themselves as capable of handling reply messages. In this case,
the call should route the reply back to the connection rather than have it
handled through sms.

Change-Id: I26a13496e3cff596ba950bf9abed35c36b917721
parent c0f2dd07
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1091,7 +1091,7 @@ public class Call implements CreateConnectionResponse {
            // Ensure video state history tracks video state at time of rejection.
            mVideoStateHistory |= mVideoState;

            mConnectionService.reject(this);
            mConnectionService.reject(this, rejectWithMessage, textMessage);
            Log.event(this, Log.Events.REQUEST_REJECT);
        }
    }
+8 −2
Original line number Diff line number Diff line
@@ -774,12 +774,18 @@ final class ConnectionServiceWrapper extends ServiceBinder {
    }

    /** @see IConnectionService#reject(String) */
    void reject(Call call) {
    void reject(Call call, boolean rejectWithMessage, String message) {
        final String callId = mCallIdMapper.getCallId(call);
        if (callId != null && isServiceValid("reject")) {
            try {
                logOutgoing("reject %s", callId);

                if (rejectWithMessage && call.can(
                        android.telecom.Call.Details.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION)) {
                    mServiceInterface.rejectWithMessage(callId, message);
                } else {
                    mServiceInterface.reject(callId);
                }
            } catch (RemoteException e) {
            }
        }
+4 −2
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.os.Looper;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.telecom.AudioState;
import android.telecom.CallAudioState;
import android.telecom.Connection;
import android.telecom.DefaultDialerManager;
@@ -770,7 +769,10 @@ public final class InCallController extends CallsManagerListenerBase {
        android.telecom.Call.Details.CAPABILITY_CAN_UPGRADE_TO_VIDEO,

        Connection.CAPABILITY_CAN_PAUSE_VIDEO,
        android.telecom.Call.Details.CAPABILITY_CAN_PAUSE_VIDEO
        android.telecom.Call.Details.CAPABILITY_CAN_PAUSE_VIDEO,

        Connection.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION,
        android.telecom.Call.Details.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION
    };

    private static int convertConnectionToCallCapabilities(int connectionCapabilities) {
+4 −1
Original line number Diff line number Diff line
@@ -126,7 +126,10 @@ public class RespondViaSmsManager extends CallsManagerListenerBase {

    @Override
    public void onIncomingCallRejected(Call call, boolean rejectWithMessage, String textMessage) {
        if (rejectWithMessage && call.getHandle() != null) {
        if (rejectWithMessage
                && call.getHandle() != null
                && !call.can(
                        android.telecom.Call.Details.CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION)) {
            int subId = mCallsManager.getPhoneAccountRegistrar().getSubscriptionIdForPhoneAccount(
                    call.getTargetPhoneAccount());
            rejectCallWithMessage(call.getContext(), call.getHandle().getSchemeSpecificPart(),
+3 −0
Original line number Diff line number Diff line
@@ -106,6 +106,9 @@ public class ConnectionServiceFixture implements TestFixture<IConnectionService>
        @Override
        public void reject(String callId) throws RemoteException { }

        @Override
        public void rejectWithMessage(String callId, String message) throws RemoteException { }

        @Override
        public void disconnect(String callId) throws RemoteException { }