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