blob: 8a59020fc580abd9a8c8e29b0ac34059331e342b [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;
Junhoedf3d822022-11-24 09:26:37 +000024import android.os.ResultReceiver;
Brad Ebinger4d75bee2016-10-28 12:29:55 -070025import android.telecom.Logging.Session;
Ihab Awad5d0410f2014-07-30 10:07:40 -070026
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070027import com.android.internal.os.SomeArgs;
Tyler Gunnef9f6f92014-09-12 22:16:17 -070028import com.android.internal.telecom.IConnectionServiceAdapter;
29import com.android.internal.telecom.IVideoProvider;
30import com.android.internal.telecom.RemoteServiceCallback;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070031
32import java.util.List;
33
Ihab Awad5d0410f2014-07-30 10:07:40 -070034/**
35 * A component that provides an RPC servant implementation of {@link IConnectionServiceAdapter},
36 * posting incoming messages on the main thread on a client-supplied delegate object.
37 *
38 * TODO: Generate this and similar classes using a compiler starting from AIDL interfaces.
39 *
40 * @hide
41 */
42final class ConnectionServiceAdapterServant {
Ihab Awad6107bab2014-08-18 09:23:25 -070043 private static final int MSG_HANDLE_CREATE_CONNECTION_COMPLETE = 1;
44 private static final int MSG_SET_ACTIVE = 2;
45 private static final int MSG_SET_RINGING = 3;
46 private static final int MSG_SET_DIALING = 4;
47 private static final int MSG_SET_DISCONNECTED = 5;
48 private static final int MSG_SET_ON_HOLD = 6;
Andrew Lee100e2932014-09-08 15:34:24 -070049 private static final int MSG_SET_RINGBACK_REQUESTED = 7;
Ihab Awad5c9c86e2014-11-12 13:41:16 -080050 private static final int MSG_SET_CONNECTION_CAPABILITIES = 8;
Ihab Awad6107bab2014-08-18 09:23:25 -070051 private static final int MSG_SET_IS_CONFERENCED = 9;
52 private static final int MSG_ADD_CONFERENCE_CALL = 10;
53 private static final int MSG_REMOVE_CALL = 11;
54 private static final int MSG_ON_POST_DIAL_WAIT = 12;
55 private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 13;
56 private static final int MSG_SET_VIDEO_STATE = 14;
57 private static final int MSG_SET_VIDEO_CALL_PROVIDER = 15;
Andrew Lee100e2932014-09-08 15:34:24 -070058 private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16;
Ihab Awad6107bab2014-08-18 09:23:25 -070059 private static final int MSG_SET_STATUS_HINTS = 17;
Andrew Lee100e2932014-09-08 15:34:24 -070060 private static final int MSG_SET_ADDRESS = 18;
Ihab Awad6107bab2014-08-18 09:23:25 -070061 private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
Evan Charlton23dc2412014-09-03 10:07:03 -070062 private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
Tyler Gunn4a57b9b2014-10-30 14:27:48 -070063 private static final int MSG_ADD_EXISTING_CONNECTION = 21;
Nancy Chen27d1c2d2014-12-15 16:12:50 -080064 private static final int MSG_ON_POST_DIAL_CHAR = 22;
Anthony Lee17455a32015-04-24 15:25:29 -070065 private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
Tyler Gunndee56a82016-03-23 16:06:34 -070066 private static final int MSG_PUT_EXTRAS = 24;
67 private static final int MSG_REMOVE_EXTRAS = 25;
68 private static final int MSG_ON_CONNECTION_EVENT = 26;
Tyler Gunn720c6642016-03-22 09:02:47 -070069 private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
Tyler Gunnc96b5e02016-07-07 22:53:57 -070070 private static final int MSG_SET_PULLING = 28;
Tyler Gunnf5035432017-01-09 09:43:12 -080071 private static final int MSG_SET_AUDIO_ROUTE = 29;
Hall Liu57006aa2017-02-06 10:49:48 -080072 private static final int MSG_ON_RTT_INITIATION_SUCCESS = 30;
73 private static final int MSG_ON_RTT_INITIATION_FAILURE = 31;
74 private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32;
75 private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33;
Srikanth Chintalafcb15012017-05-04 20:58:34 +053076 private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34;
Pengquan Meng63d25a52017-11-21 18:01:13 -080077 private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35;
Tyler Gunn68a73a42018-10-03 15:38:57 -070078 private static final int MSG_SET_CONFERENCE_STATE = 36;
Ravi Paluri80aa2142019-12-02 11:57:37 +053079 private static final int MSG_HANDLE_CREATE_CONFERENCE_COMPLETE = 37;
Brad Ebinger31774ae2020-04-08 16:25:12 -070080 private static final int MSG_SET_CALL_DIRECTION = 38;
yongnamcha8ec56242022-11-28 06:23:02 +000081 private static final int MSG_QUERY_LOCATION = 39;
Ihab Awad5d0410f2014-07-30 10:07:40 -070082
83 private final IConnectionServiceAdapter mDelegate;
84
85 private final Handler mHandler = new Handler() {
86 @Override
87 public void handleMessage(Message msg) {
88 try {
89 internalHandleMessage(msg);
90 } catch (RemoteException e) {
91 }
92 }
93
94 // Internal method defined to centralize handling of RemoteException
95 private void internalHandleMessage(Message msg) throws RemoteException {
96 switch (msg.what) {
Ihab Awad6107bab2014-08-18 09:23:25 -070097 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
Ihab Awad5d0410f2014-07-30 10:07:40 -070098 SomeArgs args = (SomeArgs) msg.obj;
99 try {
Ihab Awad6107bab2014-08-18 09:23:25 -0700100 mDelegate.handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700101 (String) args.arg1,
102 (ConnectionRequest) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700103 (ParcelableConnection) args.arg3,
104 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700105 } finally {
106 args.recycle();
107 }
108 break;
109 }
Ravi Paluri80aa2142019-12-02 11:57:37 +0530110 case MSG_HANDLE_CREATE_CONFERENCE_COMPLETE: {
111 SomeArgs args = (SomeArgs) msg.obj;
112 try {
113 mDelegate.handleCreateConferenceComplete(
114 (String) args.arg1,
115 (ConnectionRequest) args.arg2,
116 (ParcelableConference) args.arg3,
117 null /*Session.Info*/);
118 } finally {
119 args.recycle();
120 }
121 break;
122 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700123 case MSG_SET_ACTIVE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700124 mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700125 break;
126 case MSG_SET_RINGING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700127 mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700128 break;
129 case MSG_SET_DIALING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700130 mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700131 break;
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700132 case MSG_SET_PULLING:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700133 mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700134 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700135 case MSG_SET_DISCONNECTED: {
136 SomeArgs args = (SomeArgs) msg.obj;
137 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700138 mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
139 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700140 } finally {
141 args.recycle();
142 }
143 break;
144 }
145 case MSG_SET_ON_HOLD:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700146 mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700147 break;
Andrew Lee100e2932014-09-08 15:34:24 -0700148 case MSG_SET_RINGBACK_REQUESTED:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700149 mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
150 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700151 break;
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800152 case MSG_SET_CONNECTION_CAPABILITIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700153 mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
154 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700155 break;
Tyler Gunn720c6642016-03-22 09:02:47 -0700156 case MSG_SET_CONNECTION_PROPERTIES:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700157 mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
158 null /*Session.Info*/);
Tyler Gunn720c6642016-03-22 09:02:47 -0700159 break;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700160 case MSG_SET_IS_CONFERENCED: {
161 SomeArgs args = (SomeArgs) msg.obj;
162 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700163 mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
164 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700165 } finally {
166 args.recycle();
167 }
168 break;
169 }
Santos Cordon823fd3c2014-08-07 18:35:18 -0700170 case MSG_ADD_CONFERENCE_CALL: {
171 SomeArgs args = (SomeArgs) msg.obj;
172 try {
173 mDelegate.addConferenceCall(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700174 (String) args.arg1, (ParcelableConference) args.arg2,
175 null /*Session.Info*/);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700176 } finally {
177 args.recycle();
178 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700179 break;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700180 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700181 case MSG_REMOVE_CALL:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700182 mDelegate.removeCall((String) msg.obj,
183 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700184 break;
185 case MSG_ON_POST_DIAL_WAIT: {
186 SomeArgs args = (SomeArgs) msg.obj;
187 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700188 mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
189 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700190 } finally {
191 args.recycle();
192 }
193 break;
194 }
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800195 case MSG_ON_POST_DIAL_CHAR: {
196 SomeArgs args = (SomeArgs) msg.obj;
197 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700198 mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
199 null /*Session.Info*/);
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800200 } finally {
201 args.recycle();
202 }
203 break;
204 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700205 case MSG_QUERY_REMOTE_CALL_SERVICES:
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700206 SomeArgs args2 = (SomeArgs) msg.obj;
207 try {
208 mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) args2.arg1,
209 (String) args2.arg2, null /*Session.Info*/);
210 } finally {
211 args2.recycle();
212 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700213 break;
214 case MSG_SET_VIDEO_STATE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700215 mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700216 break;
217 case MSG_SET_VIDEO_CALL_PROVIDER: {
218 SomeArgs args = (SomeArgs) msg.obj;
219 try {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700220 mDelegate.setVideoProvider((String) args.arg1,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700221 (IVideoProvider) args.arg2, null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700222 } finally {
223 args.recycle();
224 }
225 break;
226 }
Andrew Lee100e2932014-09-08 15:34:24 -0700227 case MSG_SET_IS_VOIP_AUDIO_MODE:
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700228 mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
229 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700230 break;
231 case MSG_SET_STATUS_HINTS: {
232 SomeArgs args = (SomeArgs) msg.obj;
233 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700234 mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
235 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700236 } finally {
237 args.recycle();
238 }
239 break;
240 }
Andrew Lee100e2932014-09-08 15:34:24 -0700241 case MSG_SET_ADDRESS: {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700242 SomeArgs args = (SomeArgs) msg.obj;
243 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700244 mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
245 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700246 } finally {
247 args.recycle();
248 }
249 break;
250 }
251 case MSG_SET_CALLER_DISPLAY_NAME: {
252 SomeArgs args = (SomeArgs) msg.obj;
253 try {
254 mDelegate.setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700255 (String) args.arg1, (String) args.arg2, args.argi1,
256 null /*Session.Info*/);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700257 } finally {
258 args.recycle();
259 }
260 break;
261 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700262 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
263 SomeArgs args = (SomeArgs) msg.obj;
264 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700265 mDelegate.setConferenceableConnections((String) args.arg1,
266 (List<String>) args.arg2, null /*Session.Info*/);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700267 } finally {
268 args.recycle();
269 }
270 break;
271 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700272 case MSG_ADD_EXISTING_CONNECTION: {
273 SomeArgs args = (SomeArgs) msg.obj;
274 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700275 mDelegate.addExistingConnection((String) args.arg1,
276 (ParcelableConnection) args.arg2, null /*Session.Info*/);
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700277 } finally {
278 args.recycle();
279 }
280 break;
281 }
Anthony Lee17455a32015-04-24 15:25:29 -0700282 case MSG_SET_CONFERENCE_MERGE_FAILED: {
283 SomeArgs args = (SomeArgs) msg.obj;
284 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700285 mDelegate.setConferenceMergeFailed((String) args.arg1,
286 null /*Session.Info*/);
Anthony Lee17455a32015-04-24 15:25:29 -0700287 } finally {
288 args.recycle();
289 }
290 break;
291 }
Tyler Gunndee56a82016-03-23 16:06:34 -0700292 case MSG_PUT_EXTRAS: {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700293 SomeArgs args = (SomeArgs) msg.obj;
294 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700295 mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
296 null /*Session.Info*/);
Tyler Gunndee56a82016-03-23 16:06:34 -0700297 } finally {
298 args.recycle();
299 }
300 break;
301 }
302 case MSG_REMOVE_EXTRAS: {
303 SomeArgs args = (SomeArgs) msg.obj;
304 try {
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700305 mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
306 null /*Session.Info*/);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700307 } finally {
308 args.recycle();
309 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800310 break;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700311 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800312 case MSG_ON_CONNECTION_EVENT: {
313 SomeArgs args = (SomeArgs) msg.obj;
314 try {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700315 mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700316 (Bundle) args.arg3, null /*Session.Info*/);
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800317 } finally {
318 args.recycle();
319 }
Tyler Gunn86c9fb42016-02-24 13:17:21 -0800320 break;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800321 }
Tyler Gunnf5035432017-01-09 09:43:12 -0800322 case MSG_SET_AUDIO_ROUTE: {
323 SomeArgs args = (SomeArgs) msg.obj;
324 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800325 mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
326 (Session.Info) args.arg3);
Tyler Gunnf5035432017-01-09 09:43:12 -0800327 } finally {
328 args.recycle();
329 }
330 break;
331 }
Hall Liu57006aa2017-02-06 10:49:48 -0800332 case MSG_ON_RTT_INITIATION_SUCCESS:
333 mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
334 break;
335 case MSG_ON_RTT_INITIATION_FAILURE:
336 mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
337 null /*Session.Info*/);
338 break;
339 case MSG_ON_RTT_REMOTELY_TERMINATED:
340 mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
341 null /*Session.Info*/);
342 break;
343 case MSG_ON_RTT_UPGRADE_REQUEST:
344 mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
345 break;
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530346 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
347 SomeArgs args = (SomeArgs) msg.obj;
348 try {
349 mDelegate.onPhoneAccountChanged((String) args.arg1,
350 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
351 } finally {
352 args.recycle();
353 }
354 break;
355 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800356 case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
357 mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
358 break;
Brad Ebinger31774ae2020-04-08 16:25:12 -0700359 case MSG_SET_CONFERENCE_STATE: {
Tyler Gunn68a73a42018-10-03 15:38:57 -0700360 SomeArgs args = (SomeArgs) msg.obj;
361 try {
362 mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2,
363 (Session.Info) args.arg3);
364 } finally {
365 args.recycle();
366 }
Brad Ebinger31774ae2020-04-08 16:25:12 -0700367 break;
368 }
369 case MSG_SET_CALL_DIRECTION: {
370 SomeArgs args = (SomeArgs) msg.obj;
371 try {
372 mDelegate.setCallDirection((String) args.arg1, args.argi1,
373 (Session.Info) args.arg2);
374 } finally {
375 args.recycle();
376 }
yongnamcha8ec56242022-11-28 06:23:02 +0000377 break;
378 }
379 case MSG_QUERY_LOCATION: {
380 SomeArgs args = (SomeArgs) msg.obj;
381 try {
382 mDelegate.queryLocation((String) args.arg1, (long) args.arg2,
383 (String) args.arg3, (ResultReceiver) args.arg4,
384 (Session.Info) args.arg5);
385 } finally {
386 args.recycle();
387 }
388 break;
Brad Ebinger31774ae2020-04-08 16:25:12 -0700389 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700390 }
391 }
392 };
393
394 private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
395 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -0700396 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700397 String id,
398 ConnectionRequest request,
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700399 ParcelableConnection connection,
400 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700401 SomeArgs args = SomeArgs.obtain();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700402 args.arg1 = id;
403 args.arg2 = request;
404 args.arg3 = connection;
Ihab Awad6107bab2014-08-18 09:23:25 -0700405 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700406 }
407
408 @Override
Ravi Paluri80aa2142019-12-02 11:57:37 +0530409 public void handleCreateConferenceComplete(
410 String id,
411 ConnectionRequest request,
412 ParcelableConference conference,
413 Session.Info sessionInfo) {
414 SomeArgs args = SomeArgs.obtain();
415 args.arg1 = id;
416 args.arg2 = request;
417 args.arg3 = conference;
418 mHandler.obtainMessage(MSG_HANDLE_CREATE_CONFERENCE_COMPLETE, args).sendToTarget();
419 }
420
421
422 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700423 public void setActive(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700424 mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
425 }
426
427 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700428 public void setRinging(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700429 mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
430 }
431
432 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700433 public void setDialing(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700434 mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
435 }
436
437 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700438 public void setPulling(String connectionId, Session.Info sessionInfo) {
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700439 mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
440 }
441
442 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700443 public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
444 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700445 SomeArgs args = SomeArgs.obtain();
446 args.arg1 = connectionId;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700447 args.arg2 = disconnectCause;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700448 mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
449 }
450
451 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700452 public void setOnHold(String connectionId, Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700453 mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
454 }
455
456 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700457 public void setRingbackRequested(String connectionId, boolean ringback,
458 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700459 mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700460 .sendToTarget();
461 }
462
463 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700464 public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
465 Session.Info sessionInfo) {
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800466 mHandler.obtainMessage(
467 MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
Ihab Awad5d0410f2014-07-30 10:07:40 -0700468 .sendToTarget();
469 }
470
471 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700472 public void setConnectionProperties(String connectionId, int connectionProperties,
473 Session.Info sessionInfo) {
Tyler Gunn720c6642016-03-22 09:02:47 -0700474 mHandler.obtainMessage(
475 MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
476 .sendToTarget();
477 }
478
479 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700480 public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
Anthony Lee17455a32015-04-24 15:25:29 -0700481 SomeArgs args = SomeArgs.obtain();
482 args.arg1 = callId;
483 mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
484 }
485
486 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700487 public void setIsConferenced(String callId, String conferenceCallId,
488 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700489 SomeArgs args = SomeArgs.obtain();
490 args.arg1 = callId;
491 args.arg2 = conferenceCallId;
492 mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
493 }
494
495 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700496 public void addConferenceCall(String callId, ParcelableConference parcelableConference,
497 Session.Info sessionInfo) {
Santos Cordon823fd3c2014-08-07 18:35:18 -0700498 SomeArgs args = SomeArgs.obtain();
499 args.arg1 = callId;
500 args.arg2 = parcelableConference;
501 mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700502 }
503
504 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700505 public void removeCall(String connectionId,
506 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700507 mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
508 }
509
510 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700511 public void onPostDialWait(String connectionId, String remainingDigits,
512 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700513 SomeArgs args = SomeArgs.obtain();
514 args.arg1 = connectionId;
515 args.arg2 = remainingDigits;
516 mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
517 }
518
519 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700520 public void onPostDialChar(String connectionId, char nextChar,
521 Session.Info sessionInfo) {
Nancy Chen27d1c2d2014-12-15 16:12:50 -0800522 SomeArgs args = SomeArgs.obtain();
523 args.arg1 = connectionId;
524 args.argi1 = nextChar;
525 mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
526 }
527
528 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700529 public void queryRemoteConnectionServices(RemoteServiceCallback callback,
Tyler Gunn4c69fb32019-05-17 10:49:16 -0700530 String callingPackage, Session.Info sessionInfo) {
531 SomeArgs args = SomeArgs.obtain();
532 args.arg1 = callback;
533 args.arg2 = callingPackage;
Tyler Gunn156a33b2019-05-30 16:52:28 -0700534 mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700535 }
536
537 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700538 public void setVideoState(String connectionId, int videoState,
539 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700540 mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
541 }
542
543 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700544 public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
545 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700546 SomeArgs args = SomeArgs.obtain();
547 args.arg1 = connectionId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700548 args.arg2 = videoProvider;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700549 mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
550 }
551
552 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700553 public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
554 Session.Info sessionInfo) {
Andrew Lee100e2932014-09-08 15:34:24 -0700555 mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700556 connectionId).sendToTarget();
557 }
558
559 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700560 public final void setStatusHints(String connectionId, StatusHints statusHints,
561 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700562 SomeArgs args = SomeArgs.obtain();
563 args.arg1 = connectionId;
564 args.arg2 = statusHints;
565 mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
566 }
567
568 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700569 public final void setAddress(String connectionId, Uri address, int presentation,
570 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700571 SomeArgs args = SomeArgs.obtain();
572 args.arg1 = connectionId;
Andrew Lee100e2932014-09-08 15:34:24 -0700573 args.arg2 = address;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700574 args.argi1 = presentation;
Andrew Lee100e2932014-09-08 15:34:24 -0700575 mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700576 }
577
578 @Override
579 public final void setCallerDisplayName(
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700580 String connectionId, String callerDisplayName, int presentation,
581 Session.Info sessionInfo) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700582 SomeArgs args = SomeArgs.obtain();
583 args.arg1 = connectionId;
584 args.arg2 = callerDisplayName;
585 args.argi1 = presentation;
586 mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
587 }
588
589 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700590 public final void setConferenceableConnections(String connectionId,
591 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700592 SomeArgs args = SomeArgs.obtain();
593 args.arg1 = connectionId;
594 args.arg2 = conferenceableConnectionIds;
595 mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
596 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700597
598 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700599 public final void addExistingConnection(String connectionId,
600 ParcelableConnection connection, Session.Info sessionInfo) {
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700601 SomeArgs args = SomeArgs.obtain();
602 args.arg1 = connectionId;
603 args.arg2 = connection;
604 mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
605 }
Santos Cordon6b7f9552015-05-27 17:21:45 -0700606
607 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700608 public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
Santos Cordon6b7f9552015-05-27 17:21:45 -0700609 SomeArgs args = SomeArgs.obtain();
610 args.arg1 = connectionId;
611 args.arg2 = extras;
Tyler Gunndee56a82016-03-23 16:06:34 -0700612 mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
613 }
614
615 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700616 public final void removeExtras(String connectionId, List<String> keys,
617 Session.Info sessionInfo) {
Tyler Gunndee56a82016-03-23 16:06:34 -0700618 SomeArgs args = SomeArgs.obtain();
619 args.arg1 = connectionId;
620 args.arg2 = keys;
621 mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
Santos Cordon6b7f9552015-05-27 17:21:45 -0700622 }
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800623
624 @Override
Tyler Gunnf5035432017-01-09 09:43:12 -0800625 public final void setAudioRoute(String connectionId, int audioRoute,
Hall Liua98f58b52017-11-07 17:59:28 -0800626 String bluetoothAddress, Session.Info sessionInfo) {
Tyler Gunnf5035432017-01-09 09:43:12 -0800627 SomeArgs args = SomeArgs.obtain();
628 args.arg1 = connectionId;
629 args.argi1 = audioRoute;
Hall Liua98f58b52017-11-07 17:59:28 -0800630 args.arg2 = bluetoothAddress;
631 args.arg3 = sessionInfo;
Tyler Gunnf5035432017-01-09 09:43:12 -0800632 mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
633 }
634
635 @Override
Brad Ebinger4d75bee2016-10-28 12:29:55 -0700636 public final void onConnectionEvent(String connectionId, String event, Bundle extras,
637 Session.Info sessionInfo) {
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800638 SomeArgs args = SomeArgs.obtain();
639 args.arg1 = connectionId;
640 args.arg2 = event;
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700641 args.arg3 = extras;
Tyler Gunnbd1eb1f2016-02-16 14:36:20 -0800642 mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
643 }
Hall Liu57006aa2017-02-06 10:49:48 -0800644
645 @Override
646 public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
647 throws RemoteException {
648 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
649 }
650
651 @Override
652 public void onRttInitiationFailure(String connectionId, int reason,
653 Session.Info sessionInfo)
654 throws RemoteException {
655 mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
656 .sendToTarget();
657 }
658
659 @Override
660 public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
661 throws RemoteException {
662 mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
663 }
664
665 @Override
666 public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
667 throws RemoteException {
668 mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
669 }
Srikanth Chintalafcb15012017-05-04 20:58:34 +0530670
671 @Override
672 public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
673 Session.Info sessionInfo) {
674 SomeArgs args = SomeArgs.obtain();
675 args.arg1 = callId;
676 args.arg2 = pHandle;
677 mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
678 }
Pengquan Meng63d25a52017-11-21 18:01:13 -0800679
680 @Override
681 public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
682 mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
683 }
Mengjun Leng25707742017-07-04 11:10:37 +0800684
685 @Override
686 public void resetConnectionTime(String callId, Session.Info sessionInfo) {
687 // Do nothing
688 }
Tyler Gunn68a73a42018-10-03 15:38:57 -0700689
690 @Override
691 public void setConferenceState(String callId, boolean isConference,
692 Session.Info sessionInfo) {
693 SomeArgs args = SomeArgs.obtain();
694 args.arg1 = callId;
695 args.arg2 = isConference;
696 args.arg3 = sessionInfo;
697 mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget();
698 }
Brad Ebinger31774ae2020-04-08 16:25:12 -0700699
700 @Override
701 public void setCallDirection(String callId, int direction,
702 Session.Info sessionInfo) {
703 SomeArgs args = SomeArgs.obtain();
704 args.arg1 = callId;
705 args.argi1 = direction;
706 args.arg2 = sessionInfo;
707 mHandler.obtainMessage(MSG_SET_CALL_DIRECTION, args).sendToTarget();
708 }
Junhoedf3d822022-11-24 09:26:37 +0000709
710 @Override
711 public void requestCallEndpointChange(String callId, CallEndpoint endpoint,
712 ResultReceiver callback, Session.Info sessionInfo) {
713 // Do nothing
714 }
yongnamcha8ec56242022-11-28 06:23:02 +0000715
716 @Override
717 public void queryLocation(String callId, long timeoutMillis, String provider,
718 ResultReceiver callback, Session.Info sessionInfo) {
719 SomeArgs args = SomeArgs.obtain();
720 args.arg1 = callId;
721 args.arg2 = timeoutMillis;
722 args.arg3 = provider;
723 args.arg4 = callback;
724 args.arg5 = sessionInfo;
725 mHandler.obtainMessage(MSG_QUERY_LOCATION, args).sendToTarget();
726 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700727 };
728
729 public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
730 mDelegate = delegate;
731 }
732
733 public IConnectionServiceAdapter getStub() {
734 return mStub;
735 }
736}