diff --git a/core/api/current.txt b/core/api/current.txt index 7285b2e7976f2..7c92793c62816 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -41838,6 +41838,15 @@ package android.telecom { method public void startCallStreaming(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver); } + public interface CallControlCallback { + method public void onAnswer(int, @NonNull java.util.function.Consumer); + method public void onCallStreamingStarted(@NonNull java.util.function.Consumer); + method public void onDisconnect(@NonNull java.util.function.Consumer); + method public void onReject(@NonNull java.util.function.Consumer); + method public void onSetActive(@NonNull java.util.function.Consumer); + method public void onSetInactive(@NonNull java.util.function.Consumer); + } + public final class CallEndpoint implements android.os.Parcelable { ctor public CallEndpoint(@NonNull CharSequence, int, @NonNull android.os.ParcelUuid); method public int describeContents(); @@ -41867,16 +41876,10 @@ package android.telecom { } public interface CallEventCallback { - method public void onAnswer(int, @NonNull java.util.function.Consumer); method public void onAvailableCallEndpointsChanged(@NonNull java.util.List); method public void onCallEndpointChanged(@NonNull android.telecom.CallEndpoint); method public void onCallStreamingFailed(int); - method public void onCallStreamingStarted(@NonNull java.util.function.Consumer); - method public void onDisconnect(@NonNull java.util.function.Consumer); method public void onMuteStateChanged(boolean); - method public void onReject(@NonNull java.util.function.Consumer); - method public void onSetActive(@NonNull java.util.function.Consumer); - method public void onSetInactive(@NonNull java.util.function.Consumer); } public final class CallException extends java.lang.RuntimeException implements android.os.Parcelable { @@ -42641,7 +42644,7 @@ package android.telecom { method public void acceptHandover(android.net.Uri, int, android.telecom.PhoneAccountHandle); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ANSWER_PHONE_CALLS, android.Manifest.permission.MODIFY_PHONE_STATE}) public void acceptRingingCall(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ANSWER_PHONE_CALLS, android.Manifest.permission.MODIFY_PHONE_STATE}) public void acceptRingingCall(int); - method @RequiresPermission(android.Manifest.permission.MANAGE_OWN_CALLS) public void addCall(@NonNull android.telecom.CallAttributes, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver, @NonNull android.telecom.CallEventCallback); + method @RequiresPermission(android.Manifest.permission.MANAGE_OWN_CALLS) public void addCall(@NonNull android.telecom.CallAttributes, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver, @NonNull android.telecom.CallControlCallback, @NonNull android.telecom.CallEventCallback); method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle); method public void addNewIncomingConference(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.os.Bundle); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void cancelMissedCallsNotification(); diff --git a/telecomm/java/android/telecom/CallControlCallback.java b/telecomm/java/android/telecom/CallControlCallback.java new file mode 100644 index 0000000000000..aadf3370597cc --- /dev/null +++ b/telecomm/java/android/telecom/CallControlCallback.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.telecom; + +import android.annotation.NonNull; + +import java.util.function.Consumer; + +/** + * CallControlCallback relays call updates (that require a response) from the Telecom framework out + * to the application.This can include operations which the app must implement on a Call due to the + * presence of other calls on the device, requests relayed from a Bluetooth device, or from another + * calling surface. + * + *

+ * All CallControlCallbacks are transactional, meaning that a client must + * complete the {@link Consumer} via {@link Consumer#accept(Object)} in order to complete the + * CallControlCallbacks. If a CallControlCallbacks can be completed, the + * {@link Consumer#accept(Object)} should be called with {@link Boolean#TRUE}. Otherwise, + * {@link Consumer#accept(Object)} should be called with {@link Boolean#FALSE} to represent the + * CallControlCallbacks cannot be completed on the client side. + * + *

+ * Note: Each CallEventCallback has a timeout of 5000 milliseconds. Failing to complete the + * {@link Consumer} before the timeout will result in a failed transaction. + */ +public interface CallControlCallback { + /** + * Telecom is informing the client to set the call active + * + * @param wasCompleted The {@link Consumer} to be completed. If the client can set the call + * active on their end, the {@link Consumer#accept(Object)} should be + * called with {@link Boolean#TRUE}. Otherwise, + * {@link Consumer#accept(Object)} should be called with + * {@link Boolean#FALSE}. + */ + void onSetActive(@NonNull Consumer wasCompleted); + + /** + * Telecom is informing the client to set the call inactive. This is the same as holding a call + * for two endpoints but can be extended to setting a meeting inactive. + * + * @param wasCompleted The {@link Consumer} to be completed. If the client can set the call + * inactive on their end, the {@link Consumer#accept(Object)} should be + * called with {@link Boolean#TRUE}. Otherwise, + * {@link Consumer#accept(Object)} should be called with + * {@link Boolean#FALSE}. + */ + void onSetInactive(@NonNull Consumer wasCompleted); + + /** + * Telecom is informing the client to answer an incoming call and set it to active. + * + * @param videoState see {@link android.telecom.CallAttributes.CallType} for valid states + * @param wasCompleted The {@link Consumer} to be completed. If the client can answer 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 onAnswer(@android.telecom.CallAttributes.CallType int videoState, + @NonNull Consumer 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 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}. + */ + void onDisconnect(@NonNull Consumer wasCompleted); + + /** + * Telecom is informing the client to set the call in streaming. + * + * @param wasCompleted The {@link Consumer} to be completed. If the client can stream 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 onCallStreamingStarted(@NonNull Consumer wasCompleted); +} diff --git a/telecomm/java/android/telecom/CallEventCallback.java b/telecomm/java/android/telecom/CallEventCallback.java index 806febd1de563..bfe368560a22f 100644 --- a/telecomm/java/android/telecom/CallEventCallback.java +++ b/telecomm/java/android/telecom/CallEventCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 The Android Open Source Project + * Copyright (C) 2023 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,108 +16,22 @@ package android.telecom; - import android.annotation.NonNull; import java.util.List; -import java.util.function.Consumer; /** - * CallEventCallback relays updates to a call from the Telecom framework. - * This can include operations which the app must implement on a Call due to the presence of other - * calls on the device, requests relayed from a Bluetooth device, or from another calling surface. - * - *

- * CallEventCallbacks with {@link Consumer}s are transactional, meaning that a client must - * complete the {@link Consumer} via {@link Consumer#accept(Object)} in order to complete the - * CallEventCallback. If a CallEventCallback can be completed, the - * {@link Consumer#accept(Object)} should be called with {@link Boolean#TRUE}. Otherwise, - * {@link Consumer#accept(Object)} should be called with {@link Boolean#FALSE} to represent the - * CallEventCallback cannot be completed on the client side. - * - *

- * Note: Each CallEventCallback has a timeout of 5000 milliseconds. Failing to complete the - * {@link Consumer} before the timeout will result in a failed transaction. + * CallEventCallback relays call updates (that do not require any action) from the Telecom framework + * out to the application. This can include operations which the app must implement on a Call due to + * the presence of other calls on the device, requests relayed from a Bluetooth device, + * or from another calling surface. */ public interface CallEventCallback { - /** - * Telecom is informing the client to set the call active - * - * @param wasCompleted The {@link Consumer} to be completed. If the client can set the call - * active on their end, the {@link Consumer#accept(Object)} should be - * called with {@link Boolean#TRUE}. Otherwise, - * {@link Consumer#accept(Object)} should be called with - * {@link Boolean#FALSE}. - */ - void onSetActive(@NonNull Consumer wasCompleted); - - /** - * Telecom is informing the client to set the call inactive. This is the same as holding a call - * for two endpoints but can be extended to setting a meeting inactive. - * - * @param wasCompleted The {@link Consumer} to be completed. If the client can set the call - * inactive on their end, the {@link Consumer#accept(Object)} should be - * called with {@link Boolean#TRUE}. Otherwise, - * {@link Consumer#accept(Object)} should be called with - * {@link Boolean#FALSE}. - */ - void onSetInactive(@NonNull Consumer wasCompleted); - - /** - * Telecom is informing the client to answer an incoming call and set it to active. - * - * @param videoState see {@link android.telecom.CallAttributes.CallType} for valid states - * @param wasCompleted The {@link Consumer} to be completed. If the client can answer 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 onAnswer(@android.telecom.CallAttributes.CallType int videoState, - @NonNull Consumer 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 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}. - */ - void onDisconnect(@NonNull Consumer wasCompleted); - - /** - * Telecom is informing the client to set the call in streaming. - * - * @param wasCompleted The {@link Consumer} to be completed. If the client can stream 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 onCallStreamingStarted(@NonNull Consumer wasCompleted); - - /** - * Telecom is informing the client user requested call streaming but the stream can't be - * started. - * - * @param reason Code to indicate the reason of this failure - */ - void onCallStreamingFailed(@CallStreamingService.StreamingFailedReason int reason); - /** * Telecom is informing the client the current {@link CallEndpoint} changed. * * @param newCallEndpoint The new {@link CallEndpoint} through which call media flows - * (i.e. speaker, bluetooth, etc.). + * (i.e. speaker, bluetooth, etc.). */ void onCallEndpointChanged(@NonNull CallEndpoint newCallEndpoint); @@ -134,4 +48,12 @@ public interface CallEventCallback { * @param isMuted The current mute state. */ void onMuteStateChanged(boolean isMuted); + + /** + * Telecom is informing the client user requested call streaming but the stream can't be + * started. + * + * @param reason Code to indicate the reason of this failure + */ + void onCallStreamingFailed(@CallStreamingService.StreamingFailedReason int reason); } diff --git a/telecomm/java/android/telecom/CallException.java b/telecomm/java/android/telecom/CallException.java index d191593be2847..e554082fe410d 100644 --- a/telecomm/java/android/telecom/CallException.java +++ b/telecomm/java/android/telecom/CallException.java @@ -30,7 +30,7 @@ import java.lang.annotation.RetentionPolicy; /** * This class defines exceptions that can be thrown when using Telecom APIs with * {@link android.os.OutcomeReceiver}s. Most of these exceptions are thrown when changing a call - * state with {@link CallControl}s or {@link CallEventCallback}s. + * state with {@link CallControl}s or {@link CallControlCallback}s. */ public final class CallException extends RuntimeException implements Parcelable { /** @hide **/ diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 20564d6f3c148..de99ebf09e278 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -2669,8 +2669,10 @@ public class TelecomManager { } /** - * Adds a new call with the specified {@link CallAttributes} to the telecom service. This method - * can be used to add both incoming and outgoing calls. + * Reports a new call with the specified {@link CallAttributes} to the telecom service. This + * method can be used to report both incoming and outgoing calls. By reporting the call, the + * system is aware of the call and can provide updates on services (ex. Another device wants to + * disconnect the call) or events (ex. a new Bluetooth route became available). * *

* The difference between this API call and {@link TelecomManager#placeCall(Uri, Bundle)} or @@ -2693,9 +2695,20 @@ public class TelecomManager { *

      *
      *  // An app should first define their own construct of a Call that overrides all the
-     *  // {@link CallEventCallback}s
-     *  private class MyVoipCall implements CallEventCallback {
-     *    // override all the {@link CallEventCallback}s
+     *  // {@link CallControlCallback}s and {@link CallEventCallback}s
+     *  private class MyVoipCall {
+     *   public String callId = "";
+     *
+     *   public CallControlCallEventCallback handshakes = new
+     *                       CallControlCallEventCallback() {
+     *                         // override/ implement all {@link CallControlCallback}s
+     *                        }
+     *   public CallEventCallback events = new
+     *                       CallEventCallback() {
+     *                         // override/ implement all {@link CallEventCallback}s
+     *                        }
+     *   public MyVoipCall(String id){
+     *       callId = id;
      *  }
      *
      * PhoneAccountHandle handle = new PhoneAccountHandle(
@@ -2707,28 +2720,33 @@ public class TelecomManager {
      *                                            "John Smith", Uri.fromParts("tel", "123", null))
      *                                            .build();
      *
+     * MyVoipCall myFirstOutgoingCall = new MyVoipCall("1");
+     *
      * telecomManager.addCall(callAttributes, Runnable::run, new OutcomeReceiver() {
      *                              public void onResult(CallControl callControl) {
      *                                 // The call has been added successfully
      *                              }
-     *                           }, new MyVoipCall());
+     *                           }, myFirstOutgoingCall.handshakes, myFirstOutgoingCall.events);
      * 
* * @param callAttributes attributes of the new call (incoming or outgoing, address, etc. ) * @param executor thread to run background CallEventCallback updates on * @param pendingControl OutcomeReceiver that receives the result of addCall transaction - * @param callEventCallback object that overrides CallEventCallback + * @param handshakes object that overrides {@link CallControlCallback}s + * @param events object that overrides {@link CallEventCallback}s */ @RequiresPermission(android.Manifest.permission.MANAGE_OWN_CALLS) @SuppressLint("SamShouldBeLast") public void addCall(@NonNull CallAttributes callAttributes, @NonNull @CallbackExecutor Executor executor, @NonNull OutcomeReceiver pendingControl, - @NonNull CallEventCallback callEventCallback) { + @NonNull CallControlCallback handshakes, + @NonNull CallEventCallback events) { Objects.requireNonNull(callAttributes); Objects.requireNonNull(executor); Objects.requireNonNull(pendingControl); - Objects.requireNonNull(callEventCallback); + Objects.requireNonNull(handshakes); + Objects.requireNonNull(events); ITelecomService service = getTelecomService(); if (service != null) { @@ -2740,7 +2758,7 @@ public class TelecomManager { // couple all the args passed by the client String newCallId = transactionalServiceWrapper.trackCall(callAttributes, executor, - pendingControl, callEventCallback); + pendingControl, handshakes, events); // send args to server to process new call service.addCall(callAttributes, transactionalServiceWrapper.getCallEventCallback(), diff --git a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java index b2e921b41159b..7bba1eb07ebdd 100644 --- a/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java +++ b/telecomm/java/com/android/internal/telecom/ClientTransactionalServiceWrapper.java @@ -23,6 +23,7 @@ import android.os.OutcomeReceiver; import android.os.ResultReceiver; import android.telecom.CallAttributes; import android.telecom.CallControl; +import android.telecom.CallControlCallback; import android.telecom.CallEndpoint; import android.telecom.CallEventCallback; import android.telecom.CallException; @@ -37,7 +38,7 @@ import java.util.concurrent.Executor; import java.util.function.Consumer; /** - * wraps {@link CallEventCallback} and {@link CallControl} on a + * wraps {@link CallControlCallback}, {@link CallEventCallback}, and {@link CallControl} on a * per-{@link android.telecom.PhoneAccountHandle} basis to track ongoing calls. * * @hide @@ -86,18 +87,20 @@ public class ClientTransactionalServiceWrapper { * @param callAttributes of the new call * @param executor to run callbacks on * @param pendingControl that allows telecom to call into the client - * @param callback that overrides the CallEventCallback + * @param handshakes that overrides the CallControlCallback + * @param events that overrides the CallStateCallback * @return the callId of the newly created call */ public String trackCall(CallAttributes callAttributes, Executor executor, OutcomeReceiver pendingControl, - CallEventCallback callback) { + CallControlCallback handshakes, + CallEventCallback events) { // generate a new id for this new call String newCallId = UUID.randomUUID().toString(); // couple the objects passed from the client side mCallIdToTransactionalCall.put(newCallId, new TransactionalCall(newCallId, callAttributes, - executor, pendingControl, callback)); + executor, pendingControl, handshakes, events)); return newCallId; } @@ -144,16 +147,17 @@ public class ClientTransactionalServiceWrapper { private static final String ON_REQ_ENDPOINT_CHANGE = "onRequestEndpointChange"; private static final String ON_AVAILABLE_CALL_ENDPOINTS = "onAvailableCallEndpointsChanged"; private static final String ON_MUTE_STATE_CHANGED = "onMuteStateChanged"; + private static final String ON_CALL_STREAMING_FAILED = "onCallStreamingFailed"; - private void handleCallEventCallback(String action, String callId, int code, + private void handleHandshakeCallback(String action, String callId, int code, ResultReceiver ackResultReceiver) { - Log.i(TAG, TextUtils.formatSimple("hCEC: id=[%s], action=[%s]", callId, action)); + Log.i(TAG, TextUtils.formatSimple("hHC: id=[%s], action=[%s]", callId, action)); // lookup the callEventCallback associated with the particular call TransactionalCall call = mCallIdToTransactionalCall.get(callId); if (call != null) { // Get the CallEventCallback interface - CallEventCallback callback = call.getCallEventCallback(); + CallControlCallback callback = call.getCallControlCallback(); // Get Receiver to wait on client ack ReceiverWrapper outcomeReceiverWrapper = new ReceiverWrapper(ackResultReceiver); @@ -225,51 +229,51 @@ public class ClientTransactionalServiceWrapper { @Override public void onSetActive(String callId, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_SET_ACTIVE, callId, 0, resultReceiver); + handleHandshakeCallback(ON_SET_ACTIVE, callId, 0, resultReceiver); } @Override public void onSetInactive(String callId, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_SET_INACTIVE, callId, 0, resultReceiver); + handleHandshakeCallback(ON_SET_INACTIVE, callId, 0, resultReceiver); } @Override public void onAnswer(String callId, int videoState, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_ANSWER, callId, videoState, resultReceiver); + handleHandshakeCallback(ON_ANSWER, callId, videoState, resultReceiver); } @Override public void onReject(String callId, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_REJECT, callId, 0, resultReceiver); + handleHandshakeCallback(ON_REJECT, callId, 0, resultReceiver); } @Override public void onDisconnect(String callId, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_DISCONNECT, callId, 0, resultReceiver); + handleHandshakeCallback(ON_DISCONNECT, callId, 0, resultReceiver); } @Override public void onCallEndpointChanged(String callId, CallEndpoint endpoint) { - handleEndpointUpdate(callId, ON_REQ_ENDPOINT_CHANGE, endpoint); + handleEventCallback(callId, ON_REQ_ENDPOINT_CHANGE, endpoint); } @Override public void onAvailableCallEndpointsChanged(String callId, List endpoints) { - handleEndpointUpdate(callId, ON_AVAILABLE_CALL_ENDPOINTS, endpoints); + handleEventCallback(callId, ON_AVAILABLE_CALL_ENDPOINTS, endpoints); } @Override public void onMuteStateChanged(String callId, boolean isMuted) { - handleEndpointUpdate(callId, ON_MUTE_STATE_CHANGED, isMuted); + handleEventCallback(callId, ON_MUTE_STATE_CHANGED, isMuted); } - public void handleEndpointUpdate(String callId, String action, Object arg) { - Log.d(TAG, TextUtils.formatSimple("[%s], callId=[%s]", action, callId)); + public void handleEventCallback(String callId, String action, Object arg) { + Log.d(TAG, TextUtils.formatSimple("hEC: [%s], callId=[%s]", action, callId)); // lookup the callEventCallback associated with the particular call TransactionalCall call = mCallIdToTransactionalCall.get(callId); if (call != null) { - CallEventCallback callback = call.getCallEventCallback(); + CallEventCallback callback = call.getCallStateCallback(); Executor executor = call.getExecutor(); final long identity = Binder.clearCallingIdentity(); try { @@ -284,6 +288,9 @@ public class ClientTransactionalServiceWrapper { case ON_MUTE_STATE_CHANGED: callback.onMuteStateChanged((boolean) arg); break; + case ON_CALL_STREAMING_FAILED: + callback.onCallStreamingFailed((int) arg /* reason */); + break; } }); } finally { @@ -299,20 +306,13 @@ public class ClientTransactionalServiceWrapper { @Override public void onCallStreamingStarted(String callId, ResultReceiver resultReceiver) { - handleCallEventCallback(ON_STREAMING_STARTED, callId, 0, resultReceiver); + handleHandshakeCallback(ON_STREAMING_STARTED, callId, 0, resultReceiver); } @Override public void onCallStreamingFailed(String callId, int reason) { - Log.i(TAG, TextUtils.formatSimple("onCallAudioStateChanged: callId=[%s], reason=[%s]", - callId, reason)); - // lookup the callEventCallback associated with the particular call - TransactionalCall call = mCallIdToTransactionalCall.get(callId); - if (call != null) { - CallEventCallback callback = call.getCallEventCallback(); - Executor executor = call.getExecutor(); - executor.execute(() -> callback.onCallStreamingFailed(reason)); - } + Log.i(TAG, TextUtils.formatSimple("oCSF: id=[%s], reason=[%s]", callId, reason)); + handleEventCallback(callId, ON_CALL_STREAMING_FAILED, reason); } }; } diff --git a/telecomm/java/com/android/internal/telecom/TransactionalCall.java b/telecomm/java/com/android/internal/telecom/TransactionalCall.java index d9c8210f76040..75f9d35470db6 100644 --- a/telecomm/java/com/android/internal/telecom/TransactionalCall.java +++ b/telecomm/java/com/android/internal/telecom/TransactionalCall.java @@ -19,6 +19,7 @@ package com.android.internal.telecom; import android.os.OutcomeReceiver; import android.telecom.CallAttributes; import android.telecom.CallControl; +import android.telecom.CallControlCallback; import android.telecom.CallEventCallback; import android.telecom.CallException; @@ -33,19 +34,23 @@ public class TransactionalCall { private final CallAttributes mCallAttributes; private final Executor mExecutor; private final OutcomeReceiver mPendingControl; - private final CallEventCallback mCallEventCallback; + private final CallControlCallback mCallControlCallback; + private final CallEventCallback mCallStateCallback; private CallControl mCallControl; public TransactionalCall(String callId, CallAttributes callAttributes, - Executor executor, OutcomeReceiver pendingControl, - CallEventCallback callEventCallback) { + Executor executor, OutcomeReceiver pendingControl, + CallControlCallback callControlCallback, + CallEventCallback callStateCallback) { mCallId = callId; mCallAttributes = callAttributes; mExecutor = executor; mPendingControl = pendingControl; - mCallEventCallback = callEventCallback; + mCallControlCallback = callControlCallback; + mCallStateCallback = callStateCallback; } + public void setCallControl(CallControl callControl) { mCallControl = callControl; } @@ -70,7 +75,11 @@ public class TransactionalCall { return mPendingControl; } - public CallEventCallback getCallEventCallback() { - return mCallEventCallback; + public CallControlCallback getCallControlCallback() { + return mCallControlCallback; + } + + public CallEventCallback getCallStateCallback() { + return mCallStateCallback; } }