diff options
author | 2023-02-06 15:32:35 -0800 | |
---|---|---|
committer | 2023-02-22 23:59:38 +0000 | |
commit | b6b7e850095cf37288a948f55351be9b06b8f71e (patch) | |
tree | cdf4f71462576f2dfa1ef9ff96038f5d9e66674e | |
parent | 5d3be7c0533cc40def6f686923cf05204a982ff6 (diff) |
merge onReject into onDisconnect, propagate cause
bug: 268107048
Test: CTS
Change-Id: I16e51ab8e9c3cd7f3ad7d17ebf7ab1cdff019253
4 files changed, 25 insertions, 41 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 2f1d81de247a..554a9e1393e3 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -42065,8 +42065,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>); } diff --git a/telecomm/java/android/telecom/CallControlCallback.java b/telecomm/java/android/telecom/CallControlCallback.java index aadf3370597c..35e2fd43efdd 100644 --- a/telecomm/java/android/telecom/CallControlCallback.java +++ b/telecomm/java/android/telecom/CallControlCallback.java @@ -75,24 +75,17 @@ public interface CallControlCallback { @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. diff --git a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java index e44e2b31c189..71e9184b7c54 100644 --- a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java +++ b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java @@ -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 diff --git a/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl b/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl index dd61d173ef7e..213cafbbf188 100644 --- a/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl +++ b/telecomm/java/com/android/internal/telecom/ICallEventCallback.aidl @@ -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); |