blob: 60b2172fdeca3bf026947006c2a21434495ad1c2 [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:
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700189 SomeArgs args2 = (SomeArgs) msg.obj;
190 try {
191 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) args2.arg1,
192 (String) args2.arg2, null /*Session.Info*/);
193 } finally {
194 args2.recycle();
195 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700196 break;
197 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700198 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700199 break;
200 case MSG_SET_VIDEO_CALL_PROVIDER: {
201 SomeArgs args = (SomeArgs) msg.obj;
202 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700203 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700204 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700205 } finally {
206 args.recycle();
207 }
208 break;
209 }
Andrew Lee100e2932014-09-08 15:34:24 -0700210 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700211 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
212 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700213 break;
214 case MSG_SET_STATUS_HINTS: {
215 SomeArgs args = (SomeArgs) msg.obj;
216 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700217 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
218 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700219 } finally {
220 args.recycle();
221 }
222 break;
223 }
Andrew Lee100e2932014-09-08 15:34:24 -0700224 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700225 SomeArgs args = (SomeArgs) msg.obj;
226 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700227 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
228 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700229 } finally {
230 args.recycle();
231 }
232 break;
233 }
234 case MSG_SET_CALLER_DISPLAY_NAME: {
235 SomeArgs args = (SomeArgs) msg.obj;
236 try {
237 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700238 (String) args.arg1, (String) args.arg2, args.argi1,
239 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700240 } finally {
241 args.recycle();
242 }
243 break;
244 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700245 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
246 SomeArgs args = (SomeArgs) msg.obj;
247 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700248 mDelegate.setConferenceableConnections((String) args.arg1,
249 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700250 } finally {
251 args.recycle();
252 }
253 break;
254 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700255 case MSG_ADD_EXISTING_CONNECTION: {
256 SomeArgs args = (SomeArgs) msg.obj;
257 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700258 mDelegate.addExistingConnection((String) args.arg1,
259 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700260 } finally {
261 args.recycle();
262 }
263 break;
264 }
Anthony Lee17455a32015-04-24 15:25:29 -0700265 case MSG_SET_CONFERENCE_MERGE_FAILED: {
266 SomeArgs args = (SomeArgs) msg.obj;
267 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700268 mDelegate.setConferenceMergeFailed((String) args.arg1,
269 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700270 } finally {
271 args.recycle();
272 }
273 break;
274 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700275 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700276 SomeArgs args = (SomeArgs) msg.obj;
277 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700278 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
279 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700280 } finally {
281 args.recycle();
282 }
283 break;
284 }
285 case MSG_REMOVE_EXTRAS: {
286 SomeArgs args = (SomeArgs) msg.obj;
287 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700288 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
289 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700290 } finally {
291 args.recycle();
292 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800293 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700294 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800295 case MSG_ON_CONNECTION_EVENT: {
296 SomeArgs args = (SomeArgs) msg.obj;
297 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700298 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700299 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800300 } finally {
301 args.recycle();
302 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800303 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800304 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800305 case MSG_SET_AUDIO_ROUTE: {
306 SomeArgs args = (SomeArgs) msg.obj;
307 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800308 mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
309 (Session.Info) args.arg3);
Tyler Gunnf5035432017-01-09 09:43:12 -0800310 } finally {
311 args.recycle();
312 }
313 break;
314 }
Hall Liu57006aa2017-02-06 10:49:48 -0800315 case MSG_ON_RTT_INITIATION_SUCCESS:
316 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
317 break;
318 case MSG_ON_RTT_INITIATION_FAILURE:
319 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
320 null /*Session.Info*/);
321 break;
322 case MSG_ON_RTT_REMOTELY_TERMINATED:
323 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
324 null /*Session.Info*/);
325 break;
326 case MSG_ON_RTT_UPGRADE_REQUEST:
327 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
328 break;
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530329 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
330 SomeArgs args = (SomeArgs) msg.obj;
331 try {
332 mDelegate.onPhoneAccountChanged((String) args.arg1,
333 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
334 } finally {
335 args.recycle();
336 }
337 break;
338 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800339 case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
340 mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
341 break;
Tyler Gunn68a73a42018-10-03 15:38:57 -0700342 case MSG_SET_CONFERENCE_STATE:
343 SomeArgs args = (SomeArgs) msg.obj;
344 try {
345 mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
346 (Session.Info) args.arg3);
347 } finally {
348 args.recycle();
349 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700350 }
351 }
352 };
353
354 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
355 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700356 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700357 String id,
358 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700359 ParcelableConnection connection,
360 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700361 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700362 args.arg1 = id;
363 args.arg2 = request;
364 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700365 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700366 }
367
368 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700369 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700370 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
371 }
372
373 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700374 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700375 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
376 }
377
378 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700379 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700380 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
381 }
382
383 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700384 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700385 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
386 }
387
388 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700389 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
390 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700391 SomeArgs args = SomeArgs.obtain();
392 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700393 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700394 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
395 }
396
397 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700398 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700399 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
400 }
401
402 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700403 public void setRingbackRequested(String connectionId, boolean ringback,
404 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700405 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700406 .sendToTarget();
407 }
408
409 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700410 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
411 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800412 mHandler.obtainMessage(
413 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700414 .sendToTarget();
415 }
416
417 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700418 public void setConnectionProperties(String connectionId, int connectionProperties,
419 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700420 mHandler.obtainMessage(
421 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
422 .sendToTarget();
423 }
424
425 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700426 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700427 SomeArgs args = SomeArgs.obtain();
428 args.arg1 = callId;
429 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
430 }
431
432 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700433 public void setIsConferenced(String callId, String conferenceCallId,
434 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700435 SomeArgs args = SomeArgs.obtain();
436 args.arg1 = callId;
437 args.arg2 = conferenceCallId;
438 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
439 }
440
441 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700442 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
443 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700444 SomeArgs args = SomeArgs.obtain();
445 args.arg1 = callId;
446 args.arg2 = parcelableConference;
447 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700448 }
449
450 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700451 public void removeCall(String connectionId,
452 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700453 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
454 }
455
456 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700457 public void onPostDialWait(String connectionId, String remainingDigits,
458 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700459 SomeArgs args = SomeArgs.obtain();
460 args.arg1 = connectionId;
461 args.arg2 = remainingDigits;
462 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
463 }
464
465 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700466 public void onPostDialChar(String connectionId, char nextChar,
467 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800468 SomeArgs args = SomeArgs.obtain();
469 args.arg1 = connectionId;
470 args.argi1 = nextChar;
471 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
472 }
473
474 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700475 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700476 String callingPackage, Session.Info sessionInfo) {
477 SomeArgs args = SomeArgs.obtain();
478 args.arg1 = callback;
479 args.arg2 = callingPackage;
Tyler Gunn156a33b2019-05-30 16:52:28 -0700480 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700481 }
482
483 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700484 public void setVideoState(String connectionId, int videoState,
485 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700486 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
487 }
488
489 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700490 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
491 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700492 SomeArgs args = SomeArgs.obtain();
493 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700494 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700495 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
496 }
497
498 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700499 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
500 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700501 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700502 connectionId).sendToTarget();
503 }
504
505 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700506 public final void setStatusHints(String connectionId, StatusHints statusHints,
507 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700508 SomeArgs args = SomeArgs.obtain();
509 args.arg1 = connectionId;
510 args.arg2 = statusHints;
511 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
512 }
513
514 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700515 public final void setAddress(String connectionId, Uri address, int presentation,
516 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700517 SomeArgs args = SomeArgs.obtain();
518 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700519 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700520 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700521 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700522 }
523
524 @Override
525 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700526 String connectionId, String callerDisplayName, int presentation,
527 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700528 SomeArgs args = SomeArgs.obtain();
529 args.arg1 = connectionId;
530 args.arg2 = callerDisplayName;
531 args.argi1 = presentation;
532 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
533 }
534
535 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700536 public final void setConferenceableConnections(String connectionId,
537 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700538 SomeArgs args = SomeArgs.obtain();
539 args.arg1 = connectionId;
540 args.arg2 = conferenceableConnectionIds;
541 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
542 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700543
544 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700545 public final void addExistingConnection(String connectionId,
546 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700547 SomeArgs args = SomeArgs.obtain();
548 args.arg1 = connectionId;
549 args.arg2 = connection;
550 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
551 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700552
553 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700554 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700555 SomeArgs args = SomeArgs.obtain();
556 args.arg1 = connectionId;
557 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700558 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
559 }
560
561 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700562 public final void removeExtras(String connectionId, List<String> keys,
563 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700564 SomeArgs args = SomeArgs.obtain();
565 args.arg1 = connectionId;
566 args.arg2 = keys;
567 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700568 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800569
570 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800571 public final void setAudioRoute(String connectionId, int audioRoute,
Hall Liua98f58b52017-11-07 17:59:28 -0800572 String bluetoothAddress, Session.Info sessionInfo) {
Tyler Gunnf5035432017-01-09 09:43:12 -0800573 SomeArgs args = SomeArgs.obtain();
574 args.arg1 = connectionId;
575 args.argi1 = audioRoute;
Hall Liua98f58b52017-11-07 17:59:28 -0800576 args.arg2 = bluetoothAddress;
577 args.arg3 = sessionInfo;
Tyler Gunnf5035432017-01-09 09:43:12 -0800578 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
579 }
580
581 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700582 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
583 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800584 SomeArgs args = SomeArgs.obtain();
585 args.arg1 = connectionId;
586 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700587 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800588 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
589 }
Hall Liu57006aa2017-02-06 10:49:48 -0800590
591 @Override
592 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
593 throws RemoteException {
594 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
595 }
596
597 @Override
598 public void onRttInitiationFailure(String connectionId, int reason,
599 Session.Info sessionInfo)
600 throws RemoteException {
601 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
602 .sendToTarget();
603 }
604
605 @Override
606 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
607 throws RemoteException {
608 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
609 }
610
611 @Override
612 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
613 throws RemoteException {
614 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
615 }
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530616
617 @Override
618 public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
619 Session.Info sessionInfo) {
620 SomeArgs args = SomeArgs.obtain();
621 args.arg1 = callId;
622 args.arg2 = pHandle;
623 mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
624 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800625
626 @Override
627 public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
628 mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
629 }
Mengjun Leng25707742017-07-04 11:10:37 +0800630
631 @Override
632 public void resetConnectionTime(String callId, Session.Info sessionInfo) {
633 // Do nothing
634 }
Tyler Gunn68a73a42018-10-03 15:38:57 -0700635
636 @Override
637 public void setConferenceState(String callId, boolean isConference,
638 Session.Info sessionInfo) {
639 SomeArgs args = SomeArgs.obtain();
640 args.arg1 = callId;
641 args.arg2 = isConference;
642 args.arg3 = sessionInfo;
643 mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
644 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700645 };
646
647 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
648 mDelegate = delegate;
649 }
650
651 public IConnectionServiceAdapter getStub() {
652 return mStub;
653 }
654}