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