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; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -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 | 5c9c86e | 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; |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 61 | private static final int MSG_ADD_EXISTING_CONNECTION = 21; |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 62 | private static final int MSG_ON_POST_DIAL_CHAR = 22; |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 63 | private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame^] | 64 | private static final int MSG_SET_EXTRAS = 24; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 65 | |
| 66 | private final IConnectionServiceAdapter mDelegate; |
| 67 | |
| 68 | private final Handler mHandler = new Handler() { |
| 69 | @Override |
| 70 | public void handleMessage(Message msg) { |
| 71 | try { |
| 72 | internalHandleMessage(msg); |
| 73 | } catch (RemoteException e) { |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | // Internal method defined to centralize handling of RemoteException |
| 78 | private void internalHandleMessage(Message msg) throws RemoteException { |
| 79 | switch (msg.what) { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 80 | case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 81 | SomeArgs args = (SomeArgs) msg.obj; |
| 82 | try { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 83 | mDelegate.handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 84 | (String) args.arg1, |
| 85 | (ConnectionRequest) args.arg2, |
| 86 | (ParcelableConnection) args.arg3); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 87 | } finally { |
| 88 | args.recycle(); |
| 89 | } |
| 90 | break; |
| 91 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 92 | case MSG_SET_ACTIVE: |
| 93 | mDelegate.setActive((String) msg.obj); |
| 94 | break; |
| 95 | case MSG_SET_RINGING: |
| 96 | mDelegate.setRinging((String) msg.obj); |
| 97 | break; |
| 98 | case MSG_SET_DIALING: |
| 99 | mDelegate.setDialing((String) msg.obj); |
| 100 | break; |
| 101 | case MSG_SET_DISCONNECTED: { |
| 102 | SomeArgs args = (SomeArgs) msg.obj; |
| 103 | try { |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 104 | mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 105 | } finally { |
| 106 | args.recycle(); |
| 107 | } |
| 108 | break; |
| 109 | } |
| 110 | case MSG_SET_ON_HOLD: |
| 111 | mDelegate.setOnHold((String) msg.obj); |
| 112 | break; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 113 | case MSG_SET_RINGBACK_REQUESTED: |
| 114 | mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 115 | break; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 116 | case MSG_SET_CONNECTION_CAPABILITIES: |
| 117 | mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 118 | break; |
| 119 | case MSG_SET_IS_CONFERENCED: { |
| 120 | SomeArgs args = (SomeArgs) msg.obj; |
| 121 | try { |
| 122 | mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2); |
| 123 | } finally { |
| 124 | args.recycle(); |
| 125 | } |
| 126 | break; |
| 127 | } |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 128 | case MSG_ADD_CONFERENCE_CALL: { |
| 129 | SomeArgs args = (SomeArgs) msg.obj; |
| 130 | try { |
| 131 | mDelegate.addConferenceCall( |
| 132 | (String) args.arg1, (ParcelableConference) args.arg2); |
| 133 | } finally { |
| 134 | args.recycle(); |
| 135 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 136 | break; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 137 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 138 | case MSG_REMOVE_CALL: |
| 139 | mDelegate.removeCall((String) msg.obj); |
| 140 | break; |
| 141 | case MSG_ON_POST_DIAL_WAIT: { |
| 142 | SomeArgs args = (SomeArgs) msg.obj; |
| 143 | try { |
| 144 | mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2); |
| 145 | } finally { |
| 146 | args.recycle(); |
| 147 | } |
| 148 | break; |
| 149 | } |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 150 | case MSG_ON_POST_DIAL_CHAR: { |
| 151 | SomeArgs args = (SomeArgs) msg.obj; |
| 152 | try { |
| 153 | mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1); |
| 154 | } finally { |
| 155 | args.recycle(); |
| 156 | } |
| 157 | break; |
| 158 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 159 | case MSG_QUERY_REMOTE_CALL_SERVICES: |
| 160 | mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) msg.obj); |
| 161 | break; |
| 162 | case MSG_SET_VIDEO_STATE: |
| 163 | mDelegate.setVideoState((String) msg.obj, msg.arg1); |
| 164 | break; |
| 165 | case MSG_SET_VIDEO_CALL_PROVIDER: { |
| 166 | SomeArgs args = (SomeArgs) msg.obj; |
| 167 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 168 | mDelegate.setVideoProvider((String) args.arg1, |
| 169 | (IVideoProvider) args.arg2); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 170 | } finally { |
| 171 | args.recycle(); |
| 172 | } |
| 173 | break; |
| 174 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 175 | case MSG_SET_IS_VOIP_AUDIO_MODE: |
| 176 | mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 177 | break; |
| 178 | case MSG_SET_STATUS_HINTS: { |
| 179 | SomeArgs args = (SomeArgs) msg.obj; |
| 180 | try { |
| 181 | mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2); |
| 182 | } finally { |
| 183 | args.recycle(); |
| 184 | } |
| 185 | break; |
| 186 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 187 | case MSG_SET_ADDRESS: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 188 | SomeArgs args = (SomeArgs) msg.obj; |
| 189 | try { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 190 | mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 191 | } finally { |
| 192 | args.recycle(); |
| 193 | } |
| 194 | break; |
| 195 | } |
| 196 | case MSG_SET_CALLER_DISPLAY_NAME: { |
| 197 | SomeArgs args = (SomeArgs) msg.obj; |
| 198 | try { |
| 199 | mDelegate.setCallerDisplayName( |
| 200 | (String) args.arg1, (String) args.arg2, args.argi1); |
| 201 | } finally { |
| 202 | args.recycle(); |
| 203 | } |
| 204 | break; |
| 205 | } |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 206 | case MSG_SET_CONFERENCEABLE_CONNECTIONS: { |
| 207 | SomeArgs args = (SomeArgs) msg.obj; |
| 208 | try { |
| 209 | mDelegate.setConferenceableConnections( |
| 210 | (String) args.arg1, (List<String>) args.arg2); |
| 211 | } finally { |
| 212 | args.recycle(); |
| 213 | } |
| 214 | break; |
| 215 | } |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 216 | case MSG_ADD_EXISTING_CONNECTION: { |
| 217 | SomeArgs args = (SomeArgs) msg.obj; |
| 218 | try { |
| 219 | mDelegate.addExistingConnection( |
| 220 | (String) args.arg1, (ParcelableConnection) args.arg2); |
| 221 | } finally { |
| 222 | args.recycle(); |
| 223 | } |
| 224 | break; |
| 225 | } |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 226 | case MSG_SET_CONFERENCE_MERGE_FAILED: { |
| 227 | SomeArgs args = (SomeArgs) msg.obj; |
| 228 | try { |
| 229 | mDelegate.setConferenceMergeFailed((String) args.arg1); |
| 230 | } finally { |
| 231 | args.recycle(); |
| 232 | } |
| 233 | break; |
| 234 | } |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame^] | 235 | case MSG_SET_EXTRAS: { |
| 236 | SomeArgs args = (SomeArgs) msg.obj; |
| 237 | try { |
| 238 | mDelegate.setExtras((String) args.arg1, (Bundle) args.arg2); |
| 239 | } finally { |
| 240 | args.recycle(); |
| 241 | } |
| 242 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 243 | } |
| 244 | } |
| 245 | }; |
| 246 | |
| 247 | private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() { |
| 248 | @Override |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 249 | public void handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 250 | String id, |
| 251 | ConnectionRequest request, |
| 252 | ParcelableConnection connection) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 253 | SomeArgs args = SomeArgs.obtain(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 254 | args.arg1 = id; |
| 255 | args.arg2 = request; |
| 256 | args.arg3 = connection; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 257 | mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 258 | } |
| 259 | |
| 260 | @Override |
| 261 | public void setActive(String connectionId) { |
| 262 | mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget(); |
| 263 | } |
| 264 | |
| 265 | @Override |
| 266 | public void setRinging(String connectionId) { |
| 267 | mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget(); |
| 268 | } |
| 269 | |
| 270 | @Override |
| 271 | public void setDialing(String connectionId) { |
| 272 | mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget(); |
| 273 | } |
| 274 | |
| 275 | @Override |
| 276 | public void setDisconnected( |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 277 | String connectionId, DisconnectCause disconnectCause) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 278 | SomeArgs args = SomeArgs.obtain(); |
| 279 | args.arg1 = connectionId; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 280 | args.arg2 = disconnectCause; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 281 | mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget(); |
| 282 | } |
| 283 | |
| 284 | @Override |
| 285 | public void setOnHold(String connectionId) { |
| 286 | mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget(); |
| 287 | } |
| 288 | |
| 289 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 290 | public void setRingbackRequested(String connectionId, boolean ringback) { |
| 291 | mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 292 | .sendToTarget(); |
| 293 | } |
| 294 | |
| 295 | @Override |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 296 | public void setConnectionCapabilities(String connectionId, int connectionCapabilities) { |
| 297 | mHandler.obtainMessage( |
| 298 | MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 299 | .sendToTarget(); |
| 300 | } |
| 301 | |
| 302 | @Override |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 303 | public void setConferenceMergeFailed(String callId) { |
| 304 | SomeArgs args = SomeArgs.obtain(); |
| 305 | args.arg1 = callId; |
| 306 | mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget(); |
| 307 | } |
| 308 | |
| 309 | @Override |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 310 | public void setIsConferenced(String callId, String conferenceCallId) { |
| 311 | SomeArgs args = SomeArgs.obtain(); |
| 312 | args.arg1 = callId; |
| 313 | args.arg2 = conferenceCallId; |
| 314 | mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget(); |
| 315 | } |
| 316 | |
| 317 | @Override |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 318 | public void addConferenceCall(String callId, ParcelableConference parcelableConference) { |
| 319 | SomeArgs args = SomeArgs.obtain(); |
| 320 | args.arg1 = callId; |
| 321 | args.arg2 = parcelableConference; |
| 322 | mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | @Override |
| 326 | public void removeCall(String connectionId) { |
| 327 | mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget(); |
| 328 | } |
| 329 | |
| 330 | @Override |
| 331 | public void onPostDialWait(String connectionId, String remainingDigits) { |
| 332 | SomeArgs args = SomeArgs.obtain(); |
| 333 | args.arg1 = connectionId; |
| 334 | args.arg2 = remainingDigits; |
| 335 | mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget(); |
| 336 | } |
| 337 | |
| 338 | @Override |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 339 | public void onPostDialChar(String connectionId, char nextChar) { |
| 340 | SomeArgs args = SomeArgs.obtain(); |
| 341 | args.arg1 = connectionId; |
| 342 | args.argi1 = nextChar; |
| 343 | mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget(); |
| 344 | } |
| 345 | |
| 346 | @Override |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 347 | public void queryRemoteConnectionServices(RemoteServiceCallback callback) { |
| 348 | mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, callback).sendToTarget(); |
| 349 | } |
| 350 | |
| 351 | @Override |
| 352 | public void setVideoState(String connectionId, int videoState) { |
| 353 | mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget(); |
| 354 | } |
| 355 | |
| 356 | @Override |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 357 | public void setVideoProvider(String connectionId, IVideoProvider videoProvider) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 358 | SomeArgs args = SomeArgs.obtain(); |
| 359 | args.arg1 = connectionId; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 360 | args.arg2 = videoProvider; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 361 | mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget(); |
| 362 | } |
| 363 | |
| 364 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 365 | public final void setIsVoipAudioMode(String connectionId, boolean isVoip) { |
| 366 | mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0, |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 367 | connectionId).sendToTarget(); |
| 368 | } |
| 369 | |
| 370 | @Override |
| 371 | public final void setStatusHints(String connectionId, StatusHints statusHints) { |
| 372 | SomeArgs args = SomeArgs.obtain(); |
| 373 | args.arg1 = connectionId; |
| 374 | args.arg2 = statusHints; |
| 375 | mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget(); |
| 376 | } |
| 377 | |
| 378 | @Override |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 379 | public final void setAddress(String connectionId, Uri address, int presentation) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 380 | SomeArgs args = SomeArgs.obtain(); |
| 381 | args.arg1 = connectionId; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 382 | args.arg2 = address; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 383 | args.argi1 = presentation; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 384 | mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public final void setCallerDisplayName( |
| 389 | String connectionId, String callerDisplayName, int presentation) { |
| 390 | SomeArgs args = SomeArgs.obtain(); |
| 391 | args.arg1 = connectionId; |
| 392 | args.arg2 = callerDisplayName; |
| 393 | args.argi1 = presentation; |
| 394 | mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget(); |
| 395 | } |
| 396 | |
| 397 | @Override |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 398 | public final void setConferenceableConnections( |
| 399 | String connectionId, List<String> conferenceableConnectionIds) { |
| 400 | SomeArgs args = SomeArgs.obtain(); |
| 401 | args.arg1 = connectionId; |
| 402 | args.arg2 = conferenceableConnectionIds; |
| 403 | mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget(); |
| 404 | } |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 405 | |
| 406 | @Override |
| 407 | public final void addExistingConnection( |
| 408 | String connectionId, ParcelableConnection connection) { |
| 409 | SomeArgs args = SomeArgs.obtain(); |
| 410 | args.arg1 = connectionId; |
| 411 | args.arg2 = connection; |
| 412 | mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget(); |
| 413 | } |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame^] | 414 | |
| 415 | @Override |
| 416 | public final void setExtras(String connectionId, Bundle extras) { |
| 417 | SomeArgs args = SomeArgs.obtain(); |
| 418 | args.arg1 = connectionId; |
| 419 | args.arg2 = extras; |
| 420 | mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget(); |
| 421 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 422 | }; |
| 423 | |
| 424 | public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) { |
| 425 | mDelegate = delegate; |
| 426 | } |
| 427 | |
| 428 | public IConnectionServiceAdapter getStub() { |
| 429 | return mStub; |
| 430 | } |
| 431 | } |