blob: 80e3c33a443df84348024cfff869f5bde110b8d8 [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;
Ihab Awad5d0410f2014-07-30 10:07:40 -070075
76 private final IConnectionServiceAdapter mDelegate;
77
78 private final Handler mHandler = new Handler() {
79 @Override
80 public void handleMessage(Message msg) {
81 try {
82 internalHandleMessage(msg);
83 } catch (RemoteException e) {
84 }
85 }
86
87 // Internal method defined to centralize handling of RemoteException
88 private void internalHandleMessage(Message msg) throws RemoteException {
89 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070090 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070091 SomeArgs args = (SomeArgs) msg.obj;
92 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070093 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070094 (String) args.arg1,
95 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -070096 (ParcelableConnection) args.arg3,
97 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -070098 } finally {
99 args.recycle();
100 }
101 break;
102 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700103 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700104 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700105 break;
106 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700107 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700108 break;
109 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700110 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700111 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700112 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700113 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700114 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700115 case MSG_SET_DISCONNECTED: {
116 SomeArgs args = (SomeArgs) msg.obj;
117 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700118 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
119 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700120 } finally {
121 args.recycle();
122 }
123 break;
124 }
125 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700126 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700127 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700128 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700129 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
130 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700131 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800132 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700133 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
134 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700135 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700136 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700137 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
138 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700139 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700140 case MSG_SET_IS_CONFERENCED: {
141 SomeArgs args = (SomeArgs) msg.obj;
142 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700143 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
144 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700145 } finally {
146 args.recycle();
147 }
148 break;
149 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700150 case MSG_ADD_CONFERENCE_CALL: {
151 SomeArgs args = (SomeArgs) msg.obj;
152 try {
153 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700154 (String) args.arg1, (ParcelableConference) args.arg2,
155 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700156 } finally {
157 args.recycle();
158 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700159 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700160 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700161 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700162 mDelegate.removeCall((String) msg.obj,
163 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700164 break;
165 case MSG_ON_POST_DIAL_WAIT: {
166 SomeArgs args = (SomeArgs) msg.obj;
167 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700168 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
169 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700170 } finally {
171 args.recycle();
172 }
173 break;
174 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800175 case MSG_ON_POST_DIAL_CHAR: {
176 SomeArgs args = (SomeArgs) msg.obj;
177 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700178 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
179 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800180 } finally {
181 args.recycle();
182 }
183 break;
184 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700185 case MSG_QUERY_REMOTE_CALL_SERVICES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700186 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
187 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700188 break;
189 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700190 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700191 break;
192 case MSG_SET_VIDEO_CALL_PROVIDER: {
193 SomeArgs args = (SomeArgs) msg.obj;
194 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700195 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700196 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700197 } finally {
198 args.recycle();
199 }
200 break;
201 }
Andrew Lee100e2932014-09-08 15:34:24 -0700202 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700203 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
204 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700205 break;
206 case MSG_SET_STATUS_HINTS: {
207 SomeArgs args = (SomeArgs) msg.obj;
208 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700209 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
210 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700211 } finally {
212 args.recycle();
213 }
214 break;
215 }
Andrew Lee100e2932014-09-08 15:34:24 -0700216 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700217 SomeArgs args = (SomeArgs) msg.obj;
218 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700219 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
220 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700221 } finally {
222 args.recycle();
223 }
224 break;
225 }
226 case MSG_SET_CALLER_DISPLAY_NAME: {
227 SomeArgs args = (SomeArgs) msg.obj;
228 try {
229 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700230 (String) args.arg1, (String) args.arg2, args.argi1,
231 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700232 } finally {
233 args.recycle();
234 }
235 break;
236 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700237 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
238 SomeArgs args = (SomeArgs) msg.obj;
239 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700240 mDelegate.setConferenceableConnections((String) args.arg1,
241 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700242 } finally {
243 args.recycle();
244 }
245 break;
246 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700247 case MSG_ADD_EXISTING_CONNECTION: {
248 SomeArgs args = (SomeArgs) msg.obj;
249 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700250 mDelegate.addExistingConnection((String) args.arg1,
251 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700252 } finally {
253 args.recycle();
254 }
255 break;
256 }
Anthony Lee17455a32015-04-24 15:25:29 -0700257 case MSG_SET_CONFERENCE_MERGE_FAILED: {
258 SomeArgs args = (SomeArgs) msg.obj;
259 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700260 mDelegate.setConferenceMergeFailed((String) args.arg1,
261 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700262 } finally {
263 args.recycle();
264 }
265 break;
266 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700267 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700268 SomeArgs args = (SomeArgs) msg.obj;
269 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700270 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
271 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700272 } finally {
273 args.recycle();
274 }
275 break;
276 }
277 case MSG_REMOVE_EXTRAS: {
278 SomeArgs args = (SomeArgs) msg.obj;
279 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700280 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
281 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700282 } finally {
283 args.recycle();
284 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800285 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700286 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800287 case MSG_ON_CONNECTION_EVENT: {
288 SomeArgs args = (SomeArgs) msg.obj;
289 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700290 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700291 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800292 } finally {
293 args.recycle();
294 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800295 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800296 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800297 case MSG_SET_AUDIO_ROUTE: {
298 SomeArgs args = (SomeArgs) msg.obj;
299 try {
300 mDelegate.setAudioRoute((String) args.arg1, args.argi1,
301 (Session.Info) args.arg2);
302 } finally {
303 args.recycle();
304 }
305 break;
306 }
Hall Liu57006aa2017-02-06 10:49:48 -0800307 case MSG_ON_RTT_INITIATION_SUCCESS:
308 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
309 break;
310 case MSG_ON_RTT_INITIATION_FAILURE:
311 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
312 null /*Session.Info*/);
313 break;
314 case MSG_ON_RTT_REMOTELY_TERMINATED:
315 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
316 null /*Session.Info*/);
317 break;
318 case MSG_ON_RTT_UPGRADE_REQUEST:
319 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
320 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700321 }
322 }
323 };
324
325 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
326 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700327 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700328 String id,
329 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700330 ParcelableConnection connection,
331 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700332 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700333 args.arg1 = id;
334 args.arg2 = request;
335 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700336 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700337 }
338
339 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700340 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700341 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
342 }
343
344 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700345 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700346 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
347 }
348
349 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700350 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700351 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
352 }
353
354 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700355 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700356 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
357 }
358
359 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700360 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
361 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700362 SomeArgs args = SomeArgs.obtain();
363 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700364 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700365 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
366 }
367
368 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700369 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700370 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
371 }
372
373 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700374 public void setRingbackRequested(String connectionId, boolean ringback,
375 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700376 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700377 .sendToTarget();
378 }
379
380 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700381 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
382 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800383 mHandler.obtainMessage(
384 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700385 .sendToTarget();
386 }
387
388 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700389 public void setConnectionProperties(String connectionId, int connectionProperties,
390 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700391 mHandler.obtainMessage(
392 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
393 .sendToTarget();
394 }
395
396 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700397 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700398 SomeArgs args = SomeArgs.obtain();
399 args.arg1 = callId;
400 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
401 }
402
403 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700404 public void setIsConferenced(String callId, String conferenceCallId,
405 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700406 SomeArgs args = SomeArgs.obtain();
407 args.arg1 = callId;
408 args.arg2 = conferenceCallId;
409 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
410 }
411
412 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700413 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
414 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700415 SomeArgs args = SomeArgs.obtain();
416 args.arg1 = callId;
417 args.arg2 = parcelableConference;
418 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700419 }
420
421 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700422 public void removeCall(String connectionId,
423 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700424 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
425 }
426
427 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700428 public void onPostDialWait(String connectionId, String remainingDigits,
429 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700430 SomeArgs args = SomeArgs.obtain();
431 args.arg1 = connectionId;
432 args.arg2 = remainingDigits;
433 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
434 }
435
436 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700437 public void onPostDialChar(String connectionId, char nextChar,
438 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800439 SomeArgs args = SomeArgs.obtain();
440 args.arg1 = connectionId;
441 args.argi1 = nextChar;
442 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
443 }
444
445 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700446 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
447 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700448 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
449 }
450
451 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700452 public void setVideoState(String connectionId, int videoState,
453 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700454 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
455 }
456
457 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700458 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
459 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700460 SomeArgs args = SomeArgs.obtain();
461 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700462 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700463 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
464 }
465
466 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700467 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
468 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700469 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700470 connectionId).sendToTarget();
471 }
472
473 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700474 public final void setStatusHints(String connectionId, StatusHints statusHints,
475 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700476 SomeArgs args = SomeArgs.obtain();
477 args.arg1 = connectionId;
478 args.arg2 = statusHints;
479 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
480 }
481
482 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700483 public final void setAddress(String connectionId, Uri address, int presentation,
484 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700485 SomeArgs args = SomeArgs.obtain();
486 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700487 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700488 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700489 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700490 }
491
492 @Override
493 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700494 String connectionId, String callerDisplayName, int presentation,
495 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700496 SomeArgs args = SomeArgs.obtain();
497 args.arg1 = connectionId;
498 args.arg2 = callerDisplayName;
499 args.argi1 = presentation;
500 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
501 }
502
503 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700504 public final void setConferenceableConnections(String connectionId,
505 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700506 SomeArgs args = SomeArgs.obtain();
507 args.arg1 = connectionId;
508 args.arg2 = conferenceableConnectionIds;
509 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
510 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700511
512 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700513 public final void addExistingConnection(String connectionId,
514 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700515 SomeArgs args = SomeArgs.obtain();
516 args.arg1 = connectionId;
517 args.arg2 = connection;
518 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
519 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700520
521 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700522 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700523 SomeArgs args = SomeArgs.obtain();
524 args.arg1 = connectionId;
525 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700526 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
527 }
528
529 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700530 public final void removeExtras(String connectionId, List<String> keys,
531 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700532 SomeArgs args = SomeArgs.obtain();
533 args.arg1 = connectionId;
534 args.arg2 = keys;
535 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700536 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800537
538 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800539 public final void setAudioRoute(String connectionId, int audioRoute,
540 Session.Info sessionInfo) {
541
542 SomeArgs args = SomeArgs.obtain();
543 args.arg1 = connectionId;
544 args.argi1 = audioRoute;
545 args.arg2 = sessionInfo;
546 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
547 }
548
549 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700550 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
551 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800552 SomeArgs args = SomeArgs.obtain();
553 args.arg1 = connectionId;
554 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700555 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800556 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
557 }
Hall Liu57006aa2017-02-06 10:49:48 -0800558
559 @Override
560 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
561 throws RemoteException {
562 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
563 }
564
565 @Override
566 public void onRttInitiationFailure(String connectionId, int reason,
567 Session.Info sessionInfo)
568 throws RemoteException {
569 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
570 .sendToTarget();
571 }
572
573 @Override
574 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
575 throws RemoteException {
576 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
577 }
578
579 @Override
580 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
581 throws RemoteException {
582 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
583 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700584 };
585
586 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
587 mDelegate = delegate;
588 }
589
590 public IConnectionServiceAdapter getStub() {
591 return mStub;
592 }
593}