summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/Call.java
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android/telecom/Call.java')
-rw-r--r--telecomm/java/android/telecom/Call.java85
1 files changed, 80 insertions, 5 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index b4414d5b6168..a6bfbad8e053 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -19,6 +19,7 @@ package android.telecom;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.annotation.TestApi;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -132,6 +133,73 @@ public final class Call {
public static final String EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS =
"android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS";
+ /**
+ * Call event sent from a {@link Call} via {@link #sendCallEvent(String, Bundle)} to inform
+ * Telecom that the user has requested that the current {@link Call} should be handed over
+ * to another {@link ConnectionService}.
+ * <p>
+ * The caller must specify the {@link #EXTRA_HANDOVER_PHONE_ACCOUNT_HANDLE} to indicate to
+ * Telecom which {@link PhoneAccountHandle} the {@link Call} should be handed over to.
+ * @hide
+ */
+ public static final String EVENT_REQUEST_HANDOVER =
+ "android.telecom.event.REQUEST_HANDOVER";
+
+ /**
+ * Extra key used with the {@link #EVENT_REQUEST_HANDOVER} call event. Specifies the
+ * {@link PhoneAccountHandle} to which a call should be handed over to.
+ * @hide
+ */
+ public static final String EXTRA_HANDOVER_PHONE_ACCOUNT_HANDLE =
+ "android.telecom.extra.HANDOVER_PHONE_ACCOUNT_HANDLE";
+
+ /**
+ * Integer extra key used with the {@link #EVENT_REQUEST_HANDOVER} call event. Specifies the
+ * video state of the call when it is handed over to the new {@link PhoneAccount}.
+ * <p>
+ * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY},
+ * {@link VideoProfile#STATE_BIDIRECTIONAL}, {@link VideoProfile#STATE_RX_ENABLED}, and
+ * {@link VideoProfile#STATE_TX_ENABLED}.
+ * @hide
+ */
+ public static final String EXTRA_HANDOVER_VIDEO_STATE =
+ "android.telecom.extra.HANDOVER_VIDEO_STATE";
+
+ /**
+ * Extra key used with the {@link #EVENT_REQUEST_HANDOVER} call event. Used by the
+ * {@link InCallService} initiating a handover to provide a {@link Bundle} with extra
+ * information to the handover {@link ConnectionService} specified by
+ * {@link #EXTRA_HANDOVER_PHONE_ACCOUNT_HANDLE}.
+ * <p>
+ * This {@link Bundle} is not interpreted by Telecom, but passed as-is to the
+ * {@link ConnectionService} via the request extras when
+ * {@link ConnectionService#onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}
+ * is called to initate the handover.
+ * @hide
+ */
+ public static final String EXTRA_HANDOVER_EXTRAS = "android.telecom.extra.HANDOVER_EXTRAS";
+
+ /**
+ * Call event sent from Telecom to the handover {@link ConnectionService} via
+ * {@link Connection#onCallEvent(String, Bundle)} to inform a {@link Connection} that a handover
+ * to the {@link ConnectionService} has completed successfully.
+ * <p>
+ * A handover is initiated with the {@link #EVENT_REQUEST_HANDOVER} call event.
+ * @hide
+ */
+ public static final String EVENT_HANDOVER_COMPLETE =
+ "android.telecom.event.HANDOVER_COMPLETE";
+ /**
+ * Call event sent from Telecom to the handover {@link ConnectionService} via
+ * {@link Connection#onCallEvent(String, Bundle)} to inform a {@link Connection} that a handover
+ * to the {@link ConnectionService} has failed.
+ * <p>
+ * A handover is initiated with the {@link #EVENT_REQUEST_HANDOVER} call event.
+ * @hide
+ */
+ public static final String EVENT_HANDOVER_FAILED =
+ "android.telecom.event.HANDOVER_FAILED";
+
public static class Details {
/** Call can currently be put on hold or unheld. */
@@ -1009,12 +1077,17 @@ public final class Call {
* @return A string containing text sent by the remote user, or {@code null} if the
* conversation has been terminated or if there was an error while reading.
*/
- public String read() throws IOException {
- int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
- if (numRead < 0) {
- return null;
+ public String read() {
+ try {
+ int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
+ if (numRead < 0) {
+ return null;
+ }
+ return new String(mReadBuffer, 0, numRead);
+ } catch (IOException e) {
+ Log.w(this, "Exception encountered when reading from InputStreamReader: %s", e);
}
- return new String(mReadBuffer, 0, numRead);
+ return null;
}
/**
@@ -1022,7 +1095,9 @@ public final class Call {
* be read.
* @return A string containing text entered by the user, or {@code null} if the user has
* not entered any new text yet.
+ * @hide
*/
+ @TestApi
public String readImmediately() throws IOException {
if (mReceiveStream.ready()) {
return read();