Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 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 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 18 | |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Omkar Kolangade | b6e1446 | 2014-08-28 11:13:58 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 21 | import android.os.Handler; |
| 22 | import android.os.Message; |
| 23 | import android.os.RemoteException; |
| 24 | |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 25 | import com.android.internal.os.SomeArgs; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 26 | import com.android.internal.telecom.IConnectionServiceAdapter; |
| 27 | import com.android.internal.telecom.IVideoProvider; |
| 28 | import com.android.internal.telecom.RemoteServiceCallback; |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 29 | |
| 30 | import java.util.List; |
| 31 | |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 32 | /** |
| 33 | * A component that provides an RPC servant implementation of {@link IConnectionServiceAdapter}, |
| 34 | * posting incoming messages on the main thread on a client-supplied delegate object. |
| 35 | * |
| 36 | * TODO: Generate this and similar classes using a compiler starting from AIDL interfaces. |
| 37 | * |
| 38 | * @hide |
| 39 | */ |
| 40 | final class ConnectionServiceAdapterServant { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 41 | private static final int MSG_HANDLE_CREATE_CONNECTION_COMPLETE = 1; |
| 42 | private static final int MSG_SET_ACTIVE = 2; |
| 43 | private static final int MSG_SET_RINGING = 3; |
| 44 | private static final int MSG_SET_DIALING = 4; |
| 45 | private static final int MSG_SET_DISCONNECTED = 5; |
| 46 | private static final int MSG_SET_ON_HOLD = 6; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 47 | private static final int MSG_SET_RINGBACK_REQUESTED = 7; |
Ihab Awad | 4a0d272 | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 48 | private static final int MSG_SET_CONNECTION_CAPABILITIES = 8; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 49 | private static final int MSG_SET_IS_CONFERENCED = 9; |
| 50 | private static final int MSG_ADD_CONFERENCE_CALL = 10; |
| 51 | private static final int MSG_REMOVE_CALL = 11; |
| 52 | private static final int MSG_ON_POST_DIAL_WAIT = 12; |
| 53 | private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 13; |
| 54 | private static final int MSG_SET_VIDEO_STATE = 14; |
| 55 | private static final int MSG_SET_VIDEO_CALL_PROVIDER = 15; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 56 | private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 57 | private static final int MSG_SET_STATUS_HINTS = 17; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 58 | private static final int MSG_SET_ADDRESS = 18; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 59 | private static final int MSG_SET_CALLER_DISPLAY_NAME = 19; |
Evan Charlton | 23dc241 | 2014-09-03 10:07:03 -0700 | [diff] [blame] | 60 | private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20; |
Nancy Chen | 70f7571 | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 61 | private static final int MSG_ADD_EXISTING_CONNECTION = 21; |
| 62 | private static final int MSG_ON_POST_DIAL_CHAR = 22; |
| 63 | private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 23; |
| 64 | private static final int MSG_SET_PHONE_ACCOUNT = 24; |
| 65 | private static final int MSG_SET_CALL_SUBSTATE = 25; |
| 66 | private static final int MSG_SET_EXTRAS = 26; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 67 | |
| 68 | private final IConnectionServiceAdapter mDelegate; |
| 69 | |
| 70 | private final Handler mHandler = new Handler() { |
| 71 | @Override |
| 72 | public void handleMessage(Message msg) { |
| 73 | try { |
| 74 | internalHandleMessage(msg); |
| 75 | } catch (RemoteException e) { |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | // Internal method defined to centralize handling of RemoteException |
| 80 | private void internalHandleMessage(Message msg) throws RemoteException { |
| 81 | switch (msg.what) { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 82 | case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 83 | SomeArgs args = (SomeArgs) msg.obj; |
| 84 | try { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 85 | mDelegate.handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 86 | (String) args.arg1, |
| 87 | (ConnectionRequest) args.arg2, |
| 88 | (ParcelableConnection) args.arg3); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 89 | } finally { |
| 90 | args.recycle(); |
| 91 | } |
| 92 | break; |
| 93 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 94 | case MSG_SET_ACTIVE: |
| 95 | mDelegate.setActive((String) msg.obj); |
| 96 | break; |
Omkar Kolangade | b6e1446 | 2014-08-28 11:13:58 -0700 | [diff] [blame] | 97 | case MSG_SET_EXTRAS: { |
| 98 | SomeArgs args = (SomeArgs) msg.obj; |
| 99 | try { |
| 100 | mDelegate.setExtras( |
| 101 | (String) args.arg1, (Bundle) args.arg2); |
| 102 | } finally { |
| 103 | args.recycle(); |
| 104 | } |
| 105 | break; |
| 106 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 107 | case MSG_SET_RINGING: |
| 108 | mDelegate.setRinging((String) msg.obj); |
| 109 | break; |
| 110 | case MSG_SET_DIALING: |
| 111 | mDelegate.setDialing((String) msg.obj); |
| 112 | break; |
| 113 | case MSG_SET_DISCONNECTED: { |
| 114 | SomeArgs args = (SomeArgs) msg.obj; |
| 115 | try { |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 116 | mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 117 | } finally { |
| 118 | args.recycle(); |
| 119 | } |
| 120 | break; |
| 121 | } |
Ravindra Thattahalli Javaraiah | ce75a42 | 2014-08-27 11:30:29 +0530 | [diff] [blame] | 122 | case MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION: { |
| 123 | SomeArgs args = (SomeArgs) msg.obj; |
| 124 | try { |
| 125 | mDelegate.setDisconnectedWithSsNotification( |
| 126 | (String) args.arg1, args.argi1, (String) args.arg2, |
| 127 | args.argi2, args.argi3); |
| 128 | } finally { |
| 129 | args.recycle(); |
| 130 | } |
| 131 | break; |
| 132 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 133 | case MSG_SET_ON_HOLD: |
| 134 | mDelegate.setOnHold((String) msg.obj); |
| 135 | break; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 136 | case MSG_SET_RINGBACK_REQUESTED: |
| 137 | mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 138 | break; |
Ihab Awad | 4a0d272 | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 139 | case MSG_SET_CONNECTION_CAPABILITIES: |
| 140 | mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 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 | } finally { |
| 147 | args.recycle(); |
| 148 | } |
| 149 | break; |
| 150 | } |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 151 | case MSG_ADD_CONFERENCE_CALL: { |
| 152 | SomeArgs args = (SomeArgs) msg.obj; |
| 153 | try { |
| 154 | mDelegate.addConferenceCall( |
| 155 | (String) args.arg1, (ParcelableConference) args.arg2); |
| 156 | } finally { |
| 157 | args.recycle(); |
| 158 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 159 | break; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 160 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 161 | case MSG_REMOVE_CALL: |
| 162 | mDelegate.removeCall((String) msg.obj); |
| 163 | break; |
| 164 | case MSG_ON_POST_DIAL_WAIT: { |
| 165 | SomeArgs args = (SomeArgs) msg.obj; |
| 166 | try { |
| 167 | mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2); |
| 168 | } finally { |
| 169 | args.recycle(); |
| 170 | } |
| 171 | break; |
| 172 | } |
Nancy Chen | 70f7571 | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 173 | case MSG_ON_POST_DIAL_CHAR: { |
| 174 | SomeArgs args = (SomeArgs) msg.obj; |
| 175 | try { |
| 176 | mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1); |
| 177 | } finally { |
| 178 | args.recycle(); |
| 179 | } |
| 180 | break; |
| 181 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 182 | case MSG_QUERY_REMOTE_CALL_SERVICES: |
| 183 | mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj); |
| 184 | break; |
| 185 | case MSG_SET_VIDEO_STATE: |
| 186 | mDelegate.setVideoState((String) msg.obj, msg.arg1); |
| 187 | break; |
| 188 | case MSG_SET_VIDEO_CALL_PROVIDER: { |
| 189 | SomeArgs args = (SomeArgs) msg.obj; |
| 190 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 191 | mDelegate.setVideoProvider((String) args.arg1, |
| 192 | (IVideoProvider) args.arg2); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 193 | } finally { |
| 194 | args.recycle(); |
| 195 | } |
| 196 | break; |
| 197 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 198 | case MSG_SET_IS_VOIP_AUDIO_MODE: |
| 199 | mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 200 | break; |
| 201 | case MSG_SET_STATUS_HINTS: { |
| 202 | SomeArgs args = (SomeArgs) msg.obj; |
| 203 | try { |
| 204 | mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2); |
| 205 | } finally { |
| 206 | args.recycle(); |
| 207 | } |
| 208 | break; |
| 209 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 210 | case MSG_SET_ADDRESS: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 211 | SomeArgs args = (SomeArgs) msg.obj; |
| 212 | try { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 213 | mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 214 | } finally { |
| 215 | args.recycle(); |
| 216 | } |
| 217 | break; |
| 218 | } |
| 219 | case MSG_SET_CALLER_DISPLAY_NAME: { |
| 220 | SomeArgs args = (SomeArgs) msg.obj; |
| 221 | try { |
| 222 | mDelegate.setCallerDisplayName( |
| 223 | (String) args.arg1, (String) args.arg2, args.argi1); |
| 224 | } finally { |
| 225 | args.recycle(); |
| 226 | } |
| 227 | break; |
| 228 | } |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 229 | case MSG_SET_CONFERENCEABLE_CONNECTIONS: { |
| 230 | SomeArgs args = (SomeArgs) msg.obj; |
| 231 | try { |
| 232 | mDelegate.setConferenceableConnections( |
| 233 | (String) args.arg1, (List<String>) args.arg2); |
| 234 | } finally { |
| 235 | args.recycle(); |
| 236 | } |
| 237 | break; |
| 238 | } |
Sandeep Gutta | 4c5053c | 2014-09-24 23:52:00 +0530 | [diff] [blame] | 239 | case MSG_SET_PHONE_ACCOUNT: { |
| 240 | SomeArgs args = (SomeArgs) msg.obj; |
| 241 | try { |
| 242 | mDelegate.setPhoneAccountHandle( |
| 243 | (String) args.arg1, (PhoneAccountHandle) args.arg2); |
| 244 | } finally { |
| 245 | args.recycle(); |
| 246 | } |
| 247 | break; |
| 248 | } |
Nivedita Sarkar | 1fc1c3f | 2014-10-27 11:46:22 -0700 | [diff] [blame] | 249 | case MSG_SET_CALL_SUBSTATE: { |
| 250 | mDelegate.setCallSubstate((String) msg.obj, msg.arg1); |
| 251 | break; |
| 252 | } |
Tyler Gunn | bf1961f | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 253 | case MSG_ADD_EXISTING_CONNECTION: { |
| 254 | SomeArgs args = (SomeArgs) msg.obj; |
| 255 | try { |
| 256 | mDelegate.addExistingConnection( |
| 257 | (String) args.arg1, (ParcelableConnection) args.arg2); |
| 258 | } finally { |
| 259 | args.recycle(); |
| 260 | } |
| 261 | break; |
| 262 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 263 | } |
| 264 | } |
| 265 | }; |
| 266 | |
| 267 | private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() { |
| 268 | @Override |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 269 | public void handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 270 | String id, |
| 271 | ConnectionRequest request, |
| 272 | ParcelableConnection connection) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 273 | SomeArgs args = SomeArgs.obtain(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 274 | args.arg1 = id; |
| 275 | args.arg2 = request; |
| 276 | args.arg3 = connection; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 277 | mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | @Override |
| 281 | public void setActive(String connectionId) { |
| 282 | mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget(); |
| 283 | } |
| 284 | |
| 285 | @Override |
Omkar Kolangade | b6e1446 | 2014-08-28 11:13:58 -0700 | [diff] [blame] | 286 | public void setExtras(String callId, Bundle extras) { |
| 287 | SomeArgs args = SomeArgs.obtain(); |
| 288 | args.arg1 = callId; |
| 289 | args.arg2 = extras; |
| 290 | mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget(); |
| 291 | } |
| 292 | |
| 293 | @Override |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 294 | public void setRinging(String connectionId) { |
| 295 | mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget(); |
| 296 | } |
| 297 | |
| 298 | @Override |
| 299 | public void setDialing(String connectionId) { |
| 300 | mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget(); |
| 301 | } |
| 302 | |
| 303 | @Override |
| 304 | public void setDisconnected( |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 305 | String connectionId, DisconnectCause disconnectCause) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 306 | SomeArgs args = SomeArgs.obtain(); |
| 307 | args.arg1 = connectionId; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 308 | args.arg2 = disconnectCause; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 309 | mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget(); |
| 310 | } |
| 311 | |
| 312 | @Override |
Ravindra Thattahalli Javaraiah | ce75a42 | 2014-08-27 11:30:29 +0530 | [diff] [blame] | 313 | public void setDisconnectedWithSsNotification( |
| 314 | String connectionId, int disconnectCause, String disconnectMessage, |
| 315 | int type, int code) { |
| 316 | SomeArgs args = SomeArgs.obtain(); |
| 317 | args.arg1 = connectionId; |
| 318 | args.arg2 = disconnectMessage; |
| 319 | args.argi1 = disconnectCause; |
| 320 | args.argi2 = type; |
| 321 | args.argi3 = code; |
| 322 | mHandler.obtainMessage(MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION, |
| 323 | args).sendToTarget(); |
| 324 | } |
| 325 | |
| 326 | @Override |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 327 | public void setOnHold(String connectionId) { |
| 328 | mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget(); |
| 329 | } |
| 330 | |
| 331 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 332 | public void setRingbackRequested(String connectionId, boolean ringback) { |
| 333 | mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 334 | .sendToTarget(); |
| 335 | } |
| 336 | |
| 337 | @Override |
Ihab Awad | 4a0d272 | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 338 | public void setConnectionCapabilities(String connectionId, int connectionCapabilities) { |
| 339 | mHandler.obtainMessage( |
| 340 | MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 341 | .sendToTarget(); |
| 342 | } |
| 343 | |
| 344 | @Override |
| 345 | public void setIsConferenced(String callId, String conferenceCallId) { |
| 346 | SomeArgs args = SomeArgs.obtain(); |
| 347 | args.arg1 = callId; |
| 348 | args.arg2 = conferenceCallId; |
| 349 | mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget(); |
| 350 | } |
| 351 | |
| 352 | @Override |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 353 | public void addConferenceCall(String callId, ParcelableConference parcelableConference) { |
| 354 | SomeArgs args = SomeArgs.obtain(); |
| 355 | args.arg1 = callId; |
| 356 | args.arg2 = parcelableConference; |
| 357 | mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | @Override |
| 361 | public void removeCall(String connectionId) { |
| 362 | mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget(); |
| 363 | } |
| 364 | |
| 365 | @Override |
| 366 | public void onPostDialWait(String connectionId, String remainingDigits) { |
| 367 | SomeArgs args = SomeArgs.obtain(); |
| 368 | args.arg1 = connectionId; |
| 369 | args.arg2 = remainingDigits; |
| 370 | mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget(); |
| 371 | } |
| 372 | |
| 373 | @Override |
Nancy Chen | 70f7571 | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 374 | public void onPostDialChar(String connectionId, char nextChar) { |
| 375 | SomeArgs args = SomeArgs.obtain(); |
| 376 | args.arg1 = connectionId; |
| 377 | args.argi1 = nextChar; |
| 378 | mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget(); |
| 379 | } |
| 380 | |
| 381 | @Override |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 382 | public void queryRemoteConnectionServices(RemoteServiceCallback callback) { |
| 383 | mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget(); |
| 384 | } |
| 385 | |
| 386 | @Override |
| 387 | public void setVideoState(String connectionId, int videoState) { |
| 388 | mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget(); |
| 389 | } |
| 390 | |
| 391 | @Override |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 392 | public void setVideoProvider(String connectionId, IVideoProvider videoProvider) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 393 | SomeArgs args = SomeArgs.obtain(); |
| 394 | args.arg1 = connectionId; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 395 | args.arg2 = videoProvider; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 396 | mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget(); |
| 397 | } |
| 398 | |
| 399 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 400 | public final void setIsVoipAudioMode(String connectionId, boolean isVoip) { |
| 401 | mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0, |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 402 | connectionId).sendToTarget(); |
| 403 | } |
| 404 | |
| 405 | @Override |
| 406 | public final void setStatusHints(String connectionId, StatusHints statusHints) { |
| 407 | SomeArgs args = SomeArgs.obtain(); |
| 408 | args.arg1 = connectionId; |
| 409 | args.arg2 = statusHints; |
| 410 | mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget(); |
| 411 | } |
| 412 | |
| 413 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 414 | public final void setAddress(String connectionId, Uri address, int presentation) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 415 | SomeArgs args = SomeArgs.obtain(); |
| 416 | args.arg1 = connectionId; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 417 | args.arg2 = address; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 418 | args.argi1 = presentation; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 419 | mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | @Override |
| 423 | public final void setCallerDisplayName( |
| 424 | String connectionId, String callerDisplayName, int presentation) { |
| 425 | SomeArgs args = SomeArgs.obtain(); |
| 426 | args.arg1 = connectionId; |
| 427 | args.arg2 = callerDisplayName; |
| 428 | args.argi1 = presentation; |
| 429 | mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget(); |
| 430 | } |
| 431 | |
| 432 | @Override |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 433 | public final void setConferenceableConnections( |
| 434 | String connectionId, List<String> conferenceableConnectionIds) { |
| 435 | SomeArgs args = SomeArgs.obtain(); |
| 436 | args.arg1 = connectionId; |
| 437 | args.arg2 = conferenceableConnectionIds; |
| 438 | mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget(); |
| 439 | } |
Sandeep Gutta | 4c5053c | 2014-09-24 23:52:00 +0530 | [diff] [blame] | 440 | |
| 441 | @Override |
| 442 | public final void setPhoneAccountHandle(String connectionId, PhoneAccountHandle pHandle) { |
| 443 | SomeArgs args = SomeArgs.obtain(); |
| 444 | args.arg1 = connectionId; |
| 445 | args.arg2 = pHandle; |
| 446 | mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget(); |
| 447 | } |
Nivedita Sarkar | 1fc1c3f | 2014-10-27 11:46:22 -0700 | [diff] [blame] | 448 | |
| 449 | @Override |
| 450 | public void setCallSubstate(String connectionId, int callSubstate) { |
| 451 | mHandler.obtainMessage(MSG_SET_CALL_SUBSTATE, callSubstate, 0, |
| 452 | connectionId).sendToTarget(); |
| 453 | } |
Tyler Gunn | bf1961f | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 454 | |
| 455 | @Override |
| 456 | public final void addExistingConnection( |
| 457 | String connectionId, ParcelableConnection connection) { |
| 458 | SomeArgs args = SomeArgs.obtain(); |
| 459 | args.arg1 = connectionId; |
| 460 | args.arg2 = connection; |
| 461 | mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget(); |
| 462 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 463 | }; |
| 464 | |
| 465 | public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) { |
| 466 | mDelegate = delegate; |
| 467 | } |
| 468 | |
| 469 | public IConnectionServiceAdapter getStub() { |
| 470 | return mStub; |
| 471 | } |
| 472 | } |