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; |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 24 | import android.telecom.Logging.Session; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 25 | |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 26 | import com.android.internal.os.SomeArgs; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 27 | import com.android.internal.telecom.IConnectionServiceAdapter; |
| 28 | import com.android.internal.telecom.IVideoProvider; |
| 29 | import com.android.internal.telecom.RemoteServiceCallback; |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 30 | |
| 31 | import java.util.List; |
| 32 | |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 33 | /** |
| 34 | * A component that provides an RPC servant implementation of {@link IConnectionServiceAdapter}, |
| 35 | * posting incoming messages on the main thread on a client-supplied delegate object. |
| 36 | * |
| 37 | * TODO: Generate this and similar classes using a compiler starting from AIDL interfaces. |
| 38 | * |
| 39 | * @hide |
| 40 | */ |
| 41 | final class ConnectionServiceAdapterServant { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 42 | private static final int MSG_HANDLE_CREATE_CONNECTION_COMPLETE = 1; |
| 43 | private static final int MSG_SET_ACTIVE = 2; |
| 44 | private static final int MSG_SET_RINGING = 3; |
| 45 | private static final int MSG_SET_DIALING = 4; |
| 46 | private static final int MSG_SET_DISCONNECTED = 5; |
| 47 | private static final int MSG_SET_ON_HOLD = 6; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 48 | private static final int MSG_SET_RINGBACK_REQUESTED = 7; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 49 | private static final int MSG_SET_CONNECTION_CAPABILITIES = 8; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 50 | private static final int MSG_SET_IS_CONFERENCED = 9; |
| 51 | private static final int MSG_ADD_CONFERENCE_CALL = 10; |
| 52 | private static final int MSG_REMOVE_CALL = 11; |
| 53 | private static final int MSG_ON_POST_DIAL_WAIT = 12; |
| 54 | private static final int MSG_QUERY_REMOTE_CALL_SERVICES = 13; |
| 55 | private static final int MSG_SET_VIDEO_STATE = 14; |
| 56 | private static final int MSG_SET_VIDEO_CALL_PROVIDER = 15; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 57 | private static final int MSG_SET_IS_VOIP_AUDIO_MODE = 16; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 58 | private static final int MSG_SET_STATUS_HINTS = 17; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 59 | private static final int MSG_SET_ADDRESS = 18; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 60 | private static final int MSG_SET_CALLER_DISPLAY_NAME = 19; |
Evan Charlton | 23dc241 | 2014-09-03 10:07:03 -0700 | [diff] [blame] | 61 | private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20; |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 62 | private static final int MSG_ADD_EXISTING_CONNECTION = 21; |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 63 | private static final int MSG_ON_POST_DIAL_CHAR = 22; |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 64 | private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23; |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 65 | private static final int MSG_PUT_EXTRAS = 24; |
| 66 | private static final int MSG_REMOVE_EXTRAS = 25; |
| 67 | private static final int MSG_ON_CONNECTION_EVENT = 26; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 68 | private static final int MSG_SET_CONNECTION_PROPERTIES = 27; |
Tyler Gunn | c96b5e0 | 2016-07-07 22:53:57 -0700 | [diff] [blame] | 69 | private static final int MSG_SET_PULLING = 28; |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 70 | private static final int MSG_SET_AUDIO_ROUTE = 29; |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 71 | private static final int MSG_ON_RTT_INITIATION_SUCCESS = 30; |
| 72 | private static final int MSG_ON_RTT_INITIATION_FAILURE = 31; |
| 73 | private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32; |
| 74 | private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33; |
Srikanth Chintala | fcb1501 | 2017-05-04 20:58:34 +0530 | [diff] [blame] | 75 | private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34; |
Pengquan Meng | 63d25a5 | 2017-11-21 18:01:13 -0800 | [diff] [blame] | 76 | private static final int MSG_CONNECTION_SERVICE_FOCUS_RELEASED = 35; |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 77 | private static final int MSG_SET_CONFERENCE_STATE = 36; |
Ravi Paluri | 80aa214 | 2019-12-02 11:57:37 +0530 | [diff] [blame] | 78 | private static final int MSG_HANDLE_CREATE_CONFERENCE_COMPLETE = 37; |
Brad Ebinger | 31774ae | 2020-04-08 16:25:12 -0700 | [diff] [blame] | 79 | private static final int MSG_SET_CALL_DIRECTION = 38; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 80 | |
| 81 | private final IConnectionServiceAdapter mDelegate; |
| 82 | |
| 83 | private final Handler mHandler = new Handler() { |
| 84 | @Override |
| 85 | public void handleMessage(Message msg) { |
| 86 | try { |
| 87 | internalHandleMessage(msg); |
| 88 | } catch (RemoteException e) { |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | // Internal method defined to centralize handling of RemoteException |
| 93 | private void internalHandleMessage(Message msg) throws RemoteException { |
| 94 | switch (msg.what) { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 95 | case MSG_HANDLE_CREATE_CONNECTION_COMPLETE: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 96 | SomeArgs args = (SomeArgs) msg.obj; |
| 97 | try { |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 98 | mDelegate.handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 99 | (String) args.arg1, |
| 100 | (ConnectionRequest) args.arg2, |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 101 | (ParcelableConnection) args.arg3, |
| 102 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 103 | } finally { |
| 104 | args.recycle(); |
| 105 | } |
| 106 | break; |
| 107 | } |
Ravi Paluri | 80aa214 | 2019-12-02 11:57:37 +0530 | [diff] [blame] | 108 | case MSG_HANDLE_CREATE_CONFERENCE_COMPLETE: { |
| 109 | SomeArgs args = (SomeArgs) msg.obj; |
| 110 | try { |
| 111 | mDelegate.handleCreateConferenceComplete( |
| 112 | (String) args.arg1, |
| 113 | (ConnectionRequest) args.arg2, |
| 114 | (ParcelableConference) args.arg3, |
| 115 | null /*Session.Info*/); |
| 116 | } finally { |
| 117 | args.recycle(); |
| 118 | } |
| 119 | break; |
| 120 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 121 | case MSG_SET_ACTIVE: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 122 | mDelegate.setActive((String) msg.obj, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 123 | break; |
| 124 | case MSG_SET_RINGING: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 125 | mDelegate.setRinging((String) msg.obj, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 126 | break; |
| 127 | case MSG_SET_DIALING: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 128 | mDelegate.setDialing((String) msg.obj, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 129 | break; |
Tyler Gunn | c96b5e0 | 2016-07-07 22:53:57 -0700 | [diff] [blame] | 130 | case MSG_SET_PULLING: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 131 | mDelegate.setPulling((String) msg.obj, null /*Session.Info*/); |
Tyler Gunn | c96b5e0 | 2016-07-07 22:53:57 -0700 | [diff] [blame] | 132 | break; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 133 | case MSG_SET_DISCONNECTED: { |
| 134 | SomeArgs args = (SomeArgs) msg.obj; |
| 135 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 136 | mDelegate.setDisconnected((String) args.arg1, (DisconnectCause) args.arg2, |
| 137 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 138 | } finally { |
| 139 | args.recycle(); |
| 140 | } |
| 141 | break; |
| 142 | } |
| 143 | case MSG_SET_ON_HOLD: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 144 | mDelegate.setOnHold((String) msg.obj, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 145 | break; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 146 | case MSG_SET_RINGBACK_REQUESTED: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 147 | mDelegate.setRingbackRequested((String) msg.obj, msg.arg1 == 1, |
| 148 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 149 | break; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 150 | case MSG_SET_CONNECTION_CAPABILITIES: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 151 | mDelegate.setConnectionCapabilities((String) msg.obj, msg.arg1, |
| 152 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 153 | break; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 154 | case MSG_SET_CONNECTION_PROPERTIES: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 155 | mDelegate.setConnectionProperties((String) msg.obj, msg.arg1, |
| 156 | null /*Session.Info*/); |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 157 | break; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 158 | case MSG_SET_IS_CONFERENCED: { |
| 159 | SomeArgs args = (SomeArgs) msg.obj; |
| 160 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 161 | mDelegate.setIsConferenced((String) args.arg1, (String) args.arg2, |
| 162 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 163 | } finally { |
| 164 | args.recycle(); |
| 165 | } |
| 166 | break; |
| 167 | } |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 168 | case MSG_ADD_CONFERENCE_CALL: { |
| 169 | SomeArgs args = (SomeArgs) msg.obj; |
| 170 | try { |
| 171 | mDelegate.addConferenceCall( |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 172 | (String) args.arg1, (ParcelableConference) args.arg2, |
| 173 | null /*Session.Info*/); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 174 | } finally { |
| 175 | args.recycle(); |
| 176 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 177 | break; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 178 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 179 | case MSG_REMOVE_CALL: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 180 | mDelegate.removeCall((String) msg.obj, |
| 181 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 182 | break; |
| 183 | case MSG_ON_POST_DIAL_WAIT: { |
| 184 | SomeArgs args = (SomeArgs) msg.obj; |
| 185 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 186 | mDelegate.onPostDialWait((String) args.arg1, (String) args.arg2, |
| 187 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 188 | } finally { |
| 189 | args.recycle(); |
| 190 | } |
| 191 | break; |
| 192 | } |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 193 | case MSG_ON_POST_DIAL_CHAR: { |
| 194 | SomeArgs args = (SomeArgs) msg.obj; |
| 195 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 196 | mDelegate.onPostDialChar((String) args.arg1, (char) args.argi1, |
| 197 | null /*Session.Info*/); |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 198 | } finally { |
| 199 | args.recycle(); |
| 200 | } |
| 201 | break; |
| 202 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 203 | case MSG_QUERY_REMOTE_CALL_SERVICES: |
Tyler Gunn | 4c69fb3 | 2019-05-17 10:49:16 -0700 | [diff] [blame] | 204 | SomeArgs args2 = (SomeArgs) msg.obj; |
| 205 | try { |
| 206 | mDelegate.queryRemoteConnectionServices((RemoteServiceCallback) args2.arg1, |
| 207 | (String) args2.arg2, null /*Session.Info*/); |
| 208 | } finally { |
| 209 | args2.recycle(); |
| 210 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 211 | break; |
| 212 | case MSG_SET_VIDEO_STATE: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 213 | mDelegate.setVideoState((String) msg.obj, msg.arg1, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 214 | break; |
| 215 | case MSG_SET_VIDEO_CALL_PROVIDER: { |
| 216 | SomeArgs args = (SomeArgs) msg.obj; |
| 217 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 218 | mDelegate.setVideoProvider((String) args.arg1, |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 219 | (IVideoProvider) args.arg2, null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 220 | } finally { |
| 221 | args.recycle(); |
| 222 | } |
| 223 | break; |
| 224 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 225 | case MSG_SET_IS_VOIP_AUDIO_MODE: |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 226 | mDelegate.setIsVoipAudioMode((String) msg.obj, msg.arg1 == 1, |
| 227 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 228 | break; |
| 229 | case MSG_SET_STATUS_HINTS: { |
| 230 | SomeArgs args = (SomeArgs) msg.obj; |
| 231 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 232 | mDelegate.setStatusHints((String) args.arg1, (StatusHints) args.arg2, |
| 233 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 234 | } finally { |
| 235 | args.recycle(); |
| 236 | } |
| 237 | break; |
| 238 | } |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 239 | case MSG_SET_ADDRESS: { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 240 | SomeArgs args = (SomeArgs) msg.obj; |
| 241 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 242 | mDelegate.setAddress((String) args.arg1, (Uri) args.arg2, args.argi1, |
| 243 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 244 | } finally { |
| 245 | args.recycle(); |
| 246 | } |
| 247 | break; |
| 248 | } |
| 249 | case MSG_SET_CALLER_DISPLAY_NAME: { |
| 250 | SomeArgs args = (SomeArgs) msg.obj; |
| 251 | try { |
| 252 | mDelegate.setCallerDisplayName( |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 253 | (String) args.arg1, (String) args.arg2, args.argi1, |
| 254 | null /*Session.Info*/); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 255 | } finally { |
| 256 | args.recycle(); |
| 257 | } |
| 258 | break; |
| 259 | } |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 260 | case MSG_SET_CONFERENCEABLE_CONNECTIONS: { |
| 261 | SomeArgs args = (SomeArgs) msg.obj; |
| 262 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 263 | mDelegate.setConferenceableConnections((String) args.arg1, |
| 264 | (List<String>) args.arg2, null /*Session.Info*/); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 265 | } finally { |
| 266 | args.recycle(); |
| 267 | } |
| 268 | break; |
| 269 | } |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 270 | case MSG_ADD_EXISTING_CONNECTION: { |
| 271 | SomeArgs args = (SomeArgs) msg.obj; |
| 272 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 273 | mDelegate.addExistingConnection((String) args.arg1, |
| 274 | (ParcelableConnection) args.arg2, null /*Session.Info*/); |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 275 | } finally { |
| 276 | args.recycle(); |
| 277 | } |
| 278 | break; |
| 279 | } |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 280 | case MSG_SET_CONFERENCE_MERGE_FAILED: { |
| 281 | SomeArgs args = (SomeArgs) msg.obj; |
| 282 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 283 | mDelegate.setConferenceMergeFailed((String) args.arg1, |
| 284 | null /*Session.Info*/); |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 285 | } finally { |
| 286 | args.recycle(); |
| 287 | } |
| 288 | break; |
| 289 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 290 | case MSG_PUT_EXTRAS: { |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 291 | SomeArgs args = (SomeArgs) msg.obj; |
| 292 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 293 | mDelegate.putExtras((String) args.arg1, (Bundle) args.arg2, |
| 294 | null /*Session.Info*/); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 295 | } finally { |
| 296 | args.recycle(); |
| 297 | } |
| 298 | break; |
| 299 | } |
| 300 | case MSG_REMOVE_EXTRAS: { |
| 301 | SomeArgs args = (SomeArgs) msg.obj; |
| 302 | try { |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 303 | mDelegate.removeExtras((String) args.arg1, (List<String>) args.arg2, |
| 304 | null /*Session.Info*/); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 305 | } finally { |
| 306 | args.recycle(); |
| 307 | } |
Tyler Gunn | 86c9fb4 | 2016-02-24 13:17:21 -0800 | [diff] [blame] | 308 | break; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 309 | } |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 310 | case MSG_ON_CONNECTION_EVENT: { |
| 311 | SomeArgs args = (SomeArgs) msg.obj; |
| 312 | try { |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 313 | mDelegate.onConnectionEvent((String) args.arg1, (String) args.arg2, |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 314 | (Bundle) args.arg3, null /*Session.Info*/); |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 315 | } finally { |
| 316 | args.recycle(); |
| 317 | } |
Tyler Gunn | 86c9fb4 | 2016-02-24 13:17:21 -0800 | [diff] [blame] | 318 | break; |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 319 | } |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 320 | case MSG_SET_AUDIO_ROUTE: { |
| 321 | SomeArgs args = (SomeArgs) msg.obj; |
| 322 | try { |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 323 | mDelegate.setAudioRoute((String) args.arg1, args.argi1, (String) args.arg2, |
| 324 | (Session.Info) args.arg3); |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 325 | } finally { |
| 326 | args.recycle(); |
| 327 | } |
| 328 | break; |
| 329 | } |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 330 | case MSG_ON_RTT_INITIATION_SUCCESS: |
| 331 | mDelegate.onRttInitiationSuccess((String) msg.obj, null /*Session.Info*/); |
| 332 | break; |
| 333 | case MSG_ON_RTT_INITIATION_FAILURE: |
| 334 | mDelegate.onRttInitiationFailure((String) msg.obj, msg.arg1, |
| 335 | null /*Session.Info*/); |
| 336 | break; |
| 337 | case MSG_ON_RTT_REMOTELY_TERMINATED: |
| 338 | mDelegate.onRttSessionRemotelyTerminated((String) msg.obj, |
| 339 | null /*Session.Info*/); |
| 340 | break; |
| 341 | case MSG_ON_RTT_UPGRADE_REQUEST: |
| 342 | mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/); |
| 343 | break; |
Srikanth Chintala | fcb1501 | 2017-05-04 20:58:34 +0530 | [diff] [blame] | 344 | case MSG_SET_PHONE_ACCOUNT_CHANGED: { |
| 345 | SomeArgs args = (SomeArgs) msg.obj; |
| 346 | try { |
| 347 | mDelegate.onPhoneAccountChanged((String) args.arg1, |
| 348 | (PhoneAccountHandle) args.arg2, null /*Session.Info*/); |
| 349 | } finally { |
| 350 | args.recycle(); |
| 351 | } |
| 352 | break; |
| 353 | } |
Pengquan Meng | 63d25a5 | 2017-11-21 18:01:13 -0800 | [diff] [blame] | 354 | case MSG_CONNECTION_SERVICE_FOCUS_RELEASED: |
| 355 | mDelegate.onConnectionServiceFocusReleased(null /*Session.Info*/); |
| 356 | break; |
Brad Ebinger | 31774ae | 2020-04-08 16:25:12 -0700 | [diff] [blame] | 357 | case MSG_SET_CONFERENCE_STATE: { |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 358 | SomeArgs args = (SomeArgs) msg.obj; |
| 359 | try { |
| 360 | mDelegate.setConferenceState((String) args.arg1, (Boolean) args.arg2, |
| 361 | (Session.Info) args.arg3); |
| 362 | } finally { |
| 363 | args.recycle(); |
| 364 | } |
Brad Ebinger | 31774ae | 2020-04-08 16:25:12 -0700 | [diff] [blame] | 365 | break; |
| 366 | } |
| 367 | case MSG_SET_CALL_DIRECTION: { |
| 368 | SomeArgs args = (SomeArgs) msg.obj; |
| 369 | try { |
| 370 | mDelegate.setCallDirection((String) args.arg1, args.argi1, |
| 371 | (Session.Info) args.arg2); |
| 372 | } finally { |
| 373 | args.recycle(); |
| 374 | } |
| 375 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 376 | } |
| 377 | } |
| 378 | }; |
| 379 | |
| 380 | private final IConnectionServiceAdapter mStub = new IConnectionServiceAdapter.Stub() { |
| 381 | @Override |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 382 | public void handleCreateConnectionComplete( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 383 | String id, |
| 384 | ConnectionRequest request, |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 385 | ParcelableConnection connection, |
| 386 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 387 | SomeArgs args = SomeArgs.obtain(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 388 | args.arg1 = id; |
| 389 | args.arg2 = request; |
| 390 | args.arg3 = connection; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 391 | mHandler.obtainMessage(MSG_HANDLE_CREATE_CONNECTION_COMPLETE, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | @Override |
Ravi Paluri | 80aa214 | 2019-12-02 11:57:37 +0530 | [diff] [blame] | 395 | public void handleCreateConferenceComplete( |
| 396 | String id, |
| 397 | ConnectionRequest request, |
| 398 | ParcelableConference conference, |
| 399 | Session.Info sessionInfo) { |
| 400 | SomeArgs args = SomeArgs.obtain(); |
| 401 | args.arg1 = id; |
| 402 | args.arg2 = request; |
| 403 | args.arg3 = conference; |
| 404 | mHandler.obtainMessage(MSG_HANDLE_CREATE_CONFERENCE_COMPLETE, args).sendToTarget(); |
| 405 | } |
| 406 | |
| 407 | |
| 408 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 409 | public void setActive(String connectionId, Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 410 | mHandler.obtainMessage(MSG_SET_ACTIVE, connectionId).sendToTarget(); |
| 411 | } |
| 412 | |
| 413 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 414 | public void setRinging(String connectionId, Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 415 | mHandler.obtainMessage(MSG_SET_RINGING, connectionId).sendToTarget(); |
| 416 | } |
| 417 | |
| 418 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 419 | public void setDialing(String connectionId, Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 420 | mHandler.obtainMessage(MSG_SET_DIALING, connectionId).sendToTarget(); |
| 421 | } |
| 422 | |
| 423 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 424 | public void setPulling(String connectionId, Session.Info sessionInfo) { |
Tyler Gunn | c96b5e0 | 2016-07-07 22:53:57 -0700 | [diff] [blame] | 425 | mHandler.obtainMessage(MSG_SET_PULLING, connectionId).sendToTarget(); |
| 426 | } |
| 427 | |
| 428 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 429 | public void setDisconnected(String connectionId, DisconnectCause disconnectCause, |
| 430 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 431 | SomeArgs args = SomeArgs.obtain(); |
| 432 | args.arg1 = connectionId; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 433 | args.arg2 = disconnectCause; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 434 | mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget(); |
| 435 | } |
| 436 | |
| 437 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 438 | public void setOnHold(String connectionId, Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 439 | mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget(); |
| 440 | } |
| 441 | |
| 442 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 443 | public void setRingbackRequested(String connectionId, boolean ringback, |
| 444 | Session.Info sessionInfo) { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 445 | mHandler.obtainMessage(MSG_SET_RINGBACK_REQUESTED, ringback ? 1 : 0, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 446 | .sendToTarget(); |
| 447 | } |
| 448 | |
| 449 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 450 | public void setConnectionCapabilities(String connectionId, int connectionCapabilities, |
| 451 | Session.Info sessionInfo) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 452 | mHandler.obtainMessage( |
| 453 | MSG_SET_CONNECTION_CAPABILITIES, connectionCapabilities, 0, connectionId) |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 454 | .sendToTarget(); |
| 455 | } |
| 456 | |
| 457 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 458 | public void setConnectionProperties(String connectionId, int connectionProperties, |
| 459 | Session.Info sessionInfo) { |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 460 | mHandler.obtainMessage( |
| 461 | MSG_SET_CONNECTION_PROPERTIES, connectionProperties, 0, connectionId) |
| 462 | .sendToTarget(); |
| 463 | } |
| 464 | |
| 465 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 466 | public void setConferenceMergeFailed(String callId, Session.Info sessionInfo) { |
Anthony Lee | 17455a3 | 2015-04-24 15:25:29 -0700 | [diff] [blame] | 467 | SomeArgs args = SomeArgs.obtain(); |
| 468 | args.arg1 = callId; |
| 469 | mHandler.obtainMessage(MSG_SET_CONFERENCE_MERGE_FAILED, args).sendToTarget(); |
| 470 | } |
| 471 | |
| 472 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 473 | public void setIsConferenced(String callId, String conferenceCallId, |
| 474 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 475 | SomeArgs args = SomeArgs.obtain(); |
| 476 | args.arg1 = callId; |
| 477 | args.arg2 = conferenceCallId; |
| 478 | mHandler.obtainMessage(MSG_SET_IS_CONFERENCED, args).sendToTarget(); |
| 479 | } |
| 480 | |
| 481 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 482 | public void addConferenceCall(String callId, ParcelableConference parcelableConference, |
| 483 | Session.Info sessionInfo) { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 484 | SomeArgs args = SomeArgs.obtain(); |
| 485 | args.arg1 = callId; |
| 486 | args.arg2 = parcelableConference; |
| 487 | mHandler.obtainMessage(MSG_ADD_CONFERENCE_CALL, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 491 | public void removeCall(String connectionId, |
| 492 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 493 | mHandler.obtainMessage(MSG_REMOVE_CALL, connectionId).sendToTarget(); |
| 494 | } |
| 495 | |
| 496 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 497 | public void onPostDialWait(String connectionId, String remainingDigits, |
| 498 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 499 | SomeArgs args = SomeArgs.obtain(); |
| 500 | args.arg1 = connectionId; |
| 501 | args.arg2 = remainingDigits; |
| 502 | mHandler.obtainMessage(MSG_ON_POST_DIAL_WAIT, args).sendToTarget(); |
| 503 | } |
| 504 | |
| 505 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 506 | public void onPostDialChar(String connectionId, char nextChar, |
| 507 | Session.Info sessionInfo) { |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 508 | SomeArgs args = SomeArgs.obtain(); |
| 509 | args.arg1 = connectionId; |
| 510 | args.argi1 = nextChar; |
| 511 | mHandler.obtainMessage(MSG_ON_POST_DIAL_CHAR, args).sendToTarget(); |
| 512 | } |
| 513 | |
| 514 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 515 | public void queryRemoteConnectionServices(RemoteServiceCallback callback, |
Tyler Gunn | 4c69fb3 | 2019-05-17 10:49:16 -0700 | [diff] [blame] | 516 | String callingPackage, Session.Info sessionInfo) { |
| 517 | SomeArgs args = SomeArgs.obtain(); |
| 518 | args.arg1 = callback; |
| 519 | args.arg2 = callingPackage; |
Tyler Gunn | 156a33b | 2019-05-30 16:52:28 -0700 | [diff] [blame] | 520 | mHandler.obtainMessage(MSG_QUERY_REMOTE_CALL_SERVICES, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 521 | } |
| 522 | |
| 523 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 524 | public void setVideoState(String connectionId, int videoState, |
| 525 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 526 | mHandler.obtainMessage(MSG_SET_VIDEO_STATE, videoState, 0, connectionId).sendToTarget(); |
| 527 | } |
| 528 | |
| 529 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 530 | public void setVideoProvider(String connectionId, IVideoProvider videoProvider, |
| 531 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 532 | SomeArgs args = SomeArgs.obtain(); |
| 533 | args.arg1 = connectionId; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 534 | args.arg2 = videoProvider; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 535 | mHandler.obtainMessage(MSG_SET_VIDEO_CALL_PROVIDER, args).sendToTarget(); |
| 536 | } |
| 537 | |
| 538 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 539 | public final void setIsVoipAudioMode(String connectionId, boolean isVoip, |
| 540 | Session.Info sessionInfo) { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 541 | mHandler.obtainMessage(MSG_SET_IS_VOIP_AUDIO_MODE, isVoip ? 1 : 0, 0, |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 542 | connectionId).sendToTarget(); |
| 543 | } |
| 544 | |
| 545 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 546 | public final void setStatusHints(String connectionId, StatusHints statusHints, |
| 547 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 548 | SomeArgs args = SomeArgs.obtain(); |
| 549 | args.arg1 = connectionId; |
| 550 | args.arg2 = statusHints; |
| 551 | mHandler.obtainMessage(MSG_SET_STATUS_HINTS, args).sendToTarget(); |
| 552 | } |
| 553 | |
| 554 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 555 | public final void setAddress(String connectionId, Uri address, int presentation, |
| 556 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 557 | SomeArgs args = SomeArgs.obtain(); |
| 558 | args.arg1 = connectionId; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 559 | args.arg2 = address; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 560 | args.argi1 = presentation; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 561 | mHandler.obtainMessage(MSG_SET_ADDRESS, args).sendToTarget(); |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 562 | } |
| 563 | |
| 564 | @Override |
| 565 | public final void setCallerDisplayName( |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 566 | String connectionId, String callerDisplayName, int presentation, |
| 567 | Session.Info sessionInfo) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 568 | SomeArgs args = SomeArgs.obtain(); |
| 569 | args.arg1 = connectionId; |
| 570 | args.arg2 = callerDisplayName; |
| 571 | args.argi1 = presentation; |
| 572 | mHandler.obtainMessage(MSG_SET_CALLER_DISPLAY_NAME, args).sendToTarget(); |
| 573 | } |
| 574 | |
| 575 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 576 | public final void setConferenceableConnections(String connectionId, |
| 577 | List<String> conferenceableConnectionIds, Session.Info sessionInfo) { |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 578 | SomeArgs args = SomeArgs.obtain(); |
| 579 | args.arg1 = connectionId; |
| 580 | args.arg2 = conferenceableConnectionIds; |
| 581 | mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget(); |
| 582 | } |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 583 | |
| 584 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 585 | public final void addExistingConnection(String connectionId, |
| 586 | ParcelableConnection connection, Session.Info sessionInfo) { |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 587 | SomeArgs args = SomeArgs.obtain(); |
| 588 | args.arg1 = connectionId; |
| 589 | args.arg2 = connection; |
| 590 | mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget(); |
| 591 | } |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 592 | |
| 593 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 594 | public final void putExtras(String connectionId, Bundle extras, Session.Info sessionInfo) { |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 595 | SomeArgs args = SomeArgs.obtain(); |
| 596 | args.arg1 = connectionId; |
| 597 | args.arg2 = extras; |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 598 | mHandler.obtainMessage(MSG_PUT_EXTRAS, args).sendToTarget(); |
| 599 | } |
| 600 | |
| 601 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 602 | public final void removeExtras(String connectionId, List<String> keys, |
| 603 | Session.Info sessionInfo) { |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 604 | SomeArgs args = SomeArgs.obtain(); |
| 605 | args.arg1 = connectionId; |
| 606 | args.arg2 = keys; |
| 607 | mHandler.obtainMessage(MSG_REMOVE_EXTRAS, args).sendToTarget(); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 608 | } |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 609 | |
| 610 | @Override |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 611 | public final void setAudioRoute(String connectionId, int audioRoute, |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 612 | String bluetoothAddress, Session.Info sessionInfo) { |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 613 | SomeArgs args = SomeArgs.obtain(); |
| 614 | args.arg1 = connectionId; |
| 615 | args.argi1 = audioRoute; |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 616 | args.arg2 = bluetoothAddress; |
| 617 | args.arg3 = sessionInfo; |
Tyler Gunn | f503543 | 2017-01-09 09:43:12 -0800 | [diff] [blame] | 618 | mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, args).sendToTarget(); |
| 619 | } |
| 620 | |
| 621 | @Override |
Brad Ebinger | 4d75bee | 2016-10-28 12:29:55 -0700 | [diff] [blame] | 622 | public final void onConnectionEvent(String connectionId, String event, Bundle extras, |
| 623 | Session.Info sessionInfo) { |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 624 | SomeArgs args = SomeArgs.obtain(); |
| 625 | args.arg1 = connectionId; |
| 626 | args.arg2 = event; |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 627 | args.arg3 = extras; |
Tyler Gunn | bd1eb1f | 2016-02-16 14:36:20 -0800 | [diff] [blame] | 628 | mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget(); |
| 629 | } |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 630 | |
| 631 | @Override |
| 632 | public void onRttInitiationSuccess(String connectionId, Session.Info sessionInfo) |
| 633 | throws RemoteException { |
| 634 | mHandler.obtainMessage(MSG_ON_RTT_INITIATION_SUCCESS, connectionId).sendToTarget(); |
| 635 | } |
| 636 | |
| 637 | @Override |
| 638 | public void onRttInitiationFailure(String connectionId, int reason, |
| 639 | Session.Info sessionInfo) |
| 640 | throws RemoteException { |
| 641 | mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, connectionId) |
| 642 | .sendToTarget(); |
| 643 | } |
| 644 | |
| 645 | @Override |
| 646 | public void onRttSessionRemotelyTerminated(String connectionId, Session.Info sessionInfo) |
| 647 | throws RemoteException { |
| 648 | mHandler.obtainMessage(MSG_ON_RTT_REMOTELY_TERMINATED, connectionId).sendToTarget(); |
| 649 | } |
| 650 | |
| 651 | @Override |
| 652 | public void onRemoteRttRequest(String connectionId, Session.Info sessionInfo) |
| 653 | throws RemoteException { |
| 654 | mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget(); |
| 655 | } |
Srikanth Chintala | fcb1501 | 2017-05-04 20:58:34 +0530 | [diff] [blame] | 656 | |
| 657 | @Override |
| 658 | public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle, |
| 659 | Session.Info sessionInfo) { |
| 660 | SomeArgs args = SomeArgs.obtain(); |
| 661 | args.arg1 = callId; |
| 662 | args.arg2 = pHandle; |
| 663 | mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget(); |
| 664 | } |
Pengquan Meng | 63d25a5 | 2017-11-21 18:01:13 -0800 | [diff] [blame] | 665 | |
| 666 | @Override |
| 667 | public void onConnectionServiceFocusReleased(Session.Info sessionInfo) { |
| 668 | mHandler.obtainMessage(MSG_CONNECTION_SERVICE_FOCUS_RELEASED).sendToTarget(); |
| 669 | } |
Mengjun Leng | 2570774 | 2017-07-04 11:10:37 +0800 | [diff] [blame] | 670 | |
| 671 | @Override |
| 672 | public void resetConnectionTime(String callId, Session.Info sessionInfo) { |
| 673 | // Do nothing |
| 674 | } |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 675 | |
| 676 | @Override |
| 677 | public void setConferenceState(String callId, boolean isConference, |
| 678 | Session.Info sessionInfo) { |
| 679 | SomeArgs args = SomeArgs.obtain(); |
| 680 | args.arg1 = callId; |
| 681 | args.arg2 = isConference; |
| 682 | args.arg3 = sessionInfo; |
| 683 | mHandler.obtainMessage(MSG_SET_CONFERENCE_STATE, args).sendToTarget(); |
| 684 | } |
Brad Ebinger | 31774ae | 2020-04-08 16:25:12 -0700 | [diff] [blame] | 685 | |
| 686 | @Override |
| 687 | public void setCallDirection(String callId, int direction, |
| 688 | Session.Info sessionInfo) { |
| 689 | SomeArgs args = SomeArgs.obtain(); |
| 690 | args.arg1 = callId; |
| 691 | args.argi1 = direction; |
| 692 | args.arg2 = sessionInfo; |
| 693 | mHandler.obtainMessage(MSG_SET_CALL_DIRECTION, args).sendToTarget(); |
| 694 | } |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 695 | }; |
| 696 | |
| 697 | public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) { |
| 698 | mDelegate = delegate; |
| 699 | } |
| 700 | |
| 701 | public IConnectionServiceAdapter getStub() { |
| 702 | return mStub; |
| 703 | } |
| 704 | } |