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