blob: afe5e33bdaf2c2f9c422821df382bc3d2b0eaba1 [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;
Ihab Awad5d0410f2014-07-30 10:07:40 -070070
71 private final IConnectionServiceAdapter mDelegate;
72
73 private final Handler mHandler = new Handler() {
74 @Override
75 public void handleMessage(Message msg) {
76 try {
77 internalHandleMessage(msg);
78 } catch (RemoteException e) {
79 }
80 }
81
82 // Internal method defined to centralize handling of RemoteException
83 private void internalHandleMessage(Message msg) throws RemoteException {
84 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070085 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070086 SomeArgs args = (SomeArgs) msg.obj;
87 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070088 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070089 (String) args.arg1,
90 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -070091 (ParcelableConnection) args.arg3,
92 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -070093 } finally {
94 args.recycle();
95 }
96 break;
97 }
Ihab Awad5d0410f2014-07-30 10:07:40 -070098 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -070099 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700100 break;
101 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700102 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700103 break;
104 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700105 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700106 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700107 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700108 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700109 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700110 case MSG_SET_DISCONNECTED: {
111 SomeArgs args = (SomeArgs) msg.obj;
112 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700113 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
114 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700115 } finally {
116 args.recycle();
117 }
118 break;
119 }
120 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700121 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700122 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700123 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700124 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
125 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700126 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800127 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700128 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
129 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700130 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700131 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700132 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
133 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700134 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700135 case MSG_SET_IS_CONFERENCED: {
136 SomeArgs args = (SomeArgs) msg.obj;
137 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700138 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
139 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700140 } finally {
141 args.recycle();
142 }
143 break;
144 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700145 case MSG_ADD_CONFERENCE_CALL: {
146 SomeArgs args = (SomeArgs) msg.obj;
147 try {
148 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700149 (String) args.arg1, (ParcelableConference) args.arg2,
150 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700151 } finally {
152 args.recycle();
153 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700154 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700155 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700156 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700157 mDelegate.removeCall((String) msg.obj,
158 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700159 break;
160 case MSG_ON_POST_DIAL_WAIT: {
161 SomeArgs args = (SomeArgs) msg.obj;
162 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700163 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
164 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700165 } finally {
166 args.recycle();
167 }
168 break;
169 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800170 case MSG_ON_POST_DIAL_CHAR: {
171 SomeArgs args = (SomeArgs) msg.obj;
172 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700173 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
174 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800175 } finally {
176 args.recycle();
177 }
178 break;
179 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700180 case MSG_QUERY_REMOTE_CALL_SERVICES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700181 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
182 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700183 break;
184 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700185 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700186 break;
187 case MSG_SET_VIDEO_CALL_PROVIDER: {
188 SomeArgs args = (SomeArgs) msg.obj;
189 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700190 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700191 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700192 } finally {
193 args.recycle();
194 }
195 break;
196 }
Andrew Lee100e2932014-09-08 15:34:24 -0700197 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700198 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
199 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700200 break;
201 case MSG_SET_STATUS_HINTS: {
202 SomeArgs args = (SomeArgs) msg.obj;
203 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700204 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
205 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700206 } finally {
207 args.recycle();
208 }
209 break;
210 }
Andrew Lee100e2932014-09-08 15:34:24 -0700211 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700212 SomeArgs args = (SomeArgs) msg.obj;
213 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700214 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
215 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700216 } finally {
217 args.recycle();
218 }
219 break;
220 }
221 case MSG_SET_CALLER_DISPLAY_NAME: {
222 SomeArgs args = (SomeArgs) msg.obj;
223 try {
224 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700225 (String) args.arg1, (String) args.arg2, args.argi1,
226 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700227 } finally {
228 args.recycle();
229 }
230 break;
231 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700232 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
233 SomeArgs args = (SomeArgs) msg.obj;
234 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700235 mDelegate.setConferenceableConnections((String) args.arg1,
236 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700237 } finally {
238 args.recycle();
239 }
240 break;
241 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700242 case MSG_ADD_EXISTING_CONNECTION: {
243 SomeArgs args = (SomeArgs) msg.obj;
244 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700245 mDelegate.addExistingConnection((String) args.arg1,
246 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700247 } finally {
248 args.recycle();
249 }
250 break;
251 }
Anthony Lee17455a32015-04-24 15:25:29 -0700252 case MSG_SET_CONFERENCE_MERGE_FAILED: {
253 SomeArgs args = (SomeArgs) msg.obj;
254 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700255 mDelegate.setConferenceMergeFailed((String) args.arg1,
256 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700257 } finally {
258 args.recycle();
259 }
260 break;
261 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700262 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700263 SomeArgs args = (SomeArgs) msg.obj;
264 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700265 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
266 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700267 } finally {
268 args.recycle();
269 }
270 break;
271 }
272 case MSG_REMOVE_EXTRAS: {
273 SomeArgs args = (SomeArgs) msg.obj;
274 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700275 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
276 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700277 } finally {
278 args.recycle();
279 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800280 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700281 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800282 case MSG_ON_CONNECTION_EVENT: {
283 SomeArgs args = (SomeArgs) msg.obj;
284 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700285 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700286 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800287 } finally {
288 args.recycle();
289 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800290 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800291 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700292 }
293 }
294 };
295
296 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
297 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700298 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700299 String id,
300 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700301 ParcelableConnection connection,
302 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700303 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700304 args.arg1 = id;
305 args.arg2 = request;
306 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700307 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700308 }
309
310 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700311 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700312 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
313 }
314
315 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700316 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700317 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
318 }
319
320 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700321 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700322 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
323 }
324
325 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700326 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700327 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
328 }
329
330 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700331 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
332 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700333 SomeArgs args = SomeArgs.obtain();
334 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700335 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700336 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
337 }
338
339 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700340 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700341 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
342 }
343
344 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700345 public void setRingbackRequested(String connectionId, boolean ringback,
346 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700347 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700348 .sendToTarget();
349 }
350
351 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700352 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
353 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800354 mHandler.obtainMessage(
355 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700356 .sendToTarget();
357 }
358
359 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700360 public void setConnectionProperties(String connectionId, int connectionProperties,
361 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700362 mHandler.obtainMessage(
363 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
364 .sendToTarget();
365 }
366
367 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700368 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700369 SomeArgs args = SomeArgs.obtain();
370 args.arg1 = callId;
371 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
372 }
373
374 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700375 public void setIsConferenced(String callId, String conferenceCallId,
376 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700377 SomeArgs args = SomeArgs.obtain();
378 args.arg1 = callId;
379 args.arg2 = conferenceCallId;
380 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
381 }
382
383 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700384 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
385 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700386 SomeArgs args = SomeArgs.obtain();
387 args.arg1 = callId;
388 args.arg2 = parcelableConference;
389 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700390 }
391
392 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700393 public void removeCall(String connectionId,
394 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700395 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
396 }
397
398 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700399 public void onPostDialWait(String connectionId, String remainingDigits,
400 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700401 SomeArgs args = SomeArgs.obtain();
402 args.arg1 = connectionId;
403 args.arg2 = remainingDigits;
404 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
405 }
406
407 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700408 public void onPostDialChar(String connectionId, char nextChar,
409 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800410 SomeArgs args = SomeArgs.obtain();
411 args.arg1 = connectionId;
412 args.argi1 = nextChar;
413 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
414 }
415
416 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700417 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
418 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700419 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
420 }
421
422 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700423 public void setVideoState(String connectionId, int videoState,
424 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700425 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
426 }
427
428 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700429 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
430 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700431 SomeArgs args = SomeArgs.obtain();
432 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700433 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700434 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
435 }
436
437 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700438 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
439 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700440 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700441 connectionId).sendToTarget();
442 }
443
444 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700445 public final void setStatusHints(String connectionId, StatusHints statusHints,
446 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700447 SomeArgs args = SomeArgs.obtain();
448 args.arg1 = connectionId;
449 args.arg2 = statusHints;
450 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
451 }
452
453 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700454 public final void setAddress(String connectionId, Uri address, int presentation,
455 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700456 SomeArgs args = SomeArgs.obtain();
457 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700458 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700459 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700460 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700461 }
462
463 @Override
464 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700465 String connectionId, String callerDisplayName, int presentation,
466 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700467 SomeArgs args = SomeArgs.obtain();
468 args.arg1 = connectionId;
469 args.arg2 = callerDisplayName;
470 args.argi1 = presentation;
471 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
472 }
473
474 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700475 public final void setConferenceableConnections(String connectionId,
476 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700477 SomeArgs args = SomeArgs.obtain();
478 args.arg1 = connectionId;
479 args.arg2 = conferenceableConnectionIds;
480 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
481 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700482
483 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700484 public final void addExistingConnection(String connectionId,
485 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700486 SomeArgs args = SomeArgs.obtain();
487 args.arg1 = connectionId;
488 args.arg2 = connection;
489 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
490 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700491
492 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700493 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700494 SomeArgs args = SomeArgs.obtain();
495 args.arg1 = connectionId;
496 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700497 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
498 }
499
500 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700501 public final void removeExtras(String connectionId, List<String> keys,
502 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700503 SomeArgs args = SomeArgs.obtain();
504 args.arg1 = connectionId;
505 args.arg2 = keys;
506 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700507 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800508
509 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700510 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
511 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800512 SomeArgs args = SomeArgs.obtain();
513 args.arg1 = connectionId;
514 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700515 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800516 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
517 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700518 };
519
520 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
521 mDelegate = delegate;
522 }
523
524 public IConnectionServiceAdapter getStub() {
525 return mStub;
526 }
527}