Merge "Add further Connection-side APIs for RTT (part 2)"
am: 6bb5110f2c
Change-Id: Idfe092393301fb47e6a635eb150103cb928a2696
This commit is contained in:
@@ -36695,6 +36695,7 @@ package android.telecom {
|
|||||||
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
||||||
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
||||||
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
||||||
|
method public void onRttInitiationFailure(android.telecom.Call, int);
|
||||||
method public void onRttModeChanged(android.telecom.Call, int);
|
method public void onRttModeChanged(android.telecom.Call, int);
|
||||||
method public void onRttRequest(android.telecom.Call, int);
|
method public void onRttRequest(android.telecom.Call, int);
|
||||||
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
||||||
@@ -36961,6 +36962,15 @@ package android.telecom {
|
|||||||
field public static final int STATE_RINGING = 2; // 0x2
|
field public static final int STATE_RINGING = 2; // 0x2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class Connection.RttModifyStatus {
|
||||||
|
ctor public Connection.RttModifyStatus();
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; // 0x5
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; // 0x4
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract class Connection.VideoProvider {
|
public static abstract class Connection.VideoProvider {
|
||||||
ctor public Connection.VideoProvider();
|
ctor public Connection.VideoProvider();
|
||||||
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
||||||
|
|||||||
@@ -39669,6 +39669,7 @@ package android.telecom {
|
|||||||
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
||||||
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
||||||
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
||||||
|
method public void onRttInitiationFailure(android.telecom.Call, int);
|
||||||
method public void onRttModeChanged(android.telecom.Call, int);
|
method public void onRttModeChanged(android.telecom.Call, int);
|
||||||
method public void onRttRequest(android.telecom.Call, int);
|
method public void onRttRequest(android.telecom.Call, int);
|
||||||
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
||||||
@@ -39946,6 +39947,15 @@ package android.telecom {
|
|||||||
field public static final int STATE_RINGING = 2; // 0x2
|
field public static final int STATE_RINGING = 2; // 0x2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class Connection.RttModifyStatus {
|
||||||
|
ctor public Connection.RttModifyStatus();
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; // 0x5
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; // 0x4
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract class Connection.VideoProvider {
|
public static abstract class Connection.VideoProvider {
|
||||||
ctor public Connection.VideoProvider();
|
ctor public Connection.VideoProvider();
|
||||||
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
||||||
|
|||||||
@@ -36778,6 +36778,7 @@ package android.telecom {
|
|||||||
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
|
||||||
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
method public void onParentChanged(android.telecom.Call, android.telecom.Call);
|
||||||
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
method public void onPostDialWait(android.telecom.Call, java.lang.String);
|
||||||
|
method public void onRttInitiationFailure(android.telecom.Call, int);
|
||||||
method public void onRttModeChanged(android.telecom.Call, int);
|
method public void onRttModeChanged(android.telecom.Call, int);
|
||||||
method public void onRttRequest(android.telecom.Call, int);
|
method public void onRttRequest(android.telecom.Call, int);
|
||||||
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
|
||||||
@@ -37044,6 +37045,15 @@ package android.telecom {
|
|||||||
field public static final int STATE_RINGING = 2; // 0x2
|
field public static final int STATE_RINGING = 2; // 0x2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final class Connection.RttModifyStatus {
|
||||||
|
ctor public Connection.RttModifyStatus();
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; // 0x5
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
|
||||||
|
field public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; // 0x4
|
||||||
|
}
|
||||||
|
|
||||||
public static abstract class Connection.VideoProvider {
|
public static abstract class Connection.VideoProvider {
|
||||||
ctor public Connection.VideoProvider();
|
ctor public Connection.VideoProvider();
|
||||||
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
|
||||||
|
|||||||
@@ -871,6 +871,16 @@ public final class Call {
|
|||||||
* @param id The ID of the request.
|
* @param id The ID of the request.
|
||||||
*/
|
*/
|
||||||
public void onRttRequest(Call call, int id) {}
|
public void onRttRequest(Call call, int id) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Invoked when the RTT session failed to initiate for some reason, including rejection
|
||||||
|
* by the remote party.
|
||||||
|
* @param call The call which the RTT initiation failure occurred on.
|
||||||
|
* @param reason One of the status codes defined in
|
||||||
|
* {@link android.telecom.Connection.RttModifyStatus}, with the exception of
|
||||||
|
* {@link android.telecom.Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}.
|
||||||
|
*/
|
||||||
|
public void onRttInitiationFailure(Call call, int reason) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -913,13 +923,15 @@ public final class Call {
|
|||||||
private OutputStreamWriter mTransmitStream;
|
private OutputStreamWriter mTransmitStream;
|
||||||
private int mRttMode;
|
private int mRttMode;
|
||||||
private final InCallAdapter mInCallAdapter;
|
private final InCallAdapter mInCallAdapter;
|
||||||
|
private final String mTelecomCallId;
|
||||||
private char[] mReadBuffer = new char[READ_BUFFER_SIZE];
|
private char[] mReadBuffer = new char[READ_BUFFER_SIZE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public RttCall(InputStreamReader receiveStream, OutputStreamWriter transmitStream,
|
public RttCall(String telecomCallId, InputStreamReader receiveStream,
|
||||||
int mode, InCallAdapter inCallAdapter) {
|
OutputStreamWriter transmitStream, int mode, InCallAdapter inCallAdapter) {
|
||||||
|
mTelecomCallId = telecomCallId;
|
||||||
mReceiveStream = receiveStream;
|
mReceiveStream = receiveStream;
|
||||||
mTransmitStream = transmitStream;
|
mTransmitStream = transmitStream;
|
||||||
mRttMode = mode;
|
mRttMode = mode;
|
||||||
@@ -942,7 +954,7 @@ public final class Call {
|
|||||||
* {@link #RTT_MODE_VCO}, or {@link #RTT_MODE_HCO}.
|
* {@link #RTT_MODE_VCO}, or {@link #RTT_MODE_HCO}.
|
||||||
*/
|
*/
|
||||||
public void setRttMode(@RttAudioMode int mode) {
|
public void setRttMode(@RttAudioMode int mode) {
|
||||||
mInCallAdapter.setRttMode(mode);
|
mInCallAdapter.setRttMode(mTelecomCallId, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1214,7 +1226,7 @@ public final class Call {
|
|||||||
* {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback.
|
* {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback.
|
||||||
*/
|
*/
|
||||||
public void sendRttRequest() {
|
public void sendRttRequest() {
|
||||||
mInCallAdapter.sendRttRequest();
|
mInCallAdapter.sendRttRequest(mTelecomCallId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1225,7 +1237,7 @@ public final class Call {
|
|||||||
* @param accept {@code true} if the RTT request should be accepted, {@code false} otherwise.
|
* @param accept {@code true} if the RTT request should be accepted, {@code false} otherwise.
|
||||||
*/
|
*/
|
||||||
public void respondToRttRequest(int id, boolean accept) {
|
public void respondToRttRequest(int id, boolean accept) {
|
||||||
mInCallAdapter.respondToRttRequest(id, accept);
|
mInCallAdapter.respondToRttRequest(mTelecomCallId, id, accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1233,7 +1245,7 @@ public final class Call {
|
|||||||
* the {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback.
|
* the {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback.
|
||||||
*/
|
*/
|
||||||
public void stopRtt() {
|
public void stopRtt() {
|
||||||
mInCallAdapter.stopRtt();
|
mInCallAdapter.stopRtt(mTelecomCallId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1642,7 +1654,7 @@ public final class Call {
|
|||||||
new ParcelFileDescriptor.AutoCloseOutputStream(
|
new ParcelFileDescriptor.AutoCloseOutputStream(
|
||||||
parcelableRttCall.getTransmitStream()),
|
parcelableRttCall.getTransmitStream()),
|
||||||
StandardCharsets.UTF_8);
|
StandardCharsets.UTF_8);
|
||||||
RttCall newRttCall = new Call.RttCall(
|
RttCall newRttCall = new Call.RttCall(mTelecomCallId,
|
||||||
receiveStream, transmitStream, parcelableRttCall.getRttMode(), mInCallAdapter);
|
receiveStream, transmitStream, parcelableRttCall.getRttMode(), mInCallAdapter);
|
||||||
if (mRttCall == null) {
|
if (mRttCall == null) {
|
||||||
isRttChanged = true;
|
isRttChanged = true;
|
||||||
@@ -1722,6 +1734,15 @@ public final class Call {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
final void internalOnRttInitiationFailure(int reason) {
|
||||||
|
for (CallbackRecord<Callback> record : mCallbackRecords) {
|
||||||
|
final Call call = this;
|
||||||
|
final Callback callback = record.getCallback();
|
||||||
|
record.getHandler().post(() -> callback.onRttInitiationFailure(call, reason));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void fireStateChanged(final int newState) {
|
private void fireStateChanged(final int newState) {
|
||||||
for (CallbackRecord<Callback> record : mCallbackRecords) {
|
for (CallbackRecord<Callback> record : mCallbackRecords) {
|
||||||
final Call call = this;
|
final Call call = this;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.android.internal.os.SomeArgs;
|
|||||||
import com.android.internal.telecom.IVideoCallback;
|
import com.android.internal.telecom.IVideoCallback;
|
||||||
import com.android.internal.telecom.IVideoProvider;
|
import com.android.internal.telecom.IVideoProvider;
|
||||||
|
|
||||||
|
import android.annotation.IntDef;
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
@@ -41,6 +42,8 @@ import android.view.Surface;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -766,6 +769,10 @@ public abstract class Connection extends Conferenceable {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {}
|
public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {}
|
||||||
public void onAudioRouteChanged(Connection c, int audioRoute) {}
|
public void onAudioRouteChanged(Connection c, int audioRoute) {}
|
||||||
|
public void onRttInitiationSuccess(Connection c) {}
|
||||||
|
public void onRttInitiationFailure(Connection c, int reason) {}
|
||||||
|
public void onRttSessionRemotelyTerminated(Connection c) {}
|
||||||
|
public void onRemoteRttRequest(Connection c) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -776,12 +783,16 @@ public abstract class Connection extends Conferenceable {
|
|||||||
private static final int READ_BUFFER_SIZE = 1000;
|
private static final int READ_BUFFER_SIZE = 1000;
|
||||||
private final InputStreamReader mPipeFromInCall;
|
private final InputStreamReader mPipeFromInCall;
|
||||||
private final OutputStreamWriter mPipeToInCall;
|
private final OutputStreamWriter mPipeToInCall;
|
||||||
|
private final ParcelFileDescriptor mFdFromInCall;
|
||||||
|
private final ParcelFileDescriptor mFdToInCall;
|
||||||
private char[] mReadBuffer = new char[READ_BUFFER_SIZE];
|
private char[] mReadBuffer = new char[READ_BUFFER_SIZE];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public RttTextStream(ParcelFileDescriptor toInCall, ParcelFileDescriptor fromInCall) {
|
public RttTextStream(ParcelFileDescriptor toInCall, ParcelFileDescriptor fromInCall) {
|
||||||
|
mFdFromInCall = fromInCall;
|
||||||
|
mFdToInCall = toInCall;
|
||||||
mPipeFromInCall = new InputStreamReader(
|
mPipeFromInCall = new InputStreamReader(
|
||||||
new ParcelFileDescriptor.AutoCloseInputStream(fromInCall));
|
new ParcelFileDescriptor.AutoCloseInputStream(fromInCall));
|
||||||
mPipeToInCall = new OutputStreamWriter(
|
mPipeToInCall = new OutputStreamWriter(
|
||||||
@@ -825,6 +836,47 @@ public abstract class Connection extends Conferenceable {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public ParcelFileDescriptor getFdFromInCall() {
|
||||||
|
return mFdFromInCall;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
public ParcelFileDescriptor getFdToInCall() {
|
||||||
|
return mFdToInCall;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides constants to represent the results of responses to session modify requests sent via
|
||||||
|
* {@link Call#sendRttRequest()}
|
||||||
|
*/
|
||||||
|
public static final class RttModifyStatus {
|
||||||
|
/**
|
||||||
|
* Session modify request was successful.
|
||||||
|
*/
|
||||||
|
public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session modify request failed.
|
||||||
|
*/
|
||||||
|
public static final int SESSION_MODIFY_REQUEST_FAIL = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session modify request ignored due to invalid parameters.
|
||||||
|
*/
|
||||||
|
public static final int SESSION_MODIFY_REQUEST_INVALID = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session modify request timed out.
|
||||||
|
*/
|
||||||
|
public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Session modify request rejected by remote user.
|
||||||
|
*/
|
||||||
|
public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2433,6 +2485,47 @@ public abstract class Connection extends Conferenceable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs listeners that a previously requested RTT session via
|
||||||
|
* {@link ConnectionRequest#isRequestingRtt()} or
|
||||||
|
* {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)} has succeeded.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void sendRttInitiationSuccess() {
|
||||||
|
mListeners.forEach((l) -> l.onRttInitiationSuccess(Connection.this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs listeners that a previously requested RTT session via
|
||||||
|
* {@link ConnectionRequest#isRequestingRtt()} or
|
||||||
|
* {@link #onStartRtt(ParcelFileDescriptor, ParcelFileDescriptor)}
|
||||||
|
* has failed.
|
||||||
|
* @param reason One of the reason codes defined in {@link RttModifyStatus}, with the
|
||||||
|
* exception of {@link RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void sendRttInitiationFailure(int reason) {
|
||||||
|
mListeners.forEach((l) -> l.onRttInitiationFailure(Connection.this, reason));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs listeners that a currently active RTT session has been terminated by the remote
|
||||||
|
* side of the coll.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void sendRttSessionRemotelyTerminated() {
|
||||||
|
mListeners.forEach((l) -> l.onRttSessionRemotelyTerminated(Connection.this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Informs listeners that the remote side of the call has requested an upgrade to include an
|
||||||
|
* RTT session in the call.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public final void sendRemoteRttRequest() {
|
||||||
|
mListeners.forEach((l) -> l.onRemoteRttRequest(Connection.this));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
|
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
|
||||||
*
|
*
|
||||||
@@ -2638,6 +2731,35 @@ public abstract class Connection extends Conferenceable {
|
|||||||
*/
|
*/
|
||||||
public void onShowIncomingCallUi() {}
|
public void onShowIncomingCallUi() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this {@link Connection} that the user has requested an RTT session.
|
||||||
|
* The connection service should call {@link #sendRttInitiationSuccess} or
|
||||||
|
* {@link #sendRttInitiationFailure} to inform Telecom of the success or failure of the
|
||||||
|
* request, respectively.
|
||||||
|
* @param rttTextStream The object that should be used to send text to or receive text from
|
||||||
|
* the in-call app.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void onStartRtt(@NonNull RttTextStream rttTextStream) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this {@link Connection} that it should terminate any existing RTT communication
|
||||||
|
* channel. No response to Telecom is needed for this method.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void onStopRtt() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this connection of a response to a previous remotely-initiated RTT upgrade
|
||||||
|
* request sent via {@link #sendRemoteRttRequest}. Acceptance of the request is
|
||||||
|
* indicated by the supplied {@link RttTextStream} being non-null, and rejection is
|
||||||
|
* indicated by {@code rttTextStream} being {@code null}
|
||||||
|
* @hide
|
||||||
|
* @param rttTextStream The object that should be used to send text to or receive text from
|
||||||
|
* the in-call app.
|
||||||
|
*/
|
||||||
|
public void handleRttUpgradeResponse(@Nullable RttTextStream rttTextStream) {}
|
||||||
|
|
||||||
static String toLogSafePhoneNumber(String number) {
|
static String toLogSafePhoneNumber(String number) {
|
||||||
// For unknown number, log empty string.
|
// For unknown number, log empty string.
|
||||||
if (number == null) {
|
if (number == null) {
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ import android.os.Handler;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
|
import android.os.RemoteException;
|
||||||
import android.telecom.Logging.Session;
|
import android.telecom.Logging.Session;
|
||||||
|
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
@@ -119,6 +121,9 @@ public abstract class ConnectionService extends Service {
|
|||||||
private static final String SESSION_PULL_EXTERNAL_CALL = "CS.pEC";
|
private static final String SESSION_PULL_EXTERNAL_CALL = "CS.pEC";
|
||||||
private static final String SESSION_SEND_CALL_EVENT = "CS.sCE";
|
private static final String SESSION_SEND_CALL_EVENT = "CS.sCE";
|
||||||
private static final String SESSION_EXTRAS_CHANGED = "CS.oEC";
|
private static final String SESSION_EXTRAS_CHANGED = "CS.oEC";
|
||||||
|
private static final String SESSION_START_RTT = "CS.+RTT";
|
||||||
|
private static final String SESSION_STOP_RTT = "CS.-RTT";
|
||||||
|
private static final String SESSION_RTT_UPGRADE_RESPONSE = "CS.rTRUR";
|
||||||
|
|
||||||
private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1;
|
private static final int MSG_ADD_CONNECTION_SERVICE_ADAPTER = 1;
|
||||||
private static final int MSG_CREATE_CONNECTION = 2;
|
private static final int MSG_CREATE_CONNECTION = 2;
|
||||||
@@ -144,6 +149,9 @@ public abstract class ConnectionService extends Service {
|
|||||||
private static final int MSG_SEND_CALL_EVENT = 23;
|
private static final int MSG_SEND_CALL_EVENT = 23;
|
||||||
private static final int MSG_ON_EXTRAS_CHANGED = 24;
|
private static final int MSG_ON_EXTRAS_CHANGED = 24;
|
||||||
private static final int MSG_CREATE_CONNECTION_FAILED = 25;
|
private static final int MSG_CREATE_CONNECTION_FAILED = 25;
|
||||||
|
private static final int MSG_ON_START_RTT = 26;
|
||||||
|
private static final int MSG_ON_STOP_RTT = 27;
|
||||||
|
private static final int MSG_RTT_UPGRADE_RESPONSE = 28;
|
||||||
|
|
||||||
private static Connection sNullConnection;
|
private static Connection sNullConnection;
|
||||||
|
|
||||||
@@ -503,6 +511,53 @@ public abstract class ConnectionService extends Service {
|
|||||||
Log.endSession();
|
Log.endSession();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startRtt(String callId, ParcelFileDescriptor fromInCall,
|
||||||
|
ParcelFileDescriptor toInCall, Session.Info sessionInfo) throws RemoteException {
|
||||||
|
Log.startSession(sessionInfo, SESSION_START_RTT);
|
||||||
|
try {
|
||||||
|
SomeArgs args = SomeArgs.obtain();
|
||||||
|
args.arg1 = callId;
|
||||||
|
args.arg2 = new Connection.RttTextStream(toInCall, fromInCall);
|
||||||
|
args.arg3 = Log.createSubsession();
|
||||||
|
mHandler.obtainMessage(MSG_ON_START_RTT, args).sendToTarget();
|
||||||
|
} finally {
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopRtt(String callId, Session.Info sessionInfo) throws RemoteException {
|
||||||
|
Log.startSession(sessionInfo, SESSION_STOP_RTT);
|
||||||
|
try {
|
||||||
|
SomeArgs args = SomeArgs.obtain();
|
||||||
|
args.arg1 = callId;
|
||||||
|
args.arg2 = Log.createSubsession();
|
||||||
|
mHandler.obtainMessage(MSG_ON_STOP_RTT, args).sendToTarget();
|
||||||
|
} finally {
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void respondToRttUpgradeRequest(String callId, ParcelFileDescriptor fromInCall,
|
||||||
|
ParcelFileDescriptor toInCall, Session.Info sessionInfo) throws RemoteException {
|
||||||
|
Log.startSession(sessionInfo, SESSION_RTT_UPGRADE_RESPONSE);
|
||||||
|
try {
|
||||||
|
SomeArgs args = SomeArgs.obtain();
|
||||||
|
args.arg1 = callId;
|
||||||
|
if (toInCall == null || fromInCall == null) {
|
||||||
|
args.arg2 = null;
|
||||||
|
} else {
|
||||||
|
args.arg2 = new Connection.RttTextStream(toInCall, fromInCall);
|
||||||
|
}
|
||||||
|
args.arg3 = Log.createSubsession();
|
||||||
|
mHandler.obtainMessage(MSG_RTT_UPGRADE_RESPONSE, args).sendToTarget();
|
||||||
|
} finally {
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||||
@@ -854,6 +909,49 @@ public abstract class ConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MSG_ON_START_RTT: {
|
||||||
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
|
try {
|
||||||
|
Log.continueSession((Session) args.arg3,
|
||||||
|
SESSION_HANDLER + SESSION_START_RTT);
|
||||||
|
String callId = (String) args.arg1;
|
||||||
|
Connection.RttTextStream rttTextStream =
|
||||||
|
(Connection.RttTextStream) args.arg2;
|
||||||
|
startRtt(callId, rttTextStream);
|
||||||
|
} finally {
|
||||||
|
args.recycle();
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MSG_ON_STOP_RTT: {
|
||||||
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
|
try {
|
||||||
|
Log.continueSession((Session) args.arg2,
|
||||||
|
SESSION_HANDLER + SESSION_STOP_RTT);
|
||||||
|
String callId = (String) args.arg1;
|
||||||
|
stopRtt(callId);
|
||||||
|
} finally {
|
||||||
|
args.recycle();
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MSG_RTT_UPGRADE_RESPONSE: {
|
||||||
|
SomeArgs args = (SomeArgs) msg.obj;
|
||||||
|
try {
|
||||||
|
Log.continueSession((Session) args.arg3,
|
||||||
|
SESSION_HANDLER + SESSION_RTT_UPGRADE_RESPONSE);
|
||||||
|
String callId = (String) args.arg1;
|
||||||
|
Connection.RttTextStream rttTextStream =
|
||||||
|
(Connection.RttTextStream) args.arg2;
|
||||||
|
handleRttUpgradeResponse(callId, rttTextStream);
|
||||||
|
} finally {
|
||||||
|
args.recycle();
|
||||||
|
Log.endSession();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1142,6 +1240,38 @@ public abstract class ConnectionService extends Service {
|
|||||||
mAdapter.setAudioRoute(id, audioRoute);
|
mAdapter.setAudioRoute(id, audioRoute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationSuccess(Connection c) {
|
||||||
|
String id = mIdByConnection.get(c);
|
||||||
|
if (id != null) {
|
||||||
|
mAdapter.onRttInitiationSuccess(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationFailure(Connection c, int reason) {
|
||||||
|
String id = mIdByConnection.get(c);
|
||||||
|
if (id != null) {
|
||||||
|
mAdapter.onRttInitiationFailure(id, reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttSessionRemotelyTerminated(Connection c) {
|
||||||
|
String id = mIdByConnection.get(c);
|
||||||
|
if (id != null) {
|
||||||
|
mAdapter.onRttSessionRemotelyTerminated(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoteRttRequest(Connection c) {
|
||||||
|
String id = mIdByConnection.get(c);
|
||||||
|
if (id != null) {
|
||||||
|
mAdapter.onRemoteRttRequest(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@@ -1437,7 +1567,6 @@ public abstract class ConnectionService extends Service {
|
|||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
connection.onCallEvent(event, extras);
|
connection.onCallEvent(event, extras);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1461,6 +1590,34 @@ public abstract class ConnectionService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startRtt(String callId, Connection.RttTextStream rttTextStream) {
|
||||||
|
Log.d(this, "startRtt(%s)", callId);
|
||||||
|
if (mConnectionById.containsKey(callId)) {
|
||||||
|
findConnectionForAction(callId, "startRtt").onStartRtt(rttTextStream);
|
||||||
|
} else if (mConferenceById.containsKey(callId)) {
|
||||||
|
Log.w(this, "startRtt called on a conference.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopRtt(String callId) {
|
||||||
|
Log.d(this, "stopRtt(%s)", callId);
|
||||||
|
if (mConnectionById.containsKey(callId)) {
|
||||||
|
findConnectionForAction(callId, "stopRtt").onStopRtt();
|
||||||
|
} else if (mConferenceById.containsKey(callId)) {
|
||||||
|
Log.w(this, "stopRtt called on a conference.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleRttUpgradeResponse(String callId, Connection.RttTextStream rttTextStream) {
|
||||||
|
Log.d(this, "handleRttUpgradeResponse(%s, %s)", callId, rttTextStream == null);
|
||||||
|
if (mConnectionById.containsKey(callId)) {
|
||||||
|
findConnectionForAction(callId, "handleRttUpgradeResponse")
|
||||||
|
.handleRttUpgradeResponse(rttTextStream);
|
||||||
|
} else if (mConferenceById.containsKey(callId)) {
|
||||||
|
Log.w(this, "handleRttUpgradeResponse called on a conference.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onPostDialContinue(String callId, boolean proceed) {
|
private void onPostDialContinue(String callId, boolean proceed) {
|
||||||
Log.d(this, "onPostDialContinue(%s)", callId);
|
Log.d(this, "onPostDialContinue(%s)", callId);
|
||||||
findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed);
|
findConnectionForAction(callId, "stopDtmfTone").onPostDialContinue(proceed);
|
||||||
|
|||||||
@@ -547,4 +547,66 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies Telecom that an RTT session was successfully established.
|
||||||
|
*
|
||||||
|
* @param callId The unique ID of the call.
|
||||||
|
*/
|
||||||
|
void onRttInitiationSuccess(String callId) {
|
||||||
|
Log.v(this, "onRttInitiationSuccess: %s", callId);
|
||||||
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||||
|
try {
|
||||||
|
adapter.onRttInitiationSuccess(callId, Log.getExternalSession());
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies Telecom that a requested RTT session failed to be established.
|
||||||
|
*
|
||||||
|
* @param callId The unique ID of the call.
|
||||||
|
*/
|
||||||
|
void onRttInitiationFailure(String callId, int reason) {
|
||||||
|
Log.v(this, "onRttInitiationFailure: %s", callId);
|
||||||
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||||
|
try {
|
||||||
|
adapter.onRttInitiationFailure(callId, reason, Log.getExternalSession());
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies Telecom that an established RTT session was terminated by the remote user on
|
||||||
|
* the call.
|
||||||
|
*
|
||||||
|
* @param callId The unique ID of the call.
|
||||||
|
*/
|
||||||
|
void onRttSessionRemotelyTerminated(String callId) {
|
||||||
|
Log.v(this, "onRttSessionRemotelyTerminated: %s", callId);
|
||||||
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||||
|
try {
|
||||||
|
adapter.onRttSessionRemotelyTerminated(callId, Log.getExternalSession());
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies Telecom that the remote user on the call has requested an upgrade to an RTT
|
||||||
|
* session for this call.
|
||||||
|
*
|
||||||
|
* @param callId The unique ID of the call.
|
||||||
|
*/
|
||||||
|
void onRemoteRttRequest(String callId) {
|
||||||
|
Log.v(this, "onRemoteRttRequest: %s", callId);
|
||||||
|
for (IConnectionServiceAdapter adapter : mAdapters) {
|
||||||
|
try {
|
||||||
|
adapter.onRemoteRttRequest(callId, Log.getExternalSession());
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,10 @@ final class ConnectionServiceAdapterServant {
|
|||||||
private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
|
private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
|
||||||
private static final int MSG_SET_PULLING = 28;
|
private static final int MSG_SET_PULLING = 28;
|
||||||
private static final int MSG_SET_AUDIO_ROUTE = 29;
|
private static final int MSG_SET_AUDIO_ROUTE = 29;
|
||||||
|
private static final int MSG_ON_RTT_INITIATION_SUCCESS = 30;
|
||||||
|
private static final int MSG_ON_RTT_INITIATION_FAILURE = 31;
|
||||||
|
private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32;
|
||||||
|
private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33;
|
||||||
|
|
||||||
private final IConnectionServiceAdapter mDelegate;
|
private final IConnectionServiceAdapter mDelegate;
|
||||||
|
|
||||||
@@ -300,6 +304,20 @@ final class ConnectionServiceAdapterServant {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MSG_ON_RTT_INITIATION_SUCCESS:
|
||||||
|
mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
|
||||||
|
break;
|
||||||
|
case MSG_ON_RTT_INITIATION_FAILURE:
|
||||||
|
mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
|
||||||
|
null /*Session.Info*/);
|
||||||
|
break;
|
||||||
|
case MSG_ON_RTT_REMOTELY_TERMINATED:
|
||||||
|
mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
|
||||||
|
null /*Session.Info*/);
|
||||||
|
break;
|
||||||
|
case MSG_ON_RTT_UPGRADE_REQUEST:
|
||||||
|
mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -537,6 +555,32 @@ final class ConnectionServiceAdapterServant {
|
|||||||
args.arg3 = extras;
|
args.arg3 = extras;
|
||||||
mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
|
mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationFailure(String connectionId, int reason,
|
||||||
|
Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
|
||||||
|
.sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
|
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
|
||||||
|
|||||||
@@ -379,9 +379,9 @@ public final class InCallAdapter {
|
|||||||
/**
|
/**
|
||||||
* Sends an RTT upgrade request to the remote end of the connection.
|
* Sends an RTT upgrade request to the remote end of the connection.
|
||||||
*/
|
*/
|
||||||
public void sendRttRequest() {
|
public void sendRttRequest(String callId) {
|
||||||
try {
|
try {
|
||||||
mAdapter.sendRttRequest();
|
mAdapter.sendRttRequest(callId);
|
||||||
} catch (RemoteException ignored) {
|
} catch (RemoteException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,9 +392,9 @@ public final class InCallAdapter {
|
|||||||
* @param id the ID of the request as specified by Telecom
|
* @param id the ID of the request as specified by Telecom
|
||||||
* @param accept Whether the request should be accepted.
|
* @param accept Whether the request should be accepted.
|
||||||
*/
|
*/
|
||||||
public void respondToRttRequest(int id, boolean accept) {
|
public void respondToRttRequest(String callId, int id, boolean accept) {
|
||||||
try {
|
try {
|
||||||
mAdapter.respondToRttRequest(id, accept);
|
mAdapter.respondToRttRequest(callId, id, accept);
|
||||||
} catch (RemoteException ignored) {
|
} catch (RemoteException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -402,9 +402,9 @@ public final class InCallAdapter {
|
|||||||
/**
|
/**
|
||||||
* Instructs Telecom to shut down the RTT communication channel.
|
* Instructs Telecom to shut down the RTT communication channel.
|
||||||
*/
|
*/
|
||||||
public void stopRtt() {
|
public void stopRtt(String callId) {
|
||||||
try {
|
try {
|
||||||
mAdapter.stopRtt();
|
mAdapter.stopRtt(callId);
|
||||||
} catch (RemoteException ignored) {
|
} catch (RemoteException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,9 +413,9 @@ public final class InCallAdapter {
|
|||||||
* Sets the RTT audio mode.
|
* Sets the RTT audio mode.
|
||||||
* @param mode the desired RTT audio mode
|
* @param mode the desired RTT audio mode
|
||||||
*/
|
*/
|
||||||
public void setRttMode(int mode) {
|
public void setRttMode(String callId, int mode) {
|
||||||
try {
|
try {
|
||||||
mAdapter.setRttMode(mode);
|
mAdapter.setRttMode(callId, mode);
|
||||||
} catch (RemoteException ignored) {
|
} catch (RemoteException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public abstract class InCallService extends Service {
|
|||||||
private static final int MSG_SILENCE_RINGER = 8;
|
private static final int MSG_SILENCE_RINGER = 8;
|
||||||
private static final int MSG_ON_CONNECTION_EVENT = 9;
|
private static final int MSG_ON_CONNECTION_EVENT = 9;
|
||||||
private static final int MSG_ON_RTT_UPGRADE_REQUEST = 10;
|
private static final int MSG_ON_RTT_UPGRADE_REQUEST = 10;
|
||||||
|
private static final int MSG_ON_RTT_INITIATION_FAILURE = 11;
|
||||||
|
|
||||||
/** Default Handler used to consolidate binder method calls onto a single thread. */
|
/** Default Handler used to consolidate binder method calls onto a single thread. */
|
||||||
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||||
@@ -141,6 +142,12 @@ public abstract class InCallService extends Service {
|
|||||||
mPhone.internalOnRttUpgradeRequest(callId, requestId);
|
mPhone.internalOnRttUpgradeRequest(callId, requestId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MSG_ON_RTT_INITIATION_FAILURE: {
|
||||||
|
String callId = (String) msg.obj;
|
||||||
|
int reason = msg.arg1;
|
||||||
|
mPhone.internalOnRttInitiationFailure(callId, reason);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -211,6 +218,11 @@ public abstract class InCallService extends Service {
|
|||||||
public void onRttUpgradeRequest(String callId, int id) {
|
public void onRttUpgradeRequest(String callId, int id) {
|
||||||
mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, id, 0, callId).sendToTarget();
|
mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, id, 0, callId).sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationFailure(String callId, int reason) {
|
||||||
|
mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, callId).sendToTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Phone.Listener mPhoneListener = new Phone.Listener() {
|
private Phone.Listener mPhoneListener = new Phone.Listener() {
|
||||||
|
|||||||
@@ -214,6 +214,13 @@ public final class Phone {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final void internalOnRttInitiationFailure(String callId, int reason) {
|
||||||
|
Call call = mCallByTelecomCallId.get(callId);
|
||||||
|
if (call != null) {
|
||||||
|
call.internalOnRttInitiationFailure(reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to destroy the phone and cleanup any lingering calls.
|
* Called to destroy the phone and cleanup any lingering calls.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.android.internal.telecom.IConnectionService;
|
|||||||
import com.android.internal.telecom.IVideoCallback;
|
import com.android.internal.telecom.IVideoCallback;
|
||||||
import com.android.internal.telecom.IVideoProvider;
|
import com.android.internal.telecom.IVideoProvider;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.hardware.camera2.CameraManager;
|
import android.hardware.camera2.CameraManager;
|
||||||
@@ -231,6 +232,41 @@ public final class RemoteConnection {
|
|||||||
* @param extras Extras associated with the event.
|
* @param extras Extras associated with the event.
|
||||||
*/
|
*/
|
||||||
public void onConnectionEvent(RemoteConnection connection, String event, Bundle extras) {}
|
public void onConnectionEvent(RemoteConnection connection, String event, Bundle extras) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that a RTT session was successfully established on this
|
||||||
|
* {@link RemoteConnection}. See {@link Connection#sendRttInitiationSuccess()}.
|
||||||
|
* @hide
|
||||||
|
* @param connection The {@code RemoteConnection} invoking this method.
|
||||||
|
*/
|
||||||
|
public void onRttInitiationSuccess(RemoteConnection connection) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that a RTT session failed to be established on this
|
||||||
|
* {@link RemoteConnection}. See {@link Connection#sendRttInitiationFailure()}.
|
||||||
|
* @hide
|
||||||
|
* @param connection The {@code RemoteConnection} invoking this method.
|
||||||
|
* @param reason One of the reason codes defined in {@link Connection.RttModifyStatus},
|
||||||
|
* with the exception of
|
||||||
|
* {@link Connection.RttModifyStatus#SESSION_MODIFY_REQUEST_SUCCESS}.
|
||||||
|
*/
|
||||||
|
public void onRttInitiationFailure(RemoteConnection connection, int reason) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that an established RTT session was terminated remotely on this
|
||||||
|
* {@link RemoteConnection}. See {@link Connection#sendRttSessionRemotelyTerminated()}
|
||||||
|
* @hide
|
||||||
|
* @param connection The {@code RemoteConnection} invoking this method.
|
||||||
|
*/
|
||||||
|
public void onRttSessionRemotelyTerminated(RemoteConnection connection) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates that the remote user on this {@link RemoteConnection} has requested an upgrade
|
||||||
|
* to an RTT session. See {@link Connection#sendRemoteRttRequest()}
|
||||||
|
* @hide
|
||||||
|
* @param connection The {@code RemoteConnection} invoking this method.
|
||||||
|
*/
|
||||||
|
public void onRemoteRttRequest(RemoteConnection connection) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1051,6 +1087,61 @@ public final class RemoteConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this {@link RemoteConnection} that the user has requested an RTT session.
|
||||||
|
* @param rttTextStream The object that should be used to send text to or receive text from
|
||||||
|
* the in-call app.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void startRtt(@NonNull Connection.RttTextStream rttTextStream) {
|
||||||
|
try {
|
||||||
|
if (mConnected) {
|
||||||
|
mConnectionService.startRtt(mConnectionId, rttTextStream.getFdFromInCall(),
|
||||||
|
rttTextStream.getFdToInCall(), null /*Session.Info*/);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this {@link RemoteConnection} that it should terminate any existing RTT
|
||||||
|
* session. No response to Telecom is needed for this method.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void stopRtt() {
|
||||||
|
try {
|
||||||
|
if (mConnected) {
|
||||||
|
mConnectionService.stopRtt(mConnectionId, null /*Session.Info*/);
|
||||||
|
}
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies this {@link RemoteConnection} of a response to a previous remotely-initiated RTT
|
||||||
|
* upgrade request sent via {@link Connection#sendRemoteRttRequest}.
|
||||||
|
* Acceptance of the request is indicated by the supplied {@link RttTextStream} being non-null,
|
||||||
|
* and rejection is indicated by {@code rttTextStream} being {@code null}
|
||||||
|
* @hide
|
||||||
|
* @param rttTextStream The object that should be used to send text to or receive text from
|
||||||
|
* the in-call app.
|
||||||
|
*/
|
||||||
|
public void sendRttUpgradeResponse(@Nullable Connection.RttTextStream rttTextStream) {
|
||||||
|
try {
|
||||||
|
if (mConnected) {
|
||||||
|
if (rttTextStream == null) {
|
||||||
|
mConnectionService.respondToRttUpgradeRequest(mConnectionId,
|
||||||
|
null, null, null /*Session.Info*/);
|
||||||
|
} else {
|
||||||
|
mConnectionService.respondToRttUpgradeRequest(mConnectionId,
|
||||||
|
rttTextStream.getFdFromInCall(), rttTextStream.getFdToInCall(),
|
||||||
|
null /*Session.Info*/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (RemoteException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain the {@code RemoteConnection}s with which this {@code RemoteConnection} may be
|
* Obtain the {@code RemoteConnection}s with which this {@code RemoteConnection} may be
|
||||||
* successfully asked to create a conference with.
|
* successfully asked to create a conference with.
|
||||||
@@ -1417,6 +1508,47 @@ public final class RemoteConnection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
void onRttInitiationSuccess() {
|
||||||
|
for (CallbackRecord record : mCallbackRecords) {
|
||||||
|
final RemoteConnection connection = this;
|
||||||
|
final Callback callback = record.getCallback();
|
||||||
|
record.getHandler().post(
|
||||||
|
() -> callback.onRttInitiationSuccess(connection));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
void onRttInitiationFailure(int reason) {
|
||||||
|
for (CallbackRecord record : mCallbackRecords) {
|
||||||
|
final RemoteConnection connection = this;
|
||||||
|
final Callback callback = record.getCallback();
|
||||||
|
record.getHandler().post(
|
||||||
|
() -> callback.onRttInitiationFailure(connection, reason));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
void onRttSessionRemotelyTerminated() {
|
||||||
|
for (CallbackRecord record : mCallbackRecords) {
|
||||||
|
final RemoteConnection connection = this;
|
||||||
|
final Callback callback = record.getCallback();
|
||||||
|
record.getHandler().post(
|
||||||
|
() -> callback.onRttSessionRemotelyTerminated(connection));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
void onRemoteRttRequest() {
|
||||||
|
for (CallbackRecord record : mCallbackRecords) {
|
||||||
|
final RemoteConnection connection = this;
|
||||||
|
final Callback callback = record.getCallback();
|
||||||
|
record.getHandler().post(
|
||||||
|
() -> callback.onRemoteRttRequest(connection));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/**
|
/**
|
||||||
* Create a RemoteConnection represents a failure, and which will be in
|
* Create a RemoteConnection represents a failure, and which will be in
|
||||||
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
|
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
|
||||||
|
|||||||
@@ -409,6 +409,50 @@ final class RemoteConnectionService {
|
|||||||
extras);
|
extras);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationSuccess(String callId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
if (hasConnection(callId)) {
|
||||||
|
findConnectionForAction(callId, "onRttInitiationSuccess")
|
||||||
|
.onRttInitiationSuccess();
|
||||||
|
} else {
|
||||||
|
Log.w(this, "onRttInitiationSuccess called on a remote conference");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttInitiationFailure(String callId, int reason, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
if (hasConnection(callId)) {
|
||||||
|
findConnectionForAction(callId, "onRttInitiationFailure")
|
||||||
|
.onRttInitiationFailure(reason);
|
||||||
|
} else {
|
||||||
|
Log.w(this, "onRttInitiationFailure called on a remote conference");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRttSessionRemotelyTerminated(String callId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
if (hasConnection(callId)) {
|
||||||
|
findConnectionForAction(callId, "onRttSessionRemotelyTerminated")
|
||||||
|
.onRttSessionRemotelyTerminated();
|
||||||
|
} else {
|
||||||
|
Log.w(this, "onRttSessionRemotelyTerminated called on a remote conference");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRemoteRttRequest(String callId, Session.Info sessionInfo)
|
||||||
|
throws RemoteException {
|
||||||
|
if (hasConnection(callId)) {
|
||||||
|
findConnectionForAction(callId, "onRemoteRttRequest")
|
||||||
|
.onRemoteRttRequest();
|
||||||
|
} else {
|
||||||
|
Log.w(this, "onRemoteRttRequest called on a remote conference");
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ConnectionServiceAdapterServant mServant =
|
private final ConnectionServiceAdapterServant mServant =
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.android.internal.telecom;
|
package com.android.internal.telecom;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.telecom.CallAudioState;
|
import android.telecom.CallAudioState;
|
||||||
import android.telecom.ConnectionRequest;
|
import android.telecom.ConnectionRequest;
|
||||||
import android.telecom.Logging.Session;
|
import android.telecom.Logging.Session;
|
||||||
@@ -89,4 +90,12 @@ oneway interface IConnectionService {
|
|||||||
void sendCallEvent(String callId, String event, in Bundle extras, in Session.Info sessionInfo);
|
void sendCallEvent(String callId, String event, in Bundle extras, in Session.Info sessionInfo);
|
||||||
|
|
||||||
void onExtrasChanged(String callId, in Bundle extras, in Session.Info sessionInfo);
|
void onExtrasChanged(String callId, in Bundle extras, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void startRtt(String callId, in ParcelFileDescriptor fromInCall,
|
||||||
|
in ParcelFileDescriptor toInCall, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void stopRtt(String callId, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void respondToRttUpgradeRequest(String callId, in ParcelFileDescriptor fromInCall,
|
||||||
|
in ParcelFileDescriptor toInCall, in Session.Info sessionInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,4 +106,12 @@ oneway interface IConnectionServiceAdapter {
|
|||||||
|
|
||||||
void onConnectionEvent(String callId, String event, in Bundle extras,
|
void onConnectionEvent(String callId, String event, in Bundle extras,
|
||||||
in Session.Info sessionInfo);
|
in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void onRttInitiationSuccess(String callId, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void onRttInitiationFailure(String callId, int reason, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void onRttSessionRemotelyTerminated(String callId, in Session.Info sessionInfo);
|
||||||
|
|
||||||
|
void onRemoteRttRequest(String callId, in Session.Info sessionInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,11 +70,11 @@ oneway interface IInCallAdapter {
|
|||||||
|
|
||||||
void removeExtras(String callId, in List<String> keys);
|
void removeExtras(String callId, in List<String> keys);
|
||||||
|
|
||||||
void sendRttRequest();
|
void sendRttRequest(String callId);
|
||||||
|
|
||||||
void respondToRttRequest(int id, boolean accept);
|
void respondToRttRequest(String callId, int id, boolean accept);
|
||||||
|
|
||||||
void stopRtt();
|
void stopRtt(String callId);
|
||||||
|
|
||||||
void setRttMode(int mode);
|
void setRttMode(String callId, int mode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,4 +52,6 @@ oneway interface IInCallService {
|
|||||||
void onConnectionEvent(String callId, String event, in Bundle extras);
|
void onConnectionEvent(String callId, String event, in Bundle extras);
|
||||||
|
|
||||||
void onRttUpgradeRequest(String callId, int id);
|
void onRttUpgradeRequest(String callId, int id);
|
||||||
|
|
||||||
|
void onRttInitiationFailure(String callId, int reason);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user