1 /*
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 
17 package android.telecom;
18 
19 import android.net.Uri;
20 import android.os.Bundle;
21 import android.os.Handler;
22 import android.os.Message;
23 import android.os.RemoteException;
24 import android.telecom.Logging.Session;
25 
26 import com.android.internal.os.SomeArgs;
27 import com.android.internal.telecom.IConnectionServiceAdapter;
28 import com.android.internal.telecom.IVideoProvider;
29 import com.android.internal.telecom.RemoteServiceCallback;
30 
31 import java.util.List;
32 
33 /**
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  */
41 final class ConnectionServiceAdapterServant {
42     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;
48     private static final int MSG_SET_RINGBACK_REQUESTED = 7;
49     private static final int MSG_SET_CONNECTION_CAPABILITIES = 8;
50     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;
57     private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16;
58     private static final int MSG_SET_STATUS_HINTS = 17;
59     private static final int MSG_SET_ADDRESS = 18;
60     private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
61     private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
62     private static final int MSG_ADD_EXISTING_CONNECTION = 21;
63     private static final int MSG_ON_POST_DIAL_CHAR = 22;
64     private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
65     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;
68     private static final int MSG_SET_CONNECTION_PROPERTIES = 27;
69     private static final int MSG_SET_PULLING = 28;
70     private static final int MSG_SET_AUDIO_ROUTE = 29;
71     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;
75     private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34;
76     private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35;
77 
78     private final IConnectionServiceAdapter mDelegate;
79 
80     private final Handler mHandler = new Handler() {
81         @Override
82         public void handleMessage(Message msg) {
83             try {
84                 internalHandleMessage(msg);
85             } catch (RemoteException e) {
86             }
87         }
88 
89         // Internal method defined to centralize handling of RemoteException
90         private void internalHandleMessage(Message msg) throws RemoteException {
91             switch (msg.what) {
92                 case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: {
93                     SomeArgs args = (SomeArgs) msg.obj;
94                     try {
95                         mDelegate.handleCreateConnectionComplete(
96                                 (String) args.arg1,
97                                 (ConnectionRequest) args.arg2,
98                                 (ParcelableConnection) args.arg3,
99                                 null /*Session.Info*/);
100                     } finally {
101                         args.recycle();
102                     }
103                     break;
104                 }
105                 case MSG_SET_ACTIVE:
106                     mDelegate.setActive((String) msg.obj, null /*Session.Info*/);
107                     break;
108                 case MSG_SET_RINGING:
109                     mDelegate.setRinging((String) msg.obj, null /*Session.Info*/);
110                     break;
111                 case MSG_SET_DIALING:
112                     mDelegate.setDialing((String) msg.obj, null /*Session.Info*/);
113                     break;
114                 case MSG_SET_PULLING:
115                     mDelegate.setPulling((String) msg.obj, null /*Session.Info*/);
116                     break;
117                 case MSG_SET_DISCONNECTED: {
118                     SomeArgs args = (SomeArgs) msg.obj;
119                     try {
120                         mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2,
121                                 null /*Session.Info*/);
122                     } finally {
123                         args.recycle();
124                     }
125                     break;
126                 }
127                 case MSG_SET_ON_HOLD:
128                     mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/);
129                     break;
130                 case MSG_SET_RINGBACK_REQUESTED:
131                     mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1,
132                             null /*Session.Info*/);
133                     break;
134                 case MSG_SET_CONNECTION_CAPABILITIES:
135                     mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1,
136                             null /*Session.Info*/);
137                     break;
138                 case MSG_SET_CONNECTION_PROPERTIES:
139                     mDelegate.setConnectionProperties((String) msg.obj, msg.arg1,
140                             null /*Session.Info*/);
141                     break;
142                 case MSG_SET_IS_CONFERENCED: {
143                     SomeArgs args = (SomeArgs) msg.obj;
144                     try {
145                         mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2,
146                                 null /*Session.Info*/);
147                     } finally {
148                         args.recycle();
149                     }
150                     break;
151                 }
152                 case MSG_ADD_CONFERENCE_CALL: {
153                     SomeArgs args = (SomeArgs) msg.obj;
154                     try {
155                         mDelegate.addConferenceCall(
156                                 (String) args.arg1, (ParcelableConference) args.arg2,
157                                 null /*Session.Info*/);
158                     } finally {
159                         args.recycle();
160                     }
161                     break;
162                 }
163                 case MSG_REMOVE_CALL:
164                     mDelegate.removeCall((String) msg.obj,
165                             null /*Session.Info*/);
166                     break;
167                 case MSG_ON_POST_DIAL_WAIT: {
168                     SomeArgs args = (SomeArgs) msg.obj;
169                     try {
170                         mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2,
171                                 null /*Session.Info*/);
172                     } finally {
173                         args.recycle();
174                     }
175                     break;
176                 }
177                 case MSG_ON_POST_DIAL_CHAR: {
178                     SomeArgs args = (SomeArgs) msg.obj;
179                     try {
180                         mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1,
181                                 null /*Session.Info*/);
182                     } finally {
183                         args.recycle();
184                     }
185                     break;
186                 }
187                 case MSG_QUERY_REMOTE_CALL_SERVICES:
188                     mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj,
189                             null /*Session.Info*/);
190                     break;
191                 case MSG_SET_VIDEO_STATE:
192                     mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/);
193                     break;
194                 case MSG_SET_VIDEO_CALL_PROVIDER: {
195                     SomeArgs args = (SomeArgs) msg.obj;
196                     try {
197                         mDelegate.setVideoProvider((String) args.arg1,
198                                 (IVideoProvider) args.arg2, null /*Session.Info*/);
199                     } finally {
200                         args.recycle();
201                     }
202                     break;
203                 }
204                 case MSG_SET_IS_VOIP_AUDIO_MODE:
205                     mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1,
206                             null /*Session.Info*/);
207                     break;
208                 case MSG_SET_STATUS_HINTS: {
209                     SomeArgs args = (SomeArgs) msg.obj;
210                     try {
211                         mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2,
212                                 null /*Session.Info*/);
213                     } finally {
214                         args.recycle();
215                     }
216                     break;
217                 }
218                 case MSG_SET_ADDRESS: {
219                     SomeArgs args = (SomeArgs) msg.obj;
220                     try {
221                         mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1,
222                                 null /*Session.Info*/);
223                     } finally {
224                         args.recycle();
225                     }
226                     break;
227                 }
228                 case MSG_SET_CALLER_DISPLAY_NAME: {
229                     SomeArgs args = (SomeArgs) msg.obj;
230                     try {
231                         mDelegate.setCallerDisplayName(
232                                 (String) args.arg1, (String) args.arg2, args.argi1,
233                                 null /*Session.Info*/);
234                     } finally {
235                         args.recycle();
236                     }
237                     break;
238                 }
239                 case MSG_SET_CONFERENCEABLE_CONNECTIONS: {
240                     SomeArgs args = (SomeArgs) msg.obj;
241                     try {
242                         mDelegate.setConferenceableConnections((String) args.arg1,
243                                 (List<String>) args.arg2, null /*Session.Info*/);
244                     } finally {
245                         args.recycle();
246                     }
247                     break;
248                 }
249                 case MSG_ADD_EXISTING_CONNECTION: {
250                     SomeArgs args = (SomeArgs) msg.obj;
251                     try {
252                         mDelegate.addExistingConnection((String) args.arg1,
253                                 (ParcelableConnection) args.arg2, null /*Session.Info*/);
254                     } finally {
255                         args.recycle();
256                     }
257                     break;
258                 }
259                 case MSG_SET_CONFERENCE_MERGE_FAILED: {
260                     SomeArgs args = (SomeArgs) msg.obj;
261                     try {
262                         mDelegate.setConferenceMergeFailed((String) args.arg1,
263                                 null /*Session.Info*/);
264                     } finally {
265                         args.recycle();
266                     }
267                     break;
268                 }
269                 case MSG_PUT_EXTRAS: {
270                     SomeArgs args = (SomeArgs) msg.obj;
271                     try {
272                         mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2,
273                                 null /*Session.Info*/);
274                     } finally {
275                         args.recycle();
276                     }
277                     break;
278                 }
279                 case MSG_REMOVE_EXTRAS: {
280                     SomeArgs args = (SomeArgs) msg.obj;
281                     try {
282                         mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2,
283                                 null /*Session.Info*/);
284                     } finally {
285                         args.recycle();
286                     }
287                     break;
288                 }
289                 case MSG_ON_CONNECTION_EVENT: {
290                     SomeArgs args = (SomeArgs) msg.obj;
291                     try {
292                         mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2,
293                                 (Bundle) args.arg3, null /*Session.Info*/);
294                     } finally {
295                         args.recycle();
296                     }
297                     break;
298                 }
299                 case MSG_SET_AUDIO_ROUTE: {
300                     SomeArgs args = (SomeArgs) msg.obj;
301                     try {
302                         mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2,
303                                 (Session.Info) args.arg3);
304                     } finally {
305                         args.recycle();
306                     }
307                     break;
308                 }
309                 case MSG_ON_RTT_INITIATION_SUCCESS:
310                     mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/);
311                     break;
312                 case MSG_ON_RTT_INITIATION_FAILURE:
313                     mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1,
314                             null /*Session.Info*/);
315                     break;
316                 case MSG_ON_RTT_REMOTELY_TERMINATED:
317                     mDelegate.onRttSessionRemotelyTerminated((String) msg.obj,
318                             null /*Session.Info*/);
319                     break;
320                 case MSG_ON_RTT_UPGRADE_REQUEST:
321                     mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
322                     break;
323                 case MSG_SET_PHONE_ACCOUNT_CHANGED: {
324                     SomeArgs args = (SomeArgs) msg.obj;
325                     try {
326                         mDelegate.onPhoneAccountChanged((String) args.arg1,
327                                 (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
328                     } finally {
329                         args.recycle();
330                     }
331                     break;
332                 }
333                 case MSG_CONNECTION_SERVICE_FOCUS_RELEASED:
334                     mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/);
335                     break;
336             }
337         }
338     };
339 
340     private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() {
341         @Override
342         public void handleCreateConnectionComplete(
343                 String id,
344                 ConnectionRequest request,
345                 ParcelableConnection connection,
346                 Session.Info sessionInfo) {
347             SomeArgs args = SomeArgs.obtain();
348             args.arg1 = id;
349             args.arg2 = request;
350             args.arg3 = connection;
351             mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget();
352         }
353 
354         @Override
355         public void setActive(String connectionId, Session.Info sessionInfo) {
356             mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget();
357         }
358 
359         @Override
360         public void setRinging(String connectionId, Session.Info sessionInfo) {
361             mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget();
362         }
363 
364         @Override
365         public void setDialing(String connectionId, Session.Info sessionInfo) {
366             mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget();
367         }
368 
369         @Override
370         public void setPulling(String connectionId, Session.Info sessionInfo) {
371             mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget();
372         }
373 
374         @Override
375         public void setDisconnected(String connectionId, DisconnectCause disconnectCause,
376                 Session.Info sessionInfo) {
377             SomeArgs args = SomeArgs.obtain();
378             args.arg1 = connectionId;
379             args.arg2 = disconnectCause;
380             mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
381         }
382 
383         @Override
384         public void setOnHold(String connectionId, Session.Info sessionInfo) {
385             mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
386         }
387 
388         @Override
389         public void setRingbackRequested(String connectionId, boolean ringback,
390                 Session.Info sessionInfo) {
391             mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId)
392                     .sendToTarget();
393         }
394 
395         @Override
396         public void setConnectionCapabilities(String connectionId, int connectionCapabilities,
397                 Session.Info sessionInfo) {
398             mHandler.obtainMessage(
399                     MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId)
400                     .sendToTarget();
401         }
402 
403         @Override
404         public void setConnectionProperties(String connectionId, int connectionProperties,
405                 Session.Info sessionInfo) {
406             mHandler.obtainMessage(
407                     MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId)
408                     .sendToTarget();
409         }
410 
411         @Override
412         public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) {
413             SomeArgs args = SomeArgs.obtain();
414             args.arg1 = callId;
415             mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget();
416         }
417 
418         @Override
419         public void setIsConferenced(String callId, String conferenceCallId,
420                 Session.Info sessionInfo) {
421             SomeArgs args = SomeArgs.obtain();
422             args.arg1 = callId;
423             args.arg2 = conferenceCallId;
424             mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget();
425         }
426 
427         @Override
428         public void addConferenceCall(String callId, ParcelableConference parcelableConference,
429                 Session.Info sessionInfo) {
430             SomeArgs args = SomeArgs.obtain();
431             args.arg1 = callId;
432             args.arg2 = parcelableConference;
433             mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget();
434         }
435 
436         @Override
437         public void removeCall(String connectionId,
438                 Session.Info sessionInfo) {
439             mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget();
440         }
441 
442         @Override
443         public void onPostDialWait(String connectionId, String remainingDigits,
444                 Session.Info sessionInfo) {
445             SomeArgs args = SomeArgs.obtain();
446             args.arg1 = connectionId;
447             args.arg2 = remainingDigits;
448             mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget();
449         }
450 
451         @Override
452         public void onPostDialChar(String connectionId, char nextChar,
453                 Session.Info sessionInfo) {
454             SomeArgs args = SomeArgs.obtain();
455             args.arg1 = connectionId;
456             args.argi1 = nextChar;
457             mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget();
458         }
459 
460         @Override
461         public void queryRemoteConnectionServices(RemoteServiceCallback callback,
462                 Session.Info sessionInfo) {
463             mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget();
464         }
465 
466         @Override
467         public void setVideoState(String connectionId, int videoState,
468                 Session.Info sessionInfo) {
469             mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget();
470         }
471 
472         @Override
473         public void setVideoProvider(String connectionId, IVideoProvider videoProvider,
474                 Session.Info sessionInfo) {
475             SomeArgs args = SomeArgs.obtain();
476             args.arg1 = connectionId;
477             args.arg2 = videoProvider;
478             mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget();
479         }
480 
481         @Override
482         public final void setIsVoipAudioMode(String connectionId, boolean isVoip,
483                 Session.Info sessionInfo) {
484             mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0,
485                     connectionId).sendToTarget();
486         }
487 
488         @Override
489         public final void setStatusHints(String connectionId, StatusHints statusHints,
490                 Session.Info sessionInfo) {
491             SomeArgs args = SomeArgs.obtain();
492             args.arg1 = connectionId;
493             args.arg2 = statusHints;
494             mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget();
495         }
496 
497         @Override
498         public final void setAddress(String connectionId, Uri address, int presentation,
499                 Session.Info sessionInfo) {
500             SomeArgs args = SomeArgs.obtain();
501             args.arg1 = connectionId;
502             args.arg2 = address;
503             args.argi1 = presentation;
504             mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget();
505         }
506 
507         @Override
508         public final void setCallerDisplayName(
509                 String connectionId, String callerDisplayName, int presentation,
510                 Session.Info sessionInfo) {
511             SomeArgs args = SomeArgs.obtain();
512             args.arg1 = connectionId;
513             args.arg2 = callerDisplayName;
514             args.argi1 = presentation;
515             mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget();
516         }
517 
518         @Override
519         public final void setConferenceableConnections(String connectionId,
520                 List<String> conferenceableConnectionIds, Session.Info sessionInfo) {
521             SomeArgs args = SomeArgs.obtain();
522             args.arg1 = connectionId;
523             args.arg2 = conferenceableConnectionIds;
524             mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
525         }
526 
527         @Override
528         public final void addExistingConnection(String connectionId,
529                 ParcelableConnection connection, Session.Info sessionInfo) {
530             SomeArgs args = SomeArgs.obtain();
531             args.arg1 = connectionId;
532             args.arg2 = connection;
533             mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
534         }
535 
536         @Override
537         public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) {
538             SomeArgs args = SomeArgs.obtain();
539             args.arg1 = connectionId;
540             args.arg2 = extras;
541             mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget();
542         }
543 
544         @Override
545         public final void removeExtras(String connectionId, List<String> keys,
546                 Session.Info sessionInfo) {
547             SomeArgs args = SomeArgs.obtain();
548             args.arg1 = connectionId;
549             args.arg2 = keys;
550             mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget();
551         }
552 
553         @Override
554         public final void setAudioRoute(String connectionId, int audioRoute,
555                 String bluetoothAddress, Session.Info sessionInfo) {
556             SomeArgs args = SomeArgs.obtain();
557             args.arg1 = connectionId;
558             args.argi1 = audioRoute;
559             args.arg2 = bluetoothAddress;
560             args.arg3 = sessionInfo;
561             mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget();
562         }
563 
564         @Override
565         public final void onConnectionEvent(String connectionId, String event, Bundle extras,
566                 Session.Info sessionInfo) {
567             SomeArgs args = SomeArgs.obtain();
568             args.arg1 = connectionId;
569             args.arg2 = event;
570             args.arg3 = extras;
571             mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget();
572         }
573 
574         @Override
575         public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo)
576                 throws RemoteException {
577             mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget();
578         }
579 
580         @Override
581         public void onRttInitiationFailure(String connectionId, int reason,
582                 Session.Info sessionInfo)
583                 throws RemoteException {
584             mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId)
585                     .sendToTarget();
586         }
587 
588         @Override
589         public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo)
590                 throws RemoteException {
591             mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget();
592         }
593 
594         @Override
595         public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo)
596                 throws RemoteException {
597             mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
598         }
599 
600         @Override
601         public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
602                 Session.Info sessionInfo) {
603             SomeArgs args = SomeArgs.obtain();
604             args.arg1 = callId;
605             args.arg2 = pHandle;
606             mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
607         }
608 
609         @Override
610         public void onConnectionServiceFocusReleased(Session.Info sessionInfo) {
611             mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget();
612         }
613     };
614 
ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate)615     public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
616         mDelegate = delegate;
617     }
618 
getStub()619     public IConnectionServiceAdapter getStub() {
620         return mStub;
621     }
622 }
623