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