blob: 3fbdeb1effb09a8f8ef78c8cf87672ffd52499c3 [file] [log] [blame]
Ihab Awad5d0410f2014-07-30 10:07:40 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 R* limitations under the License.
15 */
16
Tyler Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Ihab Awad5d0410f2014-07-30 10:07:40 -070018
Ihab Awad5d0410f2014-07-30 10:07:40 -070019import android.net.Uri;
Santos Cordon6b7f9552015-05-27 17:21:45 -070020import android.os.Bundle;
Ihab Awad5d0410f2014-07-30 10:07:40 -070021import android.os.Handler;
22import android.os.Message;
23import android.os.RemoteException;
Brad Ebinger4d75bee2016-10-28 12:29:55 -070024import android.telecom.Logging.Session;
Ihab Awad5d0410f2014-07-30 10:07:40 -070025
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070026import com.android.internal.os.SomeArgs;
Tyler Gunnef9f6f92014-09-12 22:16:17 -070027import com.android.internal.telecom.IConnectionServiceAdapter;
28import com.android.internal.telecom.IVideoProvider;
29import com.android.internal.telecom.RemoteServiceCallback;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070030
31import java.util.List;
32
Ihab Awad5d0410f2014-07-30 10:07:40 -070033/**
34 * A component that provides an RPC servant implementation of {@link IConnectionServiceAdapter},
35 * posting incoming messages on the main thread on a client-supplied delegate object.
36 *
37 * TODO: Generate this and similar classes using a compiler starting from AIDL interfaces.
38 *
39 * @hide
40 */
41final class ConnectionServiceAdapterServant {
Ihab Awad6107bab2014-08-18 09:23:25 -070042 private static final int MSG_HANDLE_CREATE_CONNECTION_COMPLETE = 1;
43 private static final int MSG_SET_ACTIVE = 2;
44 private static final int MSG_SET_RINGING = 3;
45 private static final int MSG_SET_DIALING = 4;
46 private static final int MSG_SET_DISCONNECTED = 5;
47 private static final int MSG_SET_ON_HOLD = 6;
Andrew Lee100e2932014-09-08 15:34:24 -070048 private static final int MSG_SET_RINGBACK_REQUESTED = 7;
Ihab Awad5c9c86e2014-11-12 13:41:16 -080049 private static final int MSG_SET_CONNECTION_CAPABILITIES = 8;
Ihab Awad6107bab2014-08-18 09:23:25 -070050 private static final int MSG_SET_IS_CONFERENCED = 9;
51 private static final int MSG_ADD_CONFERENCE_CALL = 10;
52 private static final int MSG_REMOVE_CALL = 11;
53 private static final int MSG_ON_POST_DIAL_WAIT = 12;
54 private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 13;
55 private static final int MSG_SET_VIDEO_STATE = 14;
56 private static final int MSG_SET_VIDEO_CALL_PROVIDER = 15;
Andrew Lee100e2932014-09-08 15:34:24 -070057 private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16;
Ihab Awad6107bab2014-08-18 09:23:25 -070058 private static final int MSG_SET_STATUS_HINTS = 17;
Andrew Lee100e2932014-09-08 15:34:24 -070059 private static final int MSG_SET_ADDRESS = 18;
Ihab Awad6107bab2014-08-18 09:23:25 -070060 private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
Evan Charlton23dc2412014-09-03 10:07:03 -070061 private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
Tyler Gunn4a57b9b2014-10-30 14:27:48 -070062 private static final int MSG_ADD_EXISTING_CONNECTION = 21;
Nancy Chen27d1c2d2014-12-15 16:12:50 -080063 private static final int MSG_ON_POST_DIAL_CHAR = 22;
Anthony Lee17455a32015-04-24 15:25:29 -070064 private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
Tyler Gunndee56a82016-03-23 16:06:34 -070065 private static final int MSG_PUT_EXTRAS = 24;
66 private static final int MSG_REMOVE_EXTRAS = 25;
67 private static final int MSG_ON_CONNECTION_EVENT = 26;
Tyler Gunn720c6642016-03-22 09:02:47 -070068 private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
Tyler Gunnc96b5e02016-07-07 22:53:57 -070069 private static final int MSG_SET_PULLING = 28;
Tyler Gunnf5035432017-01-09 09:43:12 -080070 private static final int MSG_SET_AUDIO_ROUTE = 29;
Hall Liu57006aa2017-02-06 10:49:48 -080071 private static final int MSG_ON_RTT_INITIATION_SUCCESS = 30;
72 private static final int MSG_ON_RTT_INITIATION_FAILURE = 31;
73 private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32;
74 private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33;
Srikanth Chintalafcb15012017-05-04 20:58:34 +053075 private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34;
Ihab Awad5d0410f2014-07-30 10:07:40 -070076
77 private final IConnectionServiceAdapter mDelegate;
78
79 private final Handler mHandler = new Handler() {
80 @Override
81 public void handleMessage(Message msg) {
82 try {
83 internalHandleMessage(msg);
84 } catch (RemoteException e) {
85 }
86 }
87
88 // Internal method defined to centralize handling of RemoteException
89 private void internalHandleMessage(Message msg) throws RemoteException {
90 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070091 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070092 SomeArgs args = (SomeArgs) msg.obj;
93 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070094 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070095 (String) args.arg1,
96 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -070097 (ParcelableConnection) args.arg3,
98 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -070099 } finally {
100 args.recycle();
101 }
102 break;
103 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700104 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700105 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700106 break;
107 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700108 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700109 break;
110 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700111 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700112 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700113 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700114 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700115 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700116 case MSG_SET_DISCONNECTED: {
117 SomeArgs args = (SomeArgs) msg.obj;
118 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700119 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
120 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700121 } finally {
122 args.recycle();
123 }
124 break;
125 }
126 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700127 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700128 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700129 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700130 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
131 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700132 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800133 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700134 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
135 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700136 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700137 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700138 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
139 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700140 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700141 case MSG_SET_IS_CONFERENCED: {
142 SomeArgs args = (SomeArgs) msg.obj;
143 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700144 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
145 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700146 } finally {
147 args.recycle();
148 }
149 break;
150 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700151 case MSG_ADD_CONFERENCE_CALL: {
152 SomeArgs args = (SomeArgs) msg.obj;
153 try {
154 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700155 (String) args.arg1, (ParcelableConference) args.arg2,
156 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700157 } finally {
158 args.recycle();
159 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700160 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700161 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700162 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700163 mDelegate.removeCall((String) msg.obj,
164 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700165 break;
166 case MSG_ON_POST_DIAL_WAIT: {
167 SomeArgs args = (SomeArgs) msg.obj;
168 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700169 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
170 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700171 } finally {
172 args.recycle();
173 }
174 break;
175 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800176 case MSG_ON_POST_DIAL_CHAR: {
177 SomeArgs args = (SomeArgs) msg.obj;
178 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700179 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
180 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800181 } finally {
182 args.recycle();
183 }
184 break;
185 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700186 case MSG_QUERY_REMOTE_CALL_SERVICES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700187 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
188 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700189 break;
190 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700191 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700192 break;
193 case MSG_SET_VIDEO_CALL_PROVIDER: {
194 SomeArgs args = (SomeArgs) msg.obj;
195 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700196 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700197 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700198 } finally {
199 args.recycle();
200 }
201 break;
202 }
Andrew Lee100e2932014-09-08 15:34:24 -0700203 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700204 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
205 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700206 break;
207 case MSG_SET_STATUS_HINTS: {
208 SomeArgs args = (SomeArgs) msg.obj;
209 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700210 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
211 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700212 } finally {
213 args.recycle();
214 }
215 break;
216 }
Andrew Lee100e2932014-09-08 15:34:24 -0700217 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700218 SomeArgs args = (SomeArgs) msg.obj;
219 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700220 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
221 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700222 } finally {
223 args.recycle();
224 }
225 break;
226 }
227 case MSG_SET_CALLER_DISPLAY_NAME: {
228 SomeArgs args = (SomeArgs) msg.obj;
229 try {
230 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700231 (String) args.arg1, (String) args.arg2, args.argi1,
232 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700233 } finally {
234 args.recycle();
235 }
236 break;
237 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700238 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
239 SomeArgs args = (SomeArgs) msg.obj;
240 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700241 mDelegate.setConferenceableConnections((String) args.arg1,
242 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700243 } finally {
244 args.recycle();
245 }
246 break;
247 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700248 case MSG_ADD_EXISTING_CONNECTION: {
249 SomeArgs args = (SomeArgs) msg.obj;
250 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700251 mDelegate.addExistingConnection((String) args.arg1,
252 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700253 } finally {
254 args.recycle();
255 }
256 break;
257 }
Anthony Lee17455a32015-04-24 15:25:29 -0700258 case MSG_SET_CONFERENCE_MERGE_FAILED: {
259 SomeArgs args = (SomeArgs) msg.obj;
260 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700261 mDelegate.setConferenceMergeFailed((String) args.arg1,
262 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700263 } finally {
264 args.recycle();
265 }
266 break;
267 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700268 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700269 SomeArgs args = (SomeArgs) msg.obj;
270 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700271 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
272 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700273 } finally {
274 args.recycle();
275 }
276 break;
277 }
278 case MSG_REMOVE_EXTRAS: {
279 SomeArgs args = (SomeArgs) msg.obj;
280 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700281 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
282 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700283 } finally {
284 args.recycle();
285 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800286 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700287 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800288 case MSG_ON_CONNECTION_EVENT: {
289 SomeArgs args = (SomeArgs) msg.obj;
290 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700291 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700292 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800293 } finally {
294 args.recycle();
295 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800296 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800297 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800298 case MSG_SET_AUDIO_ROUTE: {
299 SomeArgs args = (SomeArgs) msg.obj;
300 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800301 mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
302 (Session.Info) args.arg3);
Tyler Gunnf5035432017-01-09 09:43:12 -0800303 } finally {
304 args.recycle();
305 }
306 break;
307 }
Hall Liu57006aa2017-02-06 10:49:48 -0800308 case MSG_ON_RTT_INITIATION_SUCCESS:
309 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
310 break;
311 case MSG_ON_RTT_INITIATION_FAILURE:
312 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
313 null /*Session.Info*/);
314 break;
315 case MSG_ON_RTT_REMOTELY_TERMINATED:
316 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
317 null /*Session.Info*/);
318 break;
319 case MSG_ON_RTT_UPGRADE_REQUEST:
320 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
321 break;
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530322 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
323 SomeArgs args = (SomeArgs) msg.obj;
324 try {
325 mDelegate.onPhoneAccountChanged((String) args.arg1,
326 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
327 } finally {
328 args.recycle();
329 }
330 break;
331 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700332 }
333 }
334 };
335
336 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
337 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700338 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700339 String id,
340 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700341 ParcelableConnection connection,
342 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700343 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700344 args.arg1 = id;
345 args.arg2 = request;
346 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700347 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700348 }
349
350 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700351 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700352 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
353 }
354
355 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700356 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700357 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
358 }
359
360 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700361 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700362 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
363 }
364
365 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700366 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700367 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
368 }
369
370 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700371 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
372 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700373 SomeArgs args = SomeArgs.obtain();
374 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700375 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700376 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
377 }
378
379 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700380 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700381 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
382 }
383
384 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700385 public void setRingbackRequested(String connectionId, boolean ringback,
386 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700387 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700388 .sendToTarget();
389 }
390
391 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700392 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
393 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800394 mHandler.obtainMessage(
395 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700396 .sendToTarget();
397 }
398
399 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700400 public void setConnectionProperties(String connectionId, int connectionProperties,
401 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700402 mHandler.obtainMessage(
403 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
404 .sendToTarget();
405 }
406
407 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700408 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700409 SomeArgs args = SomeArgs.obtain();
410 args.arg1 = callId;
411 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
412 }
413
414 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700415 public void setIsConferenced(String callId, String conferenceCallId,
416 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700417 SomeArgs args = SomeArgs.obtain();
418 args.arg1 = callId;
419 args.arg2 = conferenceCallId;
420 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
421 }
422
423 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700424 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
425 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700426 SomeArgs args = SomeArgs.obtain();
427 args.arg1 = callId;
428 args.arg2 = parcelableConference;
429 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700430 }
431
432 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700433 public void removeCall(String connectionId,
434 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700435 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
436 }
437
438 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700439 public void onPostDialWait(String connectionId, String remainingDigits,
440 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700441 SomeArgs args = SomeArgs.obtain();
442 args.arg1 = connectionId;
443 args.arg2 = remainingDigits;
444 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
445 }
446
447 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700448 public void onPostDialChar(String connectionId, char nextChar,
449 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800450 SomeArgs args = SomeArgs.obtain();
451 args.arg1 = connectionId;
452 args.argi1 = nextChar;
453 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
454 }
455
456 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700457 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
458 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700459 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
460 }
461
462 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700463 public void setVideoState(String connectionId, int videoState,
464 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700465 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
466 }
467
468 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700469 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
470 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700471 SomeArgs args = SomeArgs.obtain();
472 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700473 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700474 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
475 }
476
477 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700478 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
479 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700480 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700481 connectionId).sendToTarget();
482 }
483
484 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700485 public final void setStatusHints(String connectionId, StatusHints statusHints,
486 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700487 SomeArgs args = SomeArgs.obtain();
488 args.arg1 = connectionId;
489 args.arg2 = statusHints;
490 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
491 }
492
493 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700494 public final void setAddress(String connectionId, Uri address, int presentation,
495 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700496 SomeArgs args = SomeArgs.obtain();
497 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700498 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700499 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700500 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700501 }
502
503 @Override
504 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700505 String connectionId, String callerDisplayName, int presentation,
506 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700507 SomeArgs args = SomeArgs.obtain();
508 args.arg1 = connectionId;
509 args.arg2 = callerDisplayName;
510 args.argi1 = presentation;
511 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
512 }
513
514 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700515 public final void setConferenceableConnections(String connectionId,
516 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700517 SomeArgs args = SomeArgs.obtain();
518 args.arg1 = connectionId;
519 args.arg2 = conferenceableConnectionIds;
520 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
521 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700522
523 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700524 public final void addExistingConnection(String connectionId,
525 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700526 SomeArgs args = SomeArgs.obtain();
527 args.arg1 = connectionId;
528 args.arg2 = connection;
529 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
530 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700531
532 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700533 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700534 SomeArgs args = SomeArgs.obtain();
535 args.arg1 = connectionId;
536 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700537 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
538 }
539
540 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700541 public final void removeExtras(String connectionId, List<String> keys,
542 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700543 SomeArgs args = SomeArgs.obtain();
544 args.arg1 = connectionId;
545 args.arg2 = keys;
546 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700547 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800548
549 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800550 public final void setAudioRoute(String connectionId, int audioRoute,
Hall Liua98f58b52017-11-07 17:59:28 -0800551 String bluetoothAddress, Session.Info sessionInfo) {
Tyler Gunnf5035432017-01-09 09:43:12 -0800552 SomeArgs args = SomeArgs.obtain();
553 args.arg1 = connectionId;
554 args.argi1 = audioRoute;
Hall Liua98f58b52017-11-07 17:59:28 -0800555 args.arg2 = bluetoothAddress;
556 args.arg3 = sessionInfo;
Tyler Gunnf5035432017-01-09 09:43:12 -0800557 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
558 }
559
560 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700561 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
562 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800563 SomeArgs args = SomeArgs.obtain();
564 args.arg1 = connectionId;
565 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700566 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800567 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
568 }
Hall Liu57006aa2017-02-06 10:49:48 -0800569
570 @Override
571 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
572 throws RemoteException {
573 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
574 }
575
576 @Override
577 public void onRttInitiationFailure(String connectionId, int reason,
578 Session.Info sessionInfo)
579 throws RemoteException {
580 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
581 .sendToTarget();
582 }
583
584 @Override
585 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
586 throws RemoteException {
587 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
588 }
589
590 @Override
591 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
592 throws RemoteException {
593 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
594 }
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530595
596 @Override
597 public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
598 Session.Info sessionInfo) {
599 SomeArgs args = SomeArgs.obtain();
600 args.arg1 = callId;
601 args.arg2 = pHandle;
602 mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
603 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700604 };
605
606 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
607 mDelegate = delegate;
608 }
609
610 public IConnectionServiceAdapter getStub() {
611 return mStub;
612 }
613}