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