blob: f99b218bd9b96ddd357bb7e221165e374f6166e0 [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;
Ihab Awad5d0410f2014-07-30 10:07:40 -070078
79 private final IConnectionServiceAdapter mDelegate;
80
81 private final Handler mHandler = new Handler() {
82 @Override
83 public void handleMessage(Message msg) {
84 try {
85 internalHandleMessage(msg);
86 } catch (RemoteException e) {
87 }
88 }
89
90 // Internal method defined to centralize handling of RemoteException
91 private void internalHandleMessage(Message msg) throws RemoteException {
92 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070093 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070094 SomeArgs args = (SomeArgs) msg.obj;
95 try {
Ihab Awad6107bab2014-08-18 09:23:25 -070096 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070097 (String) args.arg1,
98 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -070099 (ParcelableConnection) args.arg3,
100 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700101 } finally {
102 args.recycle();
103 }
104 break;
105 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700106 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700107 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700108 break;
109 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700110 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700111 break;
112 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700113 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700114 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700115 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700116 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700117 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700118 case MSG_SET_DISCONNECTED: {
119 SomeArgs args = (SomeArgs) msg.obj;
120 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700121 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
122 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700123 } finally {
124 args.recycle();
125 }
126 break;
127 }
128 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700129 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700130 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700131 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700132 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
133 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700134 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800135 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700136 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
137 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700138 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700139 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700140 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
141 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700142 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700143 case MSG_SET_IS_CONFERENCED: {
144 SomeArgs args = (SomeArgs) msg.obj;
145 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700146 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
147 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700148 } finally {
149 args.recycle();
150 }
151 break;
152 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700153 case MSG_ADD_CONFERENCE_CALL: {
154 SomeArgs args = (SomeArgs) msg.obj;
155 try {
156 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700157 (String) args.arg1, (ParcelableConference) args.arg2,
158 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700159 } finally {
160 args.recycle();
161 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700162 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700163 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700164 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700165 mDelegate.removeCall((String) msg.obj,
166 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700167 break;
168 case MSG_ON_POST_DIAL_WAIT: {
169 SomeArgs args = (SomeArgs) msg.obj;
170 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700171 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
172 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700173 } finally {
174 args.recycle();
175 }
176 break;
177 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800178 case MSG_ON_POST_DIAL_CHAR: {
179 SomeArgs args = (SomeArgs) msg.obj;
180 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700181 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
182 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800183 } finally {
184 args.recycle();
185 }
186 break;
187 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700188 case MSG_QUERY_REMOTE_CALL_SERVICES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700189 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
190 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700191 break;
192 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700193 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700194 break;
195 case MSG_SET_VIDEO_CALL_PROVIDER: {
196 SomeArgs args = (SomeArgs) msg.obj;
197 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700198 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700199 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700200 } finally {
201 args.recycle();
202 }
203 break;
204 }
Andrew Lee100e2932014-09-08 15:34:24 -0700205 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700206 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
207 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700208 break;
209 case MSG_SET_STATUS_HINTS: {
210 SomeArgs args = (SomeArgs) msg.obj;
211 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700212 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
213 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700214 } finally {
215 args.recycle();
216 }
217 break;
218 }
Andrew Lee100e2932014-09-08 15:34:24 -0700219 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700220 SomeArgs args = (SomeArgs) msg.obj;
221 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700222 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
223 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700224 } finally {
225 args.recycle();
226 }
227 break;
228 }
229 case MSG_SET_CALLER_DISPLAY_NAME: {
230 SomeArgs args = (SomeArgs) msg.obj;
231 try {
232 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700233 (String) args.arg1, (String) args.arg2, args.argi1,
234 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700235 } finally {
236 args.recycle();
237 }
238 break;
239 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700240 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
241 SomeArgs args = (SomeArgs) msg.obj;
242 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700243 mDelegate.setConferenceableConnections((String) args.arg1,
244 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700245 } finally {
246 args.recycle();
247 }
248 break;
249 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700250 case MSG_ADD_EXISTING_CONNECTION: {
251 SomeArgs args = (SomeArgs) msg.obj;
252 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700253 mDelegate.addExistingConnection((String) args.arg1,
254 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700255 } finally {
256 args.recycle();
257 }
258 break;
259 }
Anthony Lee17455a32015-04-24 15:25:29 -0700260 case MSG_SET_CONFERENCE_MERGE_FAILED: {
261 SomeArgs args = (SomeArgs) msg.obj;
262 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700263 mDelegate.setConferenceMergeFailed((String) args.arg1,
264 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700265 } finally {
266 args.recycle();
267 }
268 break;
269 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700270 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700271 SomeArgs args = (SomeArgs) msg.obj;
272 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700273 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
274 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700275 } finally {
276 args.recycle();
277 }
278 break;
279 }
280 case MSG_REMOVE_EXTRAS: {
281 SomeArgs args = (SomeArgs) msg.obj;
282 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700283 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
284 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700285 } finally {
286 args.recycle();
287 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800288 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700289 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800290 case MSG_ON_CONNECTION_EVENT: {
291 SomeArgs args = (SomeArgs) msg.obj;
292 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700293 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700294 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800295 } finally {
296 args.recycle();
297 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800298 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800299 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800300 case MSG_SET_AUDIO_ROUTE: {
301 SomeArgs args = (SomeArgs) msg.obj;
302 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800303 mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
304 (Session.Info) args.arg3);
Tyler Gunnf5035432017-01-09 09:43:12 -0800305 } finally {
306 args.recycle();
307 }
308 break;
309 }
Hall Liu57006aa2017-02-06 10:49:48 -0800310 case MSG_ON_RTT_INITIATION_SUCCESS:
311 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
312 break;
313 case MSG_ON_RTT_INITIATION_FAILURE:
314 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
315 null /*Session.Info*/);
316 break;
317 case MSG_ON_RTT_REMOTELY_TERMINATED:
318 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
319 null /*Session.Info*/);
320 break;
321 case MSG_ON_RTT_UPGRADE_REQUEST:
322 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
323 break;
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530324 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
325 SomeArgs args = (SomeArgs) msg.obj;
326 try {
327 mDelegate.onPhoneAccountChanged((String) args.arg1,
328 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
329 } finally {
330 args.recycle();
331 }
332 break;
333 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800334 case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
335 mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
336 break;
Tyler Gunn68a73a42018-10-03 15:38:57 -0700337 case MSG_SET_CONFERENCE_STATE:
338 SomeArgs args = (SomeArgs) msg.obj;
339 try {
340 mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
341 (Session.Info) args.arg3);
342 } finally {
343 args.recycle();
344 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700345 }
346 }
347 };
348
349 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
350 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700351 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700352 String id,
353 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700354 ParcelableConnection connection,
355 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700356 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700357 args.arg1 = id;
358 args.arg2 = request;
359 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700360 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700361 }
362
363 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700364 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700365 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
366 }
367
368 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700369 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700370 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
371 }
372
373 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700374 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700375 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
376 }
377
378 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700379 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700380 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
381 }
382
383 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700384 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
385 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700386 SomeArgs args = SomeArgs.obtain();
387 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700388 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700389 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
390 }
391
392 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700393 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700394 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
395 }
396
397 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700398 public void setRingbackRequested(String connectionId, boolean ringback,
399 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700400 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700401 .sendToTarget();
402 }
403
404 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700405 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
406 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800407 mHandler.obtainMessage(
408 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700409 .sendToTarget();
410 }
411
412 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700413 public void setConnectionProperties(String connectionId, int connectionProperties,
414 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700415 mHandler.obtainMessage(
416 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
417 .sendToTarget();
418 }
419
420 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700421 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700422 SomeArgs args = SomeArgs.obtain();
423 args.arg1 = callId;
424 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
425 }
426
427 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700428 public void setIsConferenced(String callId, String conferenceCallId,
429 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700430 SomeArgs args = SomeArgs.obtain();
431 args.arg1 = callId;
432 args.arg2 = conferenceCallId;
433 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
434 }
435
436 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700437 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
438 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700439 SomeArgs args = SomeArgs.obtain();
440 args.arg1 = callId;
441 args.arg2 = parcelableConference;
442 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700443 }
444
445 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700446 public void removeCall(String connectionId,
447 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700448 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
449 }
450
451 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700452 public void onPostDialWait(String connectionId, String remainingDigits,
453 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700454 SomeArgs args = SomeArgs.obtain();
455 args.arg1 = connectionId;
456 args.arg2 = remainingDigits;
457 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
458 }
459
460 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700461 public void onPostDialChar(String connectionId, char nextChar,
462 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800463 SomeArgs args = SomeArgs.obtain();
464 args.arg1 = connectionId;
465 args.argi1 = nextChar;
466 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
467 }
468
469 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700470 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
471 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700472 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
473 }
474
475 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700476 public void setVideoState(String connectionId, int videoState,
477 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700478 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
479 }
480
481 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700482 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
483 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700484 SomeArgs args = SomeArgs.obtain();
485 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700486 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700487 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
488 }
489
490 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700491 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
492 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700493 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700494 connectionId).sendToTarget();
495 }
496
497 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700498 public final void setStatusHints(String connectionId, StatusHints statusHints,
499 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700500 SomeArgs args = SomeArgs.obtain();
501 args.arg1 = connectionId;
502 args.arg2 = statusHints;
503 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
504 }
505
506 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700507 public final void setAddress(String connectionId, Uri address, int presentation,
508 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700509 SomeArgs args = SomeArgs.obtain();
510 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700511 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700512 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700513 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700514 }
515
516 @Override
517 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700518 String connectionId, String callerDisplayName, int presentation,
519 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700520 SomeArgs args = SomeArgs.obtain();
521 args.arg1 = connectionId;
522 args.arg2 = callerDisplayName;
523 args.argi1 = presentation;
524 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
525 }
526
527 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700528 public final void setConferenceableConnections(String connectionId,
529 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700530 SomeArgs args = SomeArgs.obtain();
531 args.arg1 = connectionId;
532 args.arg2 = conferenceableConnectionIds;
533 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
534 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700535
536 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700537 public final void addExistingConnection(String connectionId,
538 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700539 SomeArgs args = SomeArgs.obtain();
540 args.arg1 = connectionId;
541 args.arg2 = connection;
542 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
543 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700544
545 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700546 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700547 SomeArgs args = SomeArgs.obtain();
548 args.arg1 = connectionId;
549 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700550 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
551 }
552
553 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700554 public final void removeExtras(String connectionId, List<String> keys,
555 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700556 SomeArgs args = SomeArgs.obtain();
557 args.arg1 = connectionId;
558 args.arg2 = keys;
559 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700560 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800561
562 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800563 public final void setAudioRoute(String connectionId, int audioRoute,
Hall Liua98f58b52017-11-07 17:59:28 -0800564 String bluetoothAddress, Session.Info sessionInfo) {
Tyler Gunnf5035432017-01-09 09:43:12 -0800565 SomeArgs args = SomeArgs.obtain();
566 args.arg1 = connectionId;
567 args.argi1 = audioRoute;
Hall Liua98f58b52017-11-07 17:59:28 -0800568 args.arg2 = bluetoothAddress;
569 args.arg3 = sessionInfo;
Tyler Gunnf5035432017-01-09 09:43:12 -0800570 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
571 }
572
573 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700574 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
575 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800576 SomeArgs args = SomeArgs.obtain();
577 args.arg1 = connectionId;
578 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700579 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800580 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
581 }
Hall Liu57006aa2017-02-06 10:49:48 -0800582
583 @Override
584 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
585 throws RemoteException {
586 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
587 }
588
589 @Override
590 public void onRttInitiationFailure(String connectionId, int reason,
591 Session.Info sessionInfo)
592 throws RemoteException {
593 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
594 .sendToTarget();
595 }
596
597 @Override
598 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
599 throws RemoteException {
600 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
601 }
602
603 @Override
604 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
605 throws RemoteException {
606 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
607 }
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530608
609 @Override
610 public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
611 Session.Info sessionInfo) {
612 SomeArgs args = SomeArgs.obtain();
613 args.arg1 = callId;
614 args.arg2 = pHandle;
615 mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
616 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800617
618 @Override
619 public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
620 mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
621 }
Mengjun Leng25707742017-07-04 11:10:37 +0800622
623 @Override
624 public void resetConnectionTime(String callId, Session.Info sessionInfo) {
625 // Do nothing
626 }
Tyler Gunn68a73a42018-10-03 15:38:57 -0700627
628 @Override
629 public void setConferenceState(String callId, boolean isConference,
630 Session.Info sessionInfo) {
631 SomeArgs args = SomeArgs.obtain();
632 args.arg1 = callId;
633 args.arg2 = isConference;
634 args.arg3 = sessionInfo;
635 mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
636 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700637 };
638
639 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
640 mDelegate = delegate;
641 }
642
643 public IConnectionServiceAdapter getStub() {
644 return mStub;
645 }
646}