blob: 6c1ea322e66e7f9ed5bf47ed803a889c610674f6 [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;
Pengquan Meng63d25a52017-11-21 18:01:13 -080076 private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35;
Tyler Gunn68a73a42018-10-03 15:38:57 -070077 private static final int MSG_SET_CONFERENCE_STATE = 36;
Ravi Paluri80aa2142019-12-02 11:57:37 +053078 private static final int MSG_HANDLE_CREATE_CONFERENCE_COMPLETE = 37;
Brad Ebinger31774ae2020-04-08 16:25:12 -070079 private static final int MSG_SET_CALL_DIRECTION = 38;
Ihab Awad5d0410f2014-07-30 10:07:40 -070080
81 private final IConnectionServiceAdapter mDelegate;
82
83 private final Handler mHandler = new Handler() {
84 @Override
85 public void handleMessage(Message msg) {
86 try {
87 internalHandleMessage(msg);
88 } catch (RemoteException e) {
89 }
90 }
91
92 // Internal method defined to centralize handling of RemoteException
93 private void internalHandleMessage(Message msg) throws RemoteException {
94 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070095 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070096 SomeArgs args = (SomeArgs) msg.obj;
97 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070098 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070099 (String) args.arg1,
100 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700101 (ParcelableConnection) args.arg3,
102 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700103 } finally {
104 args.recycle();
105 }
106 break;
107 }
Ravi Paluri80aa2142019-12-02 11:57:37 +0530108 case MSG_HANDLE_CREATE_CONFERENCE_COMPLETE: {
109 SomeArgs args = (SomeArgs) msg.obj;
110 try {
111 mDelegate.handleCreateConferenceComplete(
112 (String) args.arg1,
113 (ConnectionRequest) args.arg2,
114 (ParcelableConference) args.arg3,
115 null /*Session.Info*/);
116 } finally {
117 args.recycle();
118 }
119 break;
120 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700121 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700122 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700123 break;
124 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700125 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700126 break;
127 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700128 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700129 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700130 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700131 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700132 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700133 case MSG_SET_DISCONNECTED: {
134 SomeArgs args = (SomeArgs) msg.obj;
135 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700136 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
137 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700138 } finally {
139 args.recycle();
140 }
141 break;
142 }
143 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700144 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700145 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700146 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700147 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
148 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700149 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800150 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700151 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
152 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700153 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700154 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700155 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
156 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700157 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700158 case MSG_SET_IS_CONFERENCED: {
159 SomeArgs args = (SomeArgs) msg.obj;
160 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700161 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
162 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700163 } finally {
164 args.recycle();
165 }
166 break;
167 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700168 case MSG_ADD_CONFERENCE_CALL: {
169 SomeArgs args = (SomeArgs) msg.obj;
170 try {
171 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700172 (String) args.arg1, (ParcelableConference) args.arg2,
173 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700174 } finally {
175 args.recycle();
176 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700177 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700178 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700179 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700180 mDelegate.removeCall((String) msg.obj,
181 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700182 break;
183 case MSG_ON_POST_DIAL_WAIT: {
184 SomeArgs args = (SomeArgs) msg.obj;
185 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700186 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
187 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700188 } finally {
189 args.recycle();
190 }
191 break;
192 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800193 case MSG_ON_POST_DIAL_CHAR: {
194 SomeArgs args = (SomeArgs) msg.obj;
195 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700196 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
197 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800198 } finally {
199 args.recycle();
200 }
201 break;
202 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700203 case MSG_QUERY_REMOTE_CALL_SERVICES:
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700204 SomeArgs args2 = (SomeArgs) msg.obj;
205 try {
206 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) args2.arg1,
207 (String) args2.arg2, null /*Session.Info*/);
208 } finally {
209 args2.recycle();
210 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700211 break;
212 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700213 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700214 break;
215 case MSG_SET_VIDEO_CALL_PROVIDER: {
216 SomeArgs args = (SomeArgs) msg.obj;
217 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700218 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700219 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700220 } finally {
221 args.recycle();
222 }
223 break;
224 }
Andrew Lee100e2932014-09-08 15:34:24 -0700225 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700226 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
227 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700228 break;
229 case MSG_SET_STATUS_HINTS: {
230 SomeArgs args = (SomeArgs) msg.obj;
231 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700232 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
233 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700234 } finally {
235 args.recycle();
236 }
237 break;
238 }
Andrew Lee100e2932014-09-08 15:34:24 -0700239 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700240 SomeArgs args = (SomeArgs) msg.obj;
241 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700242 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
243 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700244 } finally {
245 args.recycle();
246 }
247 break;
248 }
249 case MSG_SET_CALLER_DISPLAY_NAME: {
250 SomeArgs args = (SomeArgs) msg.obj;
251 try {
252 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700253 (String) args.arg1, (String) args.arg2, args.argi1,
254 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700255 } finally {
256 args.recycle();
257 }
258 break;
259 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700260 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
261 SomeArgs args = (SomeArgs) msg.obj;
262 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700263 mDelegate.setConferenceableConnections((String) args.arg1,
264 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700265 } finally {
266 args.recycle();
267 }
268 break;
269 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700270 case MSG_ADD_EXISTING_CONNECTION: {
271 SomeArgs args = (SomeArgs) msg.obj;
272 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700273 mDelegate.addExistingConnection((String) args.arg1,
274 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700275 } finally {
276 args.recycle();
277 }
278 break;
279 }
Anthony Lee17455a32015-04-24 15:25:29 -0700280 case MSG_SET_CONFERENCE_MERGE_FAILED: {
281 SomeArgs args = (SomeArgs) msg.obj;
282 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700283 mDelegate.setConferenceMergeFailed((String) args.arg1,
284 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700285 } finally {
286 args.recycle();
287 }
288 break;
289 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700290 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700291 SomeArgs args = (SomeArgs) msg.obj;
292 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700293 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
294 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700295 } finally {
296 args.recycle();
297 }
298 break;
299 }
300 case MSG_REMOVE_EXTRAS: {
301 SomeArgs args = (SomeArgs) msg.obj;
302 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700303 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
304 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700305 } finally {
306 args.recycle();
307 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800308 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700309 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800310 case MSG_ON_CONNECTION_EVENT: {
311 SomeArgs args = (SomeArgs) msg.obj;
312 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700313 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700314 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800315 } finally {
316 args.recycle();
317 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800318 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800319 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800320 case MSG_SET_AUDIO_ROUTE: {
321 SomeArgs args = (SomeArgs) msg.obj;
322 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800323 mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
324 (Session.Info) args.arg3);
Tyler Gunnf5035432017-01-09 09:43:12 -0800325 } finally {
326 args.recycle();
327 }
328 break;
329 }
Hall Liu57006aa2017-02-06 10:49:48 -0800330 case MSG_ON_RTT_INITIATION_SUCCESS:
331 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
332 break;
333 case MSG_ON_RTT_INITIATION_FAILURE:
334 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
335 null /*Session.Info*/);
336 break;
337 case MSG_ON_RTT_REMOTELY_TERMINATED:
338 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
339 null /*Session.Info*/);
340 break;
341 case MSG_ON_RTT_UPGRADE_REQUEST:
342 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
343 break;
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530344 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
345 SomeArgs args = (SomeArgs) msg.obj;
346 try {
347 mDelegate.onPhoneAccountChanged((String) args.arg1,
348 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
349 } finally {
350 args.recycle();
351 }
352 break;
353 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800354 case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
355 mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
356 break;
Brad Ebinger31774ae2020-04-08 16:25:12 -0700357 case MSG_SET_CONFERENCE_STATE: {
Tyler Gunn68a73a42018-10-03 15:38:57 -0700358 SomeArgs args = (SomeArgs) msg.obj;
359 try {
360 mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
361 (Session.Info) args.arg3);
362 } finally {
363 args.recycle();
364 }
Brad Ebinger31774ae2020-04-08 16:25:12 -0700365 break;
366 }
367 case MSG_SET_CALL_DIRECTION: {
368 SomeArgs args = (SomeArgs) msg.obj;
369 try {
370 mDelegate.setCallDirection((String) args.arg1, args.argi1,
371 (Session.Info) args.arg2);
372 } finally {
373 args.recycle();
374 }
375 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700376 }
377 }
378 };
379
380 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
381 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700382 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700383 String id,
384 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700385 ParcelableConnection connection,
386 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700387 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700388 args.arg1 = id;
389 args.arg2 = request;
390 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700391 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700392 }
393
394 @Override
Ravi Paluri80aa2142019-12-02 11:57:37 +0530395 public void handleCreateConferenceComplete(
396 String id,
397 ConnectionRequest request,
398 ParcelableConference conference,
399 Session.Info sessionInfo) {
400 SomeArgs args = SomeArgs.obtain();
401 args.arg1 = id;
402 args.arg2 = request;
403 args.arg3 = conference;
404 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONFERENCE_COMPLETE, args).sendToTarget();
405 }
406
407
408 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700409 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700410 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
411 }
412
413 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700414 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700415 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
416 }
417
418 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700419 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700420 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
421 }
422
423 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700424 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700425 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
426 }
427
428 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700429 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
430 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700431 SomeArgs args = SomeArgs.obtain();
432 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700433 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700434 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
435 }
436
437 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700438 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700439 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
440 }
441
442 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700443 public void setRingbackRequested(String connectionId, boolean ringback,
444 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700445 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700446 .sendToTarget();
447 }
448
449 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700450 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
451 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800452 mHandler.obtainMessage(
453 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700454 .sendToTarget();
455 }
456
457 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700458 public void setConnectionProperties(String connectionId, int connectionProperties,
459 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700460 mHandler.obtainMessage(
461 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
462 .sendToTarget();
463 }
464
465 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700466 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700467 SomeArgs args = SomeArgs.obtain();
468 args.arg1 = callId;
469 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
470 }
471
472 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700473 public void setIsConferenced(String callId, String conferenceCallId,
474 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700475 SomeArgs args = SomeArgs.obtain();
476 args.arg1 = callId;
477 args.arg2 = conferenceCallId;
478 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
479 }
480
481 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700482 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
483 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700484 SomeArgs args = SomeArgs.obtain();
485 args.arg1 = callId;
486 args.arg2 = parcelableConference;
487 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700488 }
489
490 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700491 public void removeCall(String connectionId,
492 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700493 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
494 }
495
496 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700497 public void onPostDialWait(String connectionId, String remainingDigits,
498 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700499 SomeArgs args = SomeArgs.obtain();
500 args.arg1 = connectionId;
501 args.arg2 = remainingDigits;
502 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
503 }
504
505 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700506 public void onPostDialChar(String connectionId, char nextChar,
507 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800508 SomeArgs args = SomeArgs.obtain();
509 args.arg1 = connectionId;
510 args.argi1 = nextChar;
511 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
512 }
513
514 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700515 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700516 String callingPackage, Session.Info sessionInfo) {
517 SomeArgs args = SomeArgs.obtain();
518 args.arg1 = callback;
519 args.arg2 = callingPackage;
Tyler Gunn156a33b2019-05-30 16:52:28 -0700520 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700521 }
522
523 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700524 public void setVideoState(String connectionId, int videoState,
525 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700526 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
527 }
528
529 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700530 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
531 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700532 SomeArgs args = SomeArgs.obtain();
533 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700534 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700535 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
536 }
537
538 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700539 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
540 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700541 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700542 connectionId).sendToTarget();
543 }
544
545 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700546 public final void setStatusHints(String connectionId, StatusHints statusHints,
547 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700548 SomeArgs args = SomeArgs.obtain();
549 args.arg1 = connectionId;
550 args.arg2 = statusHints;
551 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
552 }
553
554 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700555 public final void setAddress(String connectionId, Uri address, int presentation,
556 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700557 SomeArgs args = SomeArgs.obtain();
558 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700559 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700560 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700561 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700562 }
563
564 @Override
565 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700566 String connectionId, String callerDisplayName, int presentation,
567 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700568 SomeArgs args = SomeArgs.obtain();
569 args.arg1 = connectionId;
570 args.arg2 = callerDisplayName;
571 args.argi1 = presentation;
572 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
573 }
574
575 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700576 public final void setConferenceableConnections(String connectionId,
577 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700578 SomeArgs args = SomeArgs.obtain();
579 args.arg1 = connectionId;
580 args.arg2 = conferenceableConnectionIds;
581 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
582 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700583
584 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700585 public final void addExistingConnection(String connectionId,
586 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700587 SomeArgs args = SomeArgs.obtain();
588 args.arg1 = connectionId;
589 args.arg2 = connection;
590 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
591 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700592
593 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700594 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700595 SomeArgs args = SomeArgs.obtain();
596 args.arg1 = connectionId;
597 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700598 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
599 }
600
601 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700602 public final void removeExtras(String connectionId, List<String> keys,
603 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700604 SomeArgs args = SomeArgs.obtain();
605 args.arg1 = connectionId;
606 args.arg2 = keys;
607 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700608 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800609
610 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800611 public final void setAudioRoute(String connectionId, int audioRoute,
Hall Liua98f58b52017-11-07 17:59:28 -0800612 String bluetoothAddress, Session.Info sessionInfo) {
Tyler Gunnf5035432017-01-09 09:43:12 -0800613 SomeArgs args = SomeArgs.obtain();
614 args.arg1 = connectionId;
615 args.argi1 = audioRoute;
Hall Liua98f58b52017-11-07 17:59:28 -0800616 args.arg2 = bluetoothAddress;
617 args.arg3 = sessionInfo;
Tyler Gunnf5035432017-01-09 09:43:12 -0800618 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
619 }
620
621 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700622 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
623 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800624 SomeArgs args = SomeArgs.obtain();
625 args.arg1 = connectionId;
626 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700627 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800628 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
629 }
Hall Liu57006aa2017-02-06 10:49:48 -0800630
631 @Override
632 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
633 throws RemoteException {
634 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
635 }
636
637 @Override
638 public void onRttInitiationFailure(String connectionId, int reason,
639 Session.Info sessionInfo)
640 throws RemoteException {
641 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
642 .sendToTarget();
643 }
644
645 @Override
646 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
647 throws RemoteException {
648 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
649 }
650
651 @Override
652 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
653 throws RemoteException {
654 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
655 }
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530656
657 @Override
658 public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
659 Session.Info sessionInfo) {
660 SomeArgs args = SomeArgs.obtain();
661 args.arg1 = callId;
662 args.arg2 = pHandle;
663 mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
664 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800665
666 @Override
667 public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
668 mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
669 }
Mengjun Leng25707742017-07-04 11:10:37 +0800670
671 @Override
672 public void resetConnectionTime(String callId, Session.Info sessionInfo) {
673 // Do nothing
674 }
Tyler Gunn68a73a42018-10-03 15:38:57 -0700675
676 @Override
677 public void setConferenceState(String callId, boolean isConference,
678 Session.Info sessionInfo) {
679 SomeArgs args = SomeArgs.obtain();
680 args.arg1 = callId;
681 args.arg2 = isConference;
682 args.arg3 = sessionInfo;
683 mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
684 }
Brad Ebinger31774ae2020-04-08 16:25:12 -0700685
686 @Override
687 public void setCallDirection(String callId, int direction,
688 Session.Info sessionInfo) {
689 SomeArgs args = SomeArgs.obtain();
690 args.arg1 = callId;
691 args.argi1 = direction;
692 args.arg2 = sessionInfo;
693 mHandler.obtainMessage(MSG_SET_CALL_DIRECTION, args).sendToTarget();
694 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700695 };
696
697 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
698 mDelegate = delegate;
699 }
700
701 public IConnectionServiceAdapter getStub() {
702 return mStub;
703 }
704}