diff options
author | Hall Liu <hallliu@google.com> | 2017-02-06 10:49:48 -0800 |
---|---|---|
committer | Hall Liu <hallliu@google.com> | 2017-03-06 16:48:24 -0800 |
commit | b64ac4c57a863463df98d42feabe09f3cfe942db (patch) | |
tree | 146eb45d6d31720a2a061425085254427e101f4d /telecomm/java/android/telecom/Call.java | |
parent | 7f0300f1e20fc3c4c6c063eebcd0d4d1b407578c (diff) |
Add further Connection-side APIs for RTT (part 2)
Add methods and callbacks to facilitate local and remote RTT initiation
and termination in the middle of a call. Adds @hide Connection-side APIs
to communicate with the ConnectionService, as well as plumbing for
RemoteConnections.
Test: manual, through telecom testapps
Merged-In: Ia80604b7dff8586ff222dbccdbe55e91aab02178
Change-Id: Ia80604b7dff8586ff222dbccdbe55e91aab02178
Diffstat (limited to 'telecomm/java/android/telecom/Call.java')
-rw-r--r-- | telecomm/java/android/telecom/Call.java | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index e939b2e90d6c..9dc7dc5e30a6 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -871,6 +871,16 @@ public final class Call { * @param id The ID of the request. */ 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 int mRttMode; private final InCallAdapter mInCallAdapter; + private final String mTelecomCallId; private char[] mReadBuffer = new char[READ_BUFFER_SIZE]; /** * @hide */ - public RttCall(InputStreamReader receiveStream, OutputStreamWriter transmitStream, - int mode, InCallAdapter inCallAdapter) { + public RttCall(String telecomCallId, InputStreamReader receiveStream, + OutputStreamWriter transmitStream, int mode, InCallAdapter inCallAdapter) { + mTelecomCallId = telecomCallId; mReceiveStream = receiveStream; mTransmitStream = transmitStream; mRttMode = mode; @@ -942,7 +954,7 @@ public final class Call { * {@link #RTT_MODE_VCO}, or {@link #RTT_MODE_HCO}. */ public void setRttMode(@RttAudioMode int mode) { - mInCallAdapter.setRttMode(mode); + mInCallAdapter.setRttMode(mTelecomCallId, mode); } /** @@ -1213,7 +1225,7 @@ public final class Call { * {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback. */ public void sendRttRequest() { - mInCallAdapter.sendRttRequest(); + mInCallAdapter.sendRttRequest(mTelecomCallId); } /** @@ -1224,7 +1236,7 @@ public final class Call { * @param accept {@code true} if the RTT request should be accepted, {@code false} otherwise. */ public void respondToRttRequest(int id, boolean accept) { - mInCallAdapter.respondToRttRequest(id, accept); + mInCallAdapter.respondToRttRequest(mTelecomCallId, id, accept); } /** @@ -1232,7 +1244,7 @@ public final class Call { * the {@link Callback#onRttStatusChanged(Call, boolean, RttCall)} callback. */ public void stopRtt() { - mInCallAdapter.stopRtt(); + mInCallAdapter.stopRtt(mTelecomCallId); } /** @@ -1637,7 +1649,7 @@ public final class Call { new ParcelFileDescriptor.AutoCloseOutputStream( parcelableRttCall.getTransmitStream()), StandardCharsets.UTF_8); - RttCall newRttCall = new Call.RttCall( + RttCall newRttCall = new Call.RttCall(mTelecomCallId, receiveStream, transmitStream, parcelableRttCall.getRttMode(), mInCallAdapter); if (mRttCall == null) { isRttChanged = true; @@ -1717,6 +1729,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) { for (CallbackRecord<Callback> record : mCallbackRecords) { final Call call = this; |