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