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