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