blob: cc437f9c7cd0bcf7fcd639b8f3437b53e2a7977c [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;
Ihab Awad5d0410f2014-07-30 10:07:40 -070071
72 private final IConnectionServiceAdapter mDelegate;
73
74 private final Handler mHandler = new Handler() {
75 @Override
76 public void handleMessage(Message msg) {
77 try {
78 internalHandleMessage(msg);
79 } catch (RemoteException e) {
80 }
81 }
82
83 // Internal method defined to centralize handling of RemoteException
84 private void internalHandleMessage(Message msg) throws RemoteException {
85 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070086 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070087 SomeArgs args = (SomeArgs) msg.obj;
88 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070089 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070090 (String) args.arg1,
91 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -070092 (ParcelableConnection) args.arg3,
93 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -070094 } finally {
95 args.recycle();
96 }
97 break;
98 }
Ihab Awad5d0410f2014-07-30 10:07:40 -070099 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700100 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700101 break;
102 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700103 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700104 break;
105 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700106 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700107 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700108 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700109 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700110 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700111 case MSG_SET_DISCONNECTED: {
112 SomeArgs args = (SomeArgs) msg.obj;
113 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700114 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
115 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700116 } finally {
117 args.recycle();
118 }
119 break;
120 }
121 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700122 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700123 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700124 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700125 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
126 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700127 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800128 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700129 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
130 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700131 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700132 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700133 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
134 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700135 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700136 case MSG_SET_IS_CONFERENCED: {
137 SomeArgs args = (SomeArgs) msg.obj;
138 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700139 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
140 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700141 } finally {
142 args.recycle();
143 }
144 break;
145 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700146 case MSG_ADD_CONFERENCE_CALL: {
147 SomeArgs args = (SomeArgs) msg.obj;
148 try {
149 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700150 (String) args.arg1, (ParcelableConference) args.arg2,
151 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700152 } finally {
153 args.recycle();
154 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700155 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700156 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700157 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700158 mDelegate.removeCall((String) msg.obj,
159 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700160 break;
161 case MSG_ON_POST_DIAL_WAIT: {
162 SomeArgs args = (SomeArgs) msg.obj;
163 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700164 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
165 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700166 } finally {
167 args.recycle();
168 }
169 break;
170 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800171 case MSG_ON_POST_DIAL_CHAR: {
172 SomeArgs args = (SomeArgs) msg.obj;
173 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700174 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
175 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800176 } finally {
177 args.recycle();
178 }
179 break;
180 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700181 case MSG_QUERY_REMOTE_CALL_SERVICES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700182 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
183 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700184 break;
185 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700186 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700187 break;
188 case MSG_SET_VIDEO_CALL_PROVIDER: {
189 SomeArgs args = (SomeArgs) msg.obj;
190 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700191 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700192 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700193 } finally {
194 args.recycle();
195 }
196 break;
197 }
Andrew Lee100e2932014-09-08 15:34:24 -0700198 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700199 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
200 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700201 break;
202 case MSG_SET_STATUS_HINTS: {
203 SomeArgs args = (SomeArgs) msg.obj;
204 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700205 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
206 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700207 } finally {
208 args.recycle();
209 }
210 break;
211 }
Andrew Lee100e2932014-09-08 15:34:24 -0700212 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700213 SomeArgs args = (SomeArgs) msg.obj;
214 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700215 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
216 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700217 } finally {
218 args.recycle();
219 }
220 break;
221 }
222 case MSG_SET_CALLER_DISPLAY_NAME: {
223 SomeArgs args = (SomeArgs) msg.obj;
224 try {
225 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700226 (String) args.arg1, (String) args.arg2, args.argi1,
227 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700228 } finally {
229 args.recycle();
230 }
231 break;
232 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700233 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
234 SomeArgs args = (SomeArgs) msg.obj;
235 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700236 mDelegate.setConferenceableConnections((String) args.arg1,
237 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700238 } finally {
239 args.recycle();
240 }
241 break;
242 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700243 case MSG_ADD_EXISTING_CONNECTION: {
244 SomeArgs args = (SomeArgs) msg.obj;
245 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700246 mDelegate.addExistingConnection((String) args.arg1,
247 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700248 } finally {
249 args.recycle();
250 }
251 break;
252 }
Anthony Lee17455a32015-04-24 15:25:29 -0700253 case MSG_SET_CONFERENCE_MERGE_FAILED: {
254 SomeArgs args = (SomeArgs) msg.obj;
255 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700256 mDelegate.setConferenceMergeFailed((String) args.arg1,
257 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700258 } finally {
259 args.recycle();
260 }
261 break;
262 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700263 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700264 SomeArgs args = (SomeArgs) msg.obj;
265 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700266 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
267 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700268 } finally {
269 args.recycle();
270 }
271 break;
272 }
273 case MSG_REMOVE_EXTRAS: {
274 SomeArgs args = (SomeArgs) msg.obj;
275 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700276 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
277 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700278 } finally {
279 args.recycle();
280 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800281 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700282 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800283 case MSG_ON_CONNECTION_EVENT: {
284 SomeArgs args = (SomeArgs) msg.obj;
285 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700286 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700287 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800288 } finally {
289 args.recycle();
290 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800291 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800292 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800293 case MSG_SET_AUDIO_ROUTE: {
294 SomeArgs args = (SomeArgs) msg.obj;
295 try {
296 mDelegate.setAudioRoute((String) args.arg1, args.argi1,
297 (Session.Info) args.arg2);
298 } finally {
299 args.recycle();
300 }
301 break;
302 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700303 }
304 }
305 };
306
307 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
308 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700309 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700310 String id,
311 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700312 ParcelableConnection connection,
313 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700314 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700315 args.arg1 = id;
316 args.arg2 = request;
317 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700318 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700319 }
320
321 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700322 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700323 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
324 }
325
326 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700327 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700328 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
329 }
330
331 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700332 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700333 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
334 }
335
336 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700337 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700338 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
339 }
340
341 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700342 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
343 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700344 SomeArgs args = SomeArgs.obtain();
345 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700346 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700347 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
348 }
349
350 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700351 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700352 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
353 }
354
355 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700356 public void setRingbackRequested(String connectionId, boolean ringback,
357 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700358 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700359 .sendToTarget();
360 }
361
362 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700363 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
364 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800365 mHandler.obtainMessage(
366 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700367 .sendToTarget();
368 }
369
370 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700371 public void setConnectionProperties(String connectionId, int connectionProperties,
372 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700373 mHandler.obtainMessage(
374 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
375 .sendToTarget();
376 }
377
378 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700379 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700380 SomeArgs args = SomeArgs.obtain();
381 args.arg1 = callId;
382 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
383 }
384
385 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700386 public void setIsConferenced(String callId, String conferenceCallId,
387 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700388 SomeArgs args = SomeArgs.obtain();
389 args.arg1 = callId;
390 args.arg2 = conferenceCallId;
391 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
392 }
393
394 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700395 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
396 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700397 SomeArgs args = SomeArgs.obtain();
398 args.arg1 = callId;
399 args.arg2 = parcelableConference;
400 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700401 }
402
403 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700404 public void removeCall(String connectionId,
405 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700406 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
407 }
408
409 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700410 public void onPostDialWait(String connectionId, String remainingDigits,
411 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700412 SomeArgs args = SomeArgs.obtain();
413 args.arg1 = connectionId;
414 args.arg2 = remainingDigits;
415 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
416 }
417
418 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700419 public void onPostDialChar(String connectionId, char nextChar,
420 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800421 SomeArgs args = SomeArgs.obtain();
422 args.arg1 = connectionId;
423 args.argi1 = nextChar;
424 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
425 }
426
427 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700428 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
429 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700430 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
431 }
432
433 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700434 public void setVideoState(String connectionId, int videoState,
435 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700436 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
437 }
438
439 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700440 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
441 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700442 SomeArgs args = SomeArgs.obtain();
443 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700444 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700445 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
446 }
447
448 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700449 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
450 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700451 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700452 connectionId).sendToTarget();
453 }
454
455 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700456 public final void setStatusHints(String connectionId, StatusHints statusHints,
457 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700458 SomeArgs args = SomeArgs.obtain();
459 args.arg1 = connectionId;
460 args.arg2 = statusHints;
461 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
462 }
463
464 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700465 public final void setAddress(String connectionId, Uri address, int presentation,
466 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700467 SomeArgs args = SomeArgs.obtain();
468 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700469 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700470 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700471 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700472 }
473
474 @Override
475 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700476 String connectionId, String callerDisplayName, int presentation,
477 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700478 SomeArgs args = SomeArgs.obtain();
479 args.arg1 = connectionId;
480 args.arg2 = callerDisplayName;
481 args.argi1 = presentation;
482 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
483 }
484
485 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700486 public final void setConferenceableConnections(String connectionId,
487 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700488 SomeArgs args = SomeArgs.obtain();
489 args.arg1 = connectionId;
490 args.arg2 = conferenceableConnectionIds;
491 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
492 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700493
494 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700495 public final void addExistingConnection(String connectionId,
496 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700497 SomeArgs args = SomeArgs.obtain();
498 args.arg1 = connectionId;
499 args.arg2 = connection;
500 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
501 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700502
503 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700504 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700505 SomeArgs args = SomeArgs.obtain();
506 args.arg1 = connectionId;
507 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700508 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
509 }
510
511 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700512 public final void removeExtras(String connectionId, List<String> keys,
513 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700514 SomeArgs args = SomeArgs.obtain();
515 args.arg1 = connectionId;
516 args.arg2 = keys;
517 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700518 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800519
520 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800521 public final void setAudioRoute(String connectionId, int audioRoute,
522 Session.Info sessionInfo) {
523
524 SomeArgs args = SomeArgs.obtain();
525 args.arg1 = connectionId;
526 args.argi1 = audioRoute;
527 args.arg2 = sessionInfo;
528 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
529 }
530
531 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700532 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
533 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800534 SomeArgs args = SomeArgs.obtain();
535 args.arg1 = connectionId;
536 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700537 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800538 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
539 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700540 };
541
542 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
543 mDelegate = delegate;
544 }
545
546 public IConnectionServiceAdapter getStub() {
547 return mStub;
548 }
549}