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

Commit d8616fee authored by Grace Jia's avatar Grace Jia Committed by Automerger Merge Worker
Browse files

Merge "merge onReject into onDisconnect, propagate cause" into udc-dev am: 025cfd99

parents bc162036 025cfd99
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -42066,8 +42066,7 @@ package android.telecom {
  public interface CallControlCallback {
    method public void onAnswer(int, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onCallStreamingStarted(@NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onDisconnect(@NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onReject(@NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onDisconnect(@NonNull android.telecom.DisconnectCause, @NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onSetActive(@NonNull java.util.function.Consumer<java.lang.Boolean>);
    method public void onSetInactive(@NonNull java.util.function.Consumer<java.lang.Boolean>);
  }
+8 −15
Original line number Diff line number Diff line
@@ -74,25 +74,18 @@ public interface CallControlCallback {
    void onAnswer(@android.telecom.CallAttributes.CallType int videoState,
            @NonNull Consumer<Boolean> wasCompleted);

    /**
     * Telecom is informing the client to reject the incoming call
     *
     * @param wasCompleted The {@link Consumer} to be completed. If the client can reject the
     *                     incoming call, {@link Consumer#accept(Object)} should be called with
     *                     {@link Boolean#TRUE}. Otherwise, {@link Consumer#accept(Object)}
     *                     should  be called with {@link Boolean#FALSE}.
     */
    void onReject(@NonNull Consumer<Boolean> wasCompleted);

    /**
     * Telecom is informing the client to disconnect the call
     *
     * @param wasCompleted The {@link Consumer} to be completed. If the client can disconnect the
     *                     call on their end, {@link Consumer#accept(Object)} should be called with
     *                     {@link Boolean#TRUE}. Otherwise, {@link Consumer#accept(Object)}
     *                     should  be called with {@link Boolean#FALSE}.
     * @param disconnectCause represents the cause for disconnecting the call.
     * @param wasCompleted    The {@link Consumer} to be completed. If the client can disconnect
     *                        the call on their end, {@link Consumer#accept(Object)} should be
     *                        called with {@link Boolean#TRUE}. Otherwise,
     *                        {@link Consumer#accept(Object)} should  be called with
     *                        {@link Boolean#FALSE}.
     */
    void onDisconnect(@NonNull Consumer<Boolean> wasCompleted);
    void onDisconnect(@NonNull DisconnectCause disconnectCause,
            @NonNull Consumer<Boolean> wasCompleted);

    /**
     * Telecom is informing the client to set the call in streaming.
+14 −22
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.telecom.CallControlCallback;
import android.telecom.CallEndpoint;
import android.telecom.CallEventCallback;
import android.telecom.CallException;
import android.telecom.DisconnectCause;
import android.telecom.PhoneAccountHandle;
import android.text.TextUtils;
import android.util.Log;
@@ -142,7 +143,6 @@ public class ClientTransactionalServiceWrapper {
        private static final String ON_SET_ACTIVE = "onSetActive";
        private static final String ON_SET_INACTIVE = "onSetInactive";
        private static final String ON_ANSWER = "onAnswer";
        private static final String ON_REJECT = "onReject";
        private static final String ON_DISCONNECT = "onDisconnect";
        private static final String ON_STREAMING_STARTED = "onStreamingStarted";
        private static final String ON_REQ_ENDPOINT_CHANGE = "onRequestEndpointChange";
@@ -151,9 +151,9 @@ public class ClientTransactionalServiceWrapper {
        private static final String ON_CALL_STREAMING_FAILED = "onCallStreamingFailed";
        private static final String ON_EVENT = "onEvent";

        private void handleHandshakeCallback(String action, String callId, int code,
                ResultReceiver ackResultReceiver) {
            Log.i(TAG, TextUtils.formatSimple("hHC: id=[%s], action=[%s]", callId, action));
        private void handleCallEventCallback(String action, String callId,
                ResultReceiver ackResultReceiver, Object... args) {
            Log.i(TAG, TextUtils.formatSimple("hCEC: id=[%s], action=[%s]", callId, action));
            // lookup the callEventCallback associated with the particular call
            TransactionalCall call = mCallIdToTransactionalCall.get(callId);

@@ -174,16 +174,13 @@ public class ClientTransactionalServiceWrapper {
                            case ON_SET_INACTIVE:
                                callback.onSetInactive(outcomeReceiverWrapper);
                                break;
                            case ON_REJECT:
                                callback.onReject(outcomeReceiverWrapper);
                                untrackCall(callId);
                                break;
                            case ON_DISCONNECT:
                                callback.onDisconnect(outcomeReceiverWrapper);
                                callback.onDisconnect((DisconnectCause) args[0],
                                        outcomeReceiverWrapper);
                                untrackCall(callId);
                                break;
                            case ON_ANSWER:
                                callback.onAnswer(code, outcomeReceiverWrapper);
                                callback.onAnswer((int) args[0], outcomeReceiverWrapper);
                                break;
                            case ON_STREAMING_STARTED:
                                callback.onCallStreamingStarted(outcomeReceiverWrapper);
@@ -231,28 +228,23 @@ public class ClientTransactionalServiceWrapper {

        @Override
        public void onSetActive(String callId, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_SET_ACTIVE, callId, 0, resultReceiver);
            handleCallEventCallback(ON_SET_ACTIVE, callId, resultReceiver);
        }


        @Override
        public void onSetInactive(String callId, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_SET_INACTIVE, callId, 0, resultReceiver);
            handleCallEventCallback(ON_SET_INACTIVE, callId, resultReceiver);
        }

        @Override
        public void onAnswer(String callId, int videoState, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_ANSWER, callId, videoState, resultReceiver);
        }

        @Override
        public void onReject(String callId, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_REJECT, callId, 0, resultReceiver);
            handleCallEventCallback(ON_ANSWER, callId, resultReceiver, videoState);
        }

        @Override
        public void onDisconnect(String callId, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_DISCONNECT, callId, 0, resultReceiver);
        public void onDisconnect(String callId, DisconnectCause cause,
                ResultReceiver resultReceiver) {
            handleCallEventCallback(ON_DISCONNECT, callId, resultReceiver, cause);
        }

        @Override
@@ -308,7 +300,7 @@ public class ClientTransactionalServiceWrapper {

        @Override
        public void onCallStreamingStarted(String callId, ResultReceiver resultReceiver) {
            handleHandshakeCallback(ON_STREAMING_STARTED, callId, 0, resultReceiver);
            handleCallEventCallback(ON_STREAMING_STARTED, callId, resultReceiver);
        }

        @Override
+2 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import com.android.internal.telecom.ICallControl;
import android.os.ResultReceiver;
import android.telecom.CallAudioState;
import android.telecom.CallException;
import android.telecom.DisconnectCause;
import java.util.List;

/**
@@ -36,8 +37,7 @@ oneway interface ICallEventCallback {
    void onSetActive(String callId, in ResultReceiver callback);
    void onSetInactive(String callId, in ResultReceiver callback);
    void onAnswer(String callId, int videoState, in ResultReceiver callback);
    void onReject(String callId, in ResultReceiver callback);
    void onDisconnect(String callId, in ResultReceiver callback);
    void onDisconnect(String callId, in DisconnectCause cause, in ResultReceiver callback);
    // -- Streaming related. Client registered call streaming capabilities should override
    void onCallStreamingStarted(String callId, in ResultReceiver callback);
    void onCallStreamingFailed(String callId, int reason);