Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 1 | /* |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 2 | * Copyright (C) 2014 The Android Open Source Project |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 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 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.telecomm; |
| 18 | |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 19 | import android.content.ComponentName; |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame^] | 20 | import android.net.Uri; |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 21 | import android.os.IBinder; |
| 22 | import android.os.IBinder.DeathRecipient; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 23 | import android.os.RemoteException; |
| 24 | |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 25 | import com.android.internal.telecomm.IConnectionService; |
| 26 | import com.android.internal.telecomm.IConnectionServiceAdapter; |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 27 | import com.android.internal.telecomm.ICallVideoProvider; |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 28 | import com.android.internal.telecomm.RemoteServiceCallback; |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 29 | |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 30 | import java.util.ArrayList; |
| 31 | import java.util.HashSet; |
Sailesh Nepal | 4dd9df5 | 2014-07-10 18:15:15 -0700 | [diff] [blame] | 32 | import java.util.Iterator; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 33 | import java.util.List; |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 34 | import java.util.Set; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 35 | |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 36 | /** |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 37 | * Provides methods for IConnectionService implementations to interact with the system phone app. |
Sailesh Nepal | 2bed956 | 2014-07-02 21:26:12 -0700 | [diff] [blame] | 38 | * |
| 39 | * @hide |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 40 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 41 | final class ConnectionServiceAdapter implements DeathRecipient { |
| 42 | private final Set<IConnectionServiceAdapter> mAdapters = new HashSet<>(); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 43 | |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 44 | ConnectionServiceAdapter() { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 45 | } |
| 46 | |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 47 | void addAdapter(IConnectionServiceAdapter adapter) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 48 | if (mAdapters.add(adapter)) { |
| 49 | try { |
| 50 | adapter.asBinder().linkToDeath(this, 0); |
| 51 | } catch (RemoteException e) { |
| 52 | mAdapters.remove(adapter); |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 57 | void removeAdapter(IConnectionServiceAdapter adapter) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 58 | if (mAdapters.remove(adapter)) { |
| 59 | adapter.asBinder().unlinkToDeath(this, 0); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** ${inheritDoc} */ |
| 64 | @Override |
| 65 | public void binderDied() { |
Sailesh Nepal | 4dd9df5 | 2014-07-10 18:15:15 -0700 | [diff] [blame] | 66 | Iterator<IConnectionServiceAdapter> it = mAdapters.iterator(); |
| 67 | while (it.hasNext()) { |
| 68 | IConnectionServiceAdapter adapter = it.next(); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 69 | if (!adapter.asBinder().isBinderAlive()) { |
Sailesh Nepal | 4dd9df5 | 2014-07-10 18:15:15 -0700 | [diff] [blame] | 70 | it.remove(); |
| 71 | adapter.asBinder().unlinkToDeath(this, 0); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 72 | } |
| 73 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 74 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 75 | |
| 76 | /** |
Santos Cordon | b340c33 | 2014-02-19 01:59:32 -0800 | [diff] [blame] | 77 | * Provides Telecomm with the details of an incoming call. An invocation of this method must |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 78 | * follow {@link ConnectionService#setIncomingCallId} and use the call ID specified therein. |
| 79 | * Upon the invocation of this method, Telecomm will bring up the incoming-call interface where |
| 80 | * the user can elect to answer or reject a call. |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 81 | * |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 82 | * @param request The connection request. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 83 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 84 | void notifyIncomingCall(ConnectionRequest request) { |
| 85 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 86 | try { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 87 | adapter.notifyIncomingCall(request); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 88 | } catch (RemoteException e) { |
| 89 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 90 | } |
| 91 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 92 | |
| 93 | /** |
Santos Cordon | f6d868b | 2014-02-05 13:04:15 -0800 | [diff] [blame] | 94 | * Tells Telecomm that an attempt to place the specified outgoing call succeeded. |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 95 | * |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 96 | * @param request The originating request for a connection. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 97 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 98 | void handleSuccessfulOutgoingCall(ConnectionRequest request) { |
| 99 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 100 | try { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 101 | adapter.handleSuccessfulOutgoingCall(request); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 102 | } catch (RemoteException e) { |
| 103 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 104 | } |
| 105 | } |
Santos Cordon | f6d868b | 2014-02-05 13:04:15 -0800 | [diff] [blame] | 106 | |
| 107 | /** |
| 108 | * Tells Telecomm that an attempt to place the specified outgoing call failed. |
| 109 | * |
Ihab Awad | fc91b7d | 2014-06-03 18:40:45 -0700 | [diff] [blame] | 110 | * @param request The originating request for a connection. |
| 111 | * @param errorCode The error code associated with the failed call attempt. |
| 112 | * @param errorMsg The error message associated with the failed call attempt. |
Santos Cordon | f6d868b | 2014-02-05 13:04:15 -0800 | [diff] [blame] | 113 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 114 | void handleFailedOutgoingCall( |
Ihab Awad | fc91b7d | 2014-06-03 18:40:45 -0700 | [diff] [blame] | 115 | ConnectionRequest request, |
| 116 | int errorCode, |
| 117 | String errorMsg) { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 118 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 119 | try { |
| 120 | adapter.handleFailedOutgoingCall(request, errorCode, errorMsg); |
| 121 | } catch (RemoteException e) { |
| 122 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 123 | } |
| 124 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 125 | |
| 126 | /** |
Sailesh Nepal | 506e386 | 2014-06-25 13:35:14 -0700 | [diff] [blame] | 127 | * Tells Telecomm to cancel the call. |
| 128 | * |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 129 | * @param request The originating request for a connection. |
Sailesh Nepal | 506e386 | 2014-06-25 13:35:14 -0700 | [diff] [blame] | 130 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 131 | void cancelOutgoingCall(ConnectionRequest request) { |
| 132 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Sailesh Nepal | 506e386 | 2014-06-25 13:35:14 -0700 | [diff] [blame] | 133 | try { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 134 | adapter.cancelOutgoingCall(request); |
Sailesh Nepal | 506e386 | 2014-06-25 13:35:14 -0700 | [diff] [blame] | 135 | } catch (RemoteException e) { |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | /** |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 141 | * Sets a call's state to active (e.g., an ongoing call where two parties can actively |
| 142 | * communicate). |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 143 | * |
| 144 | * @param callId The unique ID of the call whose state is changing to active. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 145 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 146 | void setActive(String callId) { |
| 147 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 148 | try { |
| 149 | adapter.setActive(callId); |
| 150 | } catch (RemoteException e) { |
| 151 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 152 | } |
| 153 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 154 | |
| 155 | /** |
| 156 | * Sets a call's state to ringing (e.g., an inbound ringing call). |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 157 | * |
| 158 | * @param callId The unique ID of the call whose state is changing to ringing. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 159 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 160 | void setRinging(String callId) { |
| 161 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 162 | try { |
| 163 | adapter.setRinging(callId); |
| 164 | } catch (RemoteException e) { |
| 165 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 166 | } |
| 167 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 168 | |
| 169 | /** |
| 170 | * Sets a call's state to dialing (e.g., dialing an outbound call). |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 171 | * |
| 172 | * @param callId The unique ID of the call whose state is changing to dialing. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 173 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 174 | void setDialing(String callId) { |
| 175 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 176 | try { |
| 177 | adapter.setDialing(callId); |
| 178 | } catch (RemoteException e) { |
| 179 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 180 | } |
| 181 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 182 | |
| 183 | /** |
| 184 | * Sets a call's state to disconnected. |
Santos Cordon | 3784133 | 2013-12-17 13:30:53 -0800 | [diff] [blame] | 185 | * |
| 186 | * @param callId The unique ID of the call whose state is changing to disconnected. |
Santos Cordon | 20e3f02 | 2014-03-27 12:15:38 -0700 | [diff] [blame] | 187 | * @param disconnectCause The reason for the disconnection, any of |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 188 | * {@link android.telephony.DisconnectCause}. |
Santos Cordon | 20e3f02 | 2014-03-27 12:15:38 -0700 | [diff] [blame] | 189 | * @param disconnectMessage Optional call-service-provided message about the disconnect. |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 190 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 191 | void setDisconnected(String callId, int disconnectCause, String disconnectMessage) { |
| 192 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 193 | try { |
| 194 | adapter.setDisconnected(callId, disconnectCause, disconnectMessage); |
| 195 | } catch (RemoteException e) { |
| 196 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 197 | } |
| 198 | } |
Yorke Lee | 81ccaaa | 2014-03-12 18:33:19 -0700 | [diff] [blame] | 199 | |
| 200 | /** |
| 201 | * Sets a call's state to be on hold. |
| 202 | * |
| 203 | * @param callId - The unique ID of the call whose state is changing to be on hold. |
| 204 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 205 | void setOnHold(String callId) { |
| 206 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 207 | try { |
| 208 | adapter.setOnHold(callId); |
| 209 | } catch (RemoteException e) { |
| 210 | } |
Yorke Lee | 81ccaaa | 2014-03-12 18:33:19 -0700 | [diff] [blame] | 211 | } |
| 212 | } |
| 213 | |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 214 | /** |
| 215 | * Asks Telecomm to start or stop a ringback tone for a call. |
| 216 | * |
| 217 | * @param callId The unique ID of the call whose ringback is being changed. |
| 218 | * @param ringback Whether Telecomm should start playing a ringback tone. |
| 219 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 220 | void setRequestingRingback(String callId, boolean ringback) { |
| 221 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 222 | try { |
| 223 | adapter.setRequestingRingback(callId, ringback); |
| 224 | } catch (RemoteException e) { |
| 225 | } |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 226 | } |
| 227 | } |
Yorke Lee | 81ccaaa | 2014-03-12 18:33:19 -0700 | [diff] [blame] | 228 | |
Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 229 | void setCallCapabilities(String callId, int capabilities) { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 230 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 231 | try { |
Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 232 | adapter.setCallCapabilities(callId, capabilities); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 233 | } catch (RemoteException ignored) { |
| 234 | } |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 235 | } |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Indicates whether or not the specified call is currently conferenced into the specified |
| 240 | * conference call. |
| 241 | * |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 242 | * @param callId The unique ID of the call being conferenced. |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 243 | * @param conferenceCallId The unique ID of the conference call. Null if call is not |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 244 | * conferenced. |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 245 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 246 | void setIsConferenced(String callId, String conferenceCallId) { |
| 247 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 248 | try { |
| 249 | adapter.setIsConferenced(callId, conferenceCallId); |
| 250 | } catch (RemoteException ignored) { |
| 251 | } |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 252 | } |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * Indicates that the call no longer exists. Can be used with either a call or a conference |
| 257 | * call. |
| 258 | * |
| 259 | * @param callId The unique ID of the call. |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 260 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 261 | void removeCall(String callId) { |
| 262 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 263 | try { |
| 264 | adapter.removeCall(callId); |
| 265 | } catch (RemoteException ignored) { |
| 266 | } |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 267 | } |
| 268 | } |
Evan Charlton | 6dea4ac | 2014-06-03 14:07:13 -0700 | [diff] [blame] | 269 | |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 270 | void onPostDialWait(String callId, String remaining) { |
| 271 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 272 | try { |
| 273 | adapter.onPostDialWait(callId, remaining); |
| 274 | } catch (RemoteException ignored) { |
| 275 | } |
Evan Charlton | 6dea4ac | 2014-06-03 14:07:13 -0700 | [diff] [blame] | 276 | } |
| 277 | } |
Sailesh Nepal | 8b4818d | 2014-06-06 10:54:07 -0700 | [diff] [blame] | 278 | |
| 279 | /** |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 280 | * Indicates that a new conference call has been created. |
| 281 | * |
| 282 | * @param callId The unique ID of the conference call. |
| 283 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 284 | void addConferenceCall(String callId) { |
| 285 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 286 | try { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 287 | adapter.addConferenceCall(callId); |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 288 | } catch (RemoteException ignored) { |
| 289 | } |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Retrieves a list of remote connection services usable to place calls. |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 295 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 296 | void queryRemoteConnectionServices(RemoteServiceCallback callback) { |
Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 297 | // Only supported when there is only one adapter. |
| 298 | if (mAdapters.size() == 1) { |
| 299 | try { |
| 300 | mAdapters.iterator().next().queryRemoteConnectionServices(callback); |
| 301 | } catch (RemoteException e) { |
| 302 | Log.e(this, e, "Exception trying to query for remote CSs"); |
| 303 | } |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 304 | } |
| 305 | } |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 306 | |
| 307 | /** |
| 308 | * Sets the call video provider for a call. |
| 309 | * |
| 310 | * @param callId The unique ID of the call to set with the given call video provider. |
| 311 | * @param callVideoProvider The call video provider instance to set on the call. |
| 312 | */ |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 313 | void setCallVideoProvider(String callId, CallVideoProvider callVideoProvider) { |
| 314 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 315 | try { |
| 316 | adapter.setCallVideoProvider(callId, callVideoProvider.getInterface()); |
| 317 | } catch (RemoteException e) { |
| 318 | } |
| 319 | } |
| 320 | } |
Tyler Gunn | 8d83fa9 | 2014-07-01 11:31:21 -0700 | [diff] [blame] | 321 | |
| 322 | /** |
Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 323 | * Requests that the framework use VOIP audio mode for this connection. |
| 324 | * |
| 325 | * @param callId The unique ID of the call to set with the given call video provider. |
| 326 | * @param isVoip True if the audio mode is VOIP. |
| 327 | */ |
| 328 | void setAudioModeIsVoip(String callId, boolean isVoip) { |
| 329 | for (IConnectionServiceAdapter adapter : mAdapters) { |
| 330 | try { |
| 331 | adapter.setAudioModeIsVoip(callId, isVoip); |
| 332 | } catch (RemoteException e) { |
| 333 | } |
| 334 | } |
| 335 | } |
| 336 | |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 337 | void setStatusHints(String callId, StatusHints statusHints) { |
| 338 | for (IConnectionServiceAdapter adapter : mAdapters) { |
| 339 | try { |
| 340 | adapter.setStatusHints(callId, statusHints); |
| 341 | } catch (RemoteException e) { |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame^] | 346 | void setHandle(String callId, Uri handle, int presentation) { |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 347 | for (IConnectionServiceAdapter adapter : mAdapters) { |
Tyler Gunn | 8d83fa9 | 2014-07-01 11:31:21 -0700 | [diff] [blame] | 348 | try { |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame^] | 349 | adapter.setHandle(callId, handle, presentation); |
| 350 | } catch (RemoteException e) { |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | void setCallerDisplayName(String callId, String callerDisplayName, int presentation) { |
| 356 | for (IConnectionServiceAdapter adapter : mAdapters) { |
| 357 | try { |
| 358 | adapter.setCallerDisplayName(callId, callerDisplayName, presentation); |
| 359 | } catch (RemoteException e) { |
Tyler Gunn | 8d83fa9 | 2014-07-01 11:31:21 -0700 | [diff] [blame] | 360 | } |
| 361 | } |
| 362 | } |
Ben Gilad | bb69b0c | 2013-12-12 18:32:02 -0800 | [diff] [blame] | 363 | } |