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