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