add capability to send and receive events
bug: 269512817
Test: CTS
Change-Id: I5f4561192b7c8ab978754e3a7da6549d35c61b1d
diff --git a/telecomm/java/android/telecom/CallControl.java b/telecomm/java/android/telecom/CallControl.java
index 2135e27..6b2bea0 100644
--- a/telecomm/java/android/telecom/CallControl.java
+++ b/telecomm/java/android/telecom/CallControl.java
@@ -147,10 +147,8 @@
* <li>{@link DisconnectCause#REJECTED}</li>
* <li>{@link DisconnectCause#MISSED}</li>
* </ul>
- *
* @param executor The {@link Executor} on which the {@link OutcomeReceiver} callback
* will be called on.
- *
* @param callback That will be completed on the Telecom side that details success or
* failure of the requested operation.
*
@@ -254,6 +252,36 @@
}
/**
+ * Raises an event to the {@link android.telecom.InCallService} implementations tracking this
+ * call via {@link android.telecom.Call.Callback#onConnectionEvent(Call, String, Bundle)}.
+ * These events and the associated extra keys for the {@code Bundle} parameter are defined
+ * in Android X. This API is used to relay additional information about a call other than
+ * what is specified in the {@link android.telecom.CallAttributes} to
+ * {@link android.telecom.InCallService}s. This might include, for example, a change to the list
+ * of participants in a meeting, or the name of the speakers who have their hand raised. Where
+ * appropriate, the {@link InCallService}s tracking this call may choose to render this
+ * additional information about the call. An automotive calling UX, for example may have enough
+ * screen real estate to indicate the number of participants in a meeting, but to prevent
+ * distractions could suppress the list of participants.
+ *
+ * @param event that is defined in AndroidX (ex. The number of participants changed)
+ * @param extras the updated value in relation to the event (ex. 4 participants)
+ */
+ public void sendEvent(@NonNull String event, @NonNull Bundle extras) {
+ Objects.requireNonNull(event);
+ Objects.requireNonNull(extras);
+ if (mServerInterface != null) {
+ try {
+ mServerInterface.sendEvent(mCallId, event, extras);
+ } catch (RemoteException e) {
+ throw e.rethrowAsRuntimeException();
+ }
+ } else {
+ throw new IllegalStateException(INTERFACE_ERROR_MSG);
+ }
+ }
+
+ /**
* Since {@link OutcomeReceiver}s cannot be passed via AIDL, a ResultReceiver (which can) must
* wrap the Clients {@link OutcomeReceiver} passed in and await for the Telecom Server side
* response in {@link ResultReceiver#onReceiveResult(int, Bundle)}.
diff --git a/telecomm/java/android/telecom/CallEventCallback.java b/telecomm/java/android/telecom/CallEventCallback.java
index bfe3685..d96c406 100644
--- a/telecomm/java/android/telecom/CallEventCallback.java
+++ b/telecomm/java/android/telecom/CallEventCallback.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.annotation.NonNull;
+import android.os.Bundle;
import java.util.List;
@@ -56,4 +57,17 @@
* @param reason Code to indicate the reason of this failure
*/
void onCallStreamingFailed(@CallStreamingService.StreamingFailedReason int reason);
+
+ /**
+ * Informs this {@link android.telecom.CallEventCallback} on events raised from a
+ * {@link android.telecom.InCallService} presenting this call. The event key and extra values
+ * are defined in AndroidX. This enables alternative calling surfaces, such as an automotive
+ * UI, to relay requests to perform other non-standard call actions to the app. For example,
+ * an automotive calling solution may offer the ability for the user to raise their hand
+ * during a meeting.
+ *
+ * @param event that is defined in AndroidX (ex. the number of participants changed)
+ * @param extras the updated value in relation to the event (ex. 4 participants)
+ */
+ void onEvent(@NonNull String event, @NonNull Bundle extras);
}