Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 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 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 18 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 19 | import com.android.internal.telecom.IVideoCallback; |
| 20 | import com.android.internal.telecom.IVideoProvider; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 21 | |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 22 | import android.net.Uri; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 23 | import android.os.Handler; |
| 24 | import android.os.IBinder; |
| 25 | import android.os.Message; |
| 26 | import android.os.RemoteException; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 27 | import android.view.Surface; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 28 | |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 29 | import java.util.ArrayList; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 30 | import java.util.Collections; |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 31 | import java.util.List; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 32 | import java.util.Set; |
Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 33 | import java.util.concurrent.ConcurrentHashMap; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Represents a connection to a remote endpoint that carries voice traffic. |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 37 | * <p> |
| 38 | * Implementations create a custom subclass of {@code Connection} and return it to the framework |
| 39 | * as the return value of |
| 40 | * {@link ConnectionService#onCreateIncomingConnection(PhoneAccountHandle, ConnectionRequest)} |
| 41 | * or |
| 42 | * {@link ConnectionService#onCreateOutgoingConnection(PhoneAccountHandle, ConnectionRequest)}. |
| 43 | * Implementations are then responsible for updating the state of the {@code Connection}, and |
| 44 | * must call {@link #destroy()} to signal to the framework that the {@code Connection} is no |
| 45 | * longer used and associated resources may be recovered. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 46 | */ |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 47 | public abstract class Connection implements IConferenceable { |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 48 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 49 | public static final int STATE_INITIALIZING = 0; |
| 50 | |
| 51 | public static final int STATE_NEW = 1; |
| 52 | |
| 53 | public static final int STATE_RINGING = 2; |
| 54 | |
| 55 | public static final int STATE_DIALING = 3; |
| 56 | |
| 57 | public static final int STATE_ACTIVE = 4; |
| 58 | |
| 59 | public static final int STATE_HOLDING = 5; |
| 60 | |
| 61 | public static final int STATE_DISCONNECTED = 6; |
| 62 | |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 63 | /** Connection can currently be put on hold or unheld. */ |
| 64 | public static final int CAPABILITY_HOLD = 0x00000001; |
| 65 | |
| 66 | /** Connection supports the hold feature. */ |
| 67 | public static final int CAPABILITY_SUPPORT_HOLD = 0x00000002; |
| 68 | |
| 69 | /** |
| 70 | * Connections within a conference can be merged. A {@link ConnectionService} has the option to |
| 71 | * add a {@link Conference} before the child {@link Connection}s are merged. This is how |
| 72 | * CDMA-based {@link Connection}s are implemented. For these unmerged {@link Conference}s, this |
| 73 | * capability allows a merge button to be shown while the conference is in the foreground |
| 74 | * of the in-call UI. |
| 75 | * <p> |
| 76 | * This is only intended for use by a {@link Conference}. |
| 77 | */ |
| 78 | public static final int CAPABILITY_MERGE_CONFERENCE = 0x00000004; |
| 79 | |
| 80 | /** |
| 81 | * Connections within a conference can be swapped between foreground and background. |
| 82 | * See {@link #CAPABILITY_MERGE_CONFERENCE} for additional information. |
| 83 | * <p> |
| 84 | * This is only intended for use by a {@link Conference}. |
| 85 | */ |
| 86 | public static final int CAPABILITY_SWAP_CONFERENCE = 0x00000008; |
| 87 | |
| 88 | /** |
| 89 | * @hide |
| 90 | */ |
| 91 | public static final int CAPABILITY_UNUSED = 0x00000010; |
| 92 | |
| 93 | /** Connection supports responding via text option. */ |
| 94 | public static final int CAPABILITY_RESPOND_VIA_TEXT = 0x00000020; |
| 95 | |
| 96 | /** Connection can be muted. */ |
| 97 | public static final int CAPABILITY_MUTE = 0x00000040; |
| 98 | |
| 99 | /** |
| 100 | * Connection supports conference management. This capability only applies to |
| 101 | * {@link Conference}s which can have {@link Connection}s as children. |
| 102 | */ |
| 103 | public static final int CAPABILITY_MANAGE_CONFERENCE = 0x00000080; |
| 104 | |
| 105 | /** |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 106 | * Local device supports receiving video. |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 107 | * @hide |
| 108 | */ |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 109 | public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 0x00000100; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 110 | |
| 111 | /** |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 112 | * Local device supports transmitting video. |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 113 | * @hide |
| 114 | */ |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 115 | public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 0x00000200; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 116 | |
| 117 | /** |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 118 | * Local device supports bidirectional video calling. |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 119 | * @hide |
| 120 | */ |
Andrew Lee | 9a8f9ce | 2015-04-10 18:09:46 -0700 | [diff] [blame] | 121 | public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 122 | CAPABILITY_SUPPORTS_VT_LOCAL_RX | CAPABILITY_SUPPORTS_VT_LOCAL_TX; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 123 | |
| 124 | /** |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 125 | * Remote device supports receiving video. |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 126 | * @hide |
| 127 | */ |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 128 | public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 0x00000400; |
| 129 | |
| 130 | /** |
| 131 | * Remote device supports transmitting video. |
| 132 | * @hide |
| 133 | */ |
| 134 | public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 0x00000800; |
| 135 | |
| 136 | /** |
| 137 | * Remote device supports bidirectional video calling. |
| 138 | * @hide |
| 139 | */ |
Andrew Lee | 9a8f9ce | 2015-04-10 18:09:46 -0700 | [diff] [blame] | 140 | public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 141 | CAPABILITY_SUPPORTS_VT_REMOTE_RX | CAPABILITY_SUPPORTS_VT_REMOTE_TX; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * Connection is able to be separated from its parent {@code Conference}, if any. |
| 145 | */ |
| 146 | public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 0x00001000; |
| 147 | |
| 148 | /** |
| 149 | * Connection is able to be individually disconnected when in a {@code Conference}. |
| 150 | */ |
| 151 | public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 0x00002000; |
| 152 | |
| 153 | /** |
| 154 | * Whether the call is a generic conference, where we do not know the precise state of |
| 155 | * participants in the conference (eg. on CDMA). |
| 156 | * |
| 157 | * @hide |
| 158 | */ |
| 159 | public static final int CAPABILITY_GENERIC_CONFERENCE = 0x00004000; |
| 160 | |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 161 | /** |
| 162 | * Connection is using high definition audio. |
| 163 | * @hide |
| 164 | */ |
| 165 | public static final int CAPABILITY_HIGH_DEF_AUDIO = 0x00008000; |
| 166 | |
| 167 | /** |
| 168 | * Connection is using WIFI. |
| 169 | * @hide |
| 170 | */ |
Tyler Gunn | d11a315 | 2015-03-18 13:09:14 -0700 | [diff] [blame] | 171 | public static final int CAPABILITY_WIFI = 0x00010000; |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 172 | |
Tyler Gunn | 068085b | 2015-02-06 13:56:52 -0800 | [diff] [blame] | 173 | /** |
| 174 | * Indicates that the current device callback number should be shown. |
| 175 | * |
| 176 | * @hide |
| 177 | */ |
Tyler Gunn | 96d6c40 | 2015-03-18 12:39:23 -0700 | [diff] [blame] | 178 | public static final int CAPABILITY_SHOW_CALLBACK_NUMBER = 0x00020000; |
Tyler Gunn | 068085b | 2015-02-06 13:56:52 -0800 | [diff] [blame] | 179 | |
Tyler Gunn | 96d6c40 | 2015-03-18 12:39:23 -0700 | [diff] [blame] | 180 | /** |
Dong Zhou | 89f41eb | 2015-03-15 11:59:49 -0500 | [diff] [blame] | 181 | * Speed up audio setup for MT call. |
| 182 | * @hide |
Tyler Gunn | 96d6c40 | 2015-03-18 12:39:23 -0700 | [diff] [blame] | 183 | */ |
| 184 | public static final int CAPABILITY_SPEED_UP_MT_AUDIO = 0x00040000; |
Tyler Gunn | 068085b | 2015-02-06 13:56:52 -0800 | [diff] [blame] | 185 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 186 | /** |
Tyler Gunn | b5e0cfb | 2015-04-07 16:10:51 -0700 | [diff] [blame] | 187 | * Call can be upgraded to a video call. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 188 | * @hide |
| 189 | */ |
| 190 | public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000; |
| 191 | |
Tyler Gunn | b5e0cfb | 2015-04-07 16:10:51 -0700 | [diff] [blame] | 192 | /** |
| 193 | * For video calls, indicates whether the outgoing video for the call can be paused using |
| 194 | * the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState. |
| 195 | * @hide |
| 196 | */ |
| 197 | public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; |
| 198 | |
Tyler Gunn | 96d6c40 | 2015-03-18 12:39:23 -0700 | [diff] [blame] | 199 | //********************************************************************************************** |
Tyler Gunn | b5e0cfb | 2015-04-07 16:10:51 -0700 | [diff] [blame] | 200 | // Next CAPABILITY value: 0x00200000 |
Tyler Gunn | 96d6c40 | 2015-03-18 12:39:23 -0700 | [diff] [blame] | 201 | //********************************************************************************************** |
Tyler Gunn | 068085b | 2015-02-06 13:56:52 -0800 | [diff] [blame] | 202 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 203 | /** |
| 204 | * Call substate bitmask values |
| 205 | */ |
| 206 | |
| 207 | /* Default case */ |
| 208 | /** |
| 209 | * @hide |
| 210 | */ |
| 211 | public static final int SUBSTATE_NONE = 0; |
| 212 | |
| 213 | /* Indicates that the call is connected but audio attribute is suspended */ |
| 214 | /** |
| 215 | * @hide |
| 216 | */ |
| 217 | public static final int SUBSTATE_AUDIO_CONNECTED_SUSPENDED = 0x1; |
| 218 | |
| 219 | /* Indicates that the call is connected but video attribute is suspended */ |
| 220 | /** |
| 221 | * @hide |
| 222 | */ |
| 223 | public static final int SUBSTATE_VIDEO_CONNECTED_SUSPENDED = 0x2; |
| 224 | |
| 225 | /* Indicates that the call is established but media retry is needed */ |
| 226 | /** |
| 227 | * @hide |
| 228 | */ |
| 229 | public static final int SUBSTATE_AVP_RETRY = 0x4; |
| 230 | |
| 231 | /* Indicates that the call is multitasking */ |
| 232 | /** |
| 233 | * @hide |
| 234 | */ |
| 235 | public static final int SUBSTATE_MEDIA_PAUSED = 0x8; |
| 236 | |
| 237 | /* Mask containing all the call substate bits set */ |
| 238 | /** |
| 239 | * @hide |
| 240 | */ |
| 241 | public static final int SUBSTATE_ALL = SUBSTATE_AUDIO_CONNECTED_SUSPENDED | |
| 242 | SUBSTATE_VIDEO_CONNECTED_SUSPENDED | SUBSTATE_AVP_RETRY | |
| 243 | SUBSTATE_MEDIA_PAUSED; |
| 244 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 245 | // Flag controlling whether PII is emitted into the logs |
| 246 | private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG); |
| 247 | |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 248 | /** |
| 249 | * Whether the given capabilities support the specified capability. |
| 250 | * |
| 251 | * @param capabilities A capability bit field. |
| 252 | * @param capability The capability to check capabilities for. |
| 253 | * @return Whether the specified capability is supported. |
| 254 | * @hide |
| 255 | */ |
| 256 | public static boolean can(int capabilities, int capability) { |
| 257 | return (capabilities & capability) != 0; |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * Whether the capabilities of this {@code Connection} supports the specified capability. |
| 262 | * |
| 263 | * @param capability The capability to check capabilities for. |
| 264 | * @return Whether the specified capability is supported. |
| 265 | * @hide |
| 266 | */ |
| 267 | public boolean can(int capability) { |
| 268 | return can(mConnectionCapabilities, capability); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Removes the specified capability from the set of capabilities of this {@code Connection}. |
| 273 | * |
| 274 | * @param capability The capability to remove from the set. |
| 275 | * @hide |
| 276 | */ |
| 277 | public void removeCapability(int capability) { |
| 278 | mConnectionCapabilities &= ~capability; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Adds the specified capability to the set of capabilities of this {@code Connection}. |
| 283 | * |
| 284 | * @param capability The capability to add to the set. |
| 285 | * @hide |
| 286 | */ |
| 287 | public void addCapability(int capability) { |
| 288 | mConnectionCapabilities |= capability; |
| 289 | } |
| 290 | |
| 291 | |
| 292 | public static String capabilitiesToString(int capabilities) { |
| 293 | StringBuilder builder = new StringBuilder(); |
| 294 | builder.append("[Capabilities:"); |
| 295 | if (can(capabilities, CAPABILITY_HOLD)) { |
| 296 | builder.append(" CAPABILITY_HOLD"); |
| 297 | } |
| 298 | if (can(capabilities, CAPABILITY_SUPPORT_HOLD)) { |
| 299 | builder.append(" CAPABILITY_SUPPORT_HOLD"); |
| 300 | } |
| 301 | if (can(capabilities, CAPABILITY_MERGE_CONFERENCE)) { |
| 302 | builder.append(" CAPABILITY_MERGE_CONFERENCE"); |
| 303 | } |
| 304 | if (can(capabilities, CAPABILITY_SWAP_CONFERENCE)) { |
| 305 | builder.append(" CAPABILITY_SWAP_CONFERENCE"); |
| 306 | } |
| 307 | if (can(capabilities, CAPABILITY_RESPOND_VIA_TEXT)) { |
| 308 | builder.append(" CAPABILITY_RESPOND_VIA_TEXT"); |
| 309 | } |
| 310 | if (can(capabilities, CAPABILITY_MUTE)) { |
| 311 | builder.append(" CAPABILITY_MUTE"); |
| 312 | } |
| 313 | if (can(capabilities, CAPABILITY_MANAGE_CONFERENCE)) { |
| 314 | builder.append(" CAPABILITY_MANAGE_CONFERENCE"); |
| 315 | } |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 316 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_RX)) { |
| 317 | builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL_RX"); |
| 318 | } |
| 319 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { |
| 320 | builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL_TX"); |
| 321 | } |
Andrew Lee | 9a8f9ce | 2015-04-10 18:09:46 -0700 | [diff] [blame] | 322 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL)) { |
| 323 | builder.append(" CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL"); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 324 | } |
Andrew Lee | 5e9e8bb | 2015-03-10 13:58:24 -0700 | [diff] [blame] | 325 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { |
| 326 | builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_RX"); |
| 327 | } |
| 328 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_TX)) { |
| 329 | builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_TX"); |
| 330 | } |
Andrew Lee | 9a8f9ce | 2015-04-10 18:09:46 -0700 | [diff] [blame] | 331 | if (can(capabilities, CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL)) { |
| 332 | builder.append(" CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL"); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 333 | } |
Andrew Lee | 80fff3c | 2014-11-25 17:36:51 -0800 | [diff] [blame] | 334 | if (can(capabilities, CAPABILITY_HIGH_DEF_AUDIO)) { |
| 335 | builder.append(" CAPABILITY_HIGH_DEF_AUDIO"); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 336 | } |
Andrew Lee | 1a8ae3e | 2015-02-02 13:42:38 -0800 | [diff] [blame] | 337 | if (can(capabilities, CAPABILITY_WIFI)) { |
| 338 | builder.append(" CAPABILITY_WIFI"); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 339 | } |
| 340 | if (can(capabilities, CAPABILITY_GENERIC_CONFERENCE)) { |
| 341 | builder.append(" CAPABILITY_GENERIC_CONFERENCE"); |
| 342 | } |
Tyler Gunn | 068085b | 2015-02-06 13:56:52 -0800 | [diff] [blame] | 343 | if (can(capabilities, CAPABILITY_SHOW_CALLBACK_NUMBER)) { |
| 344 | builder.append(" CAPABILITY_SHOW_CALLBACK_NUMBER"); |
| 345 | } |
Dong Zhou | 89f41eb | 2015-03-15 11:59:49 -0500 | [diff] [blame] | 346 | if (can(capabilities, CAPABILITY_SPEED_UP_MT_AUDIO)) { |
Tyler Gunn | d11a315 | 2015-03-18 13:09:14 -0700 | [diff] [blame] | 347 | builder.append(" CAPABILITY_SPEED_UP_MT_AUDIO"); |
Dong Zhou | 89f41eb | 2015-03-15 11:59:49 -0500 | [diff] [blame] | 348 | } |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 349 | if (can(capabilities, CAPABILITY_CAN_UPGRADE_TO_VIDEO)) { |
| 350 | builder.append(" CAPABILITY_CAN_UPGRADE_TO_VIDEO"); |
| 351 | } |
Tyler Gunn | b5e0cfb | 2015-04-07 16:10:51 -0700 | [diff] [blame] | 352 | if (can(capabilities, CAPABILITY_CAN_PAUSE_VIDEO)) { |
| 353 | builder.append(" CAPABILITY_CAN_PAUSE_VIDEO"); |
| 354 | } |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 355 | builder.append("]"); |
| 356 | return builder.toString(); |
| 357 | } |
| 358 | |
Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 359 | /** @hide */ |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 360 | public abstract static class Listener { |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 361 | public void onStateChanged(Connection c, int state) {} |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 362 | public void onAddressChanged(Connection c, Uri newAddress, int presentation) {} |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 363 | public void onCallerDisplayNameChanged( |
| 364 | Connection c, String callerDisplayName, int presentation) {} |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 365 | public void onVideoStateChanged(Connection c, int videoState) {} |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 366 | public void onDisconnected(Connection c, DisconnectCause disconnectCause) {} |
Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 367 | public void onPostDialWait(Connection c, String remaining) {} |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 368 | public void onPostDialChar(Connection c, char nextChar) {} |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 369 | public void onRingbackRequested(Connection c, boolean ringback) {} |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 370 | public void onDestroyed(Connection c) {} |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 371 | public void onConnectionCapabilitiesChanged(Connection c, int capabilities) {} |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 372 | public void onVideoProviderChanged( |
| 373 | Connection c, VideoProvider videoProvider) {} |
Sailesh Nepal | 001bbbb | 2014-07-15 14:40:39 -0700 | [diff] [blame] | 374 | public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {} |
| 375 | public void onStatusHintsChanged(Connection c, StatusHints statusHints) {} |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 376 | public void onConferenceablesChanged( |
| 377 | Connection c, List<IConferenceable> conferenceables) {} |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 378 | public void onConferenceChanged(Connection c, Conference conference) {} |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 379 | /** @hide */ |
Tyler Gunn | ab4650c | 2014-11-06 20:06:23 -0800 | [diff] [blame] | 380 | public void onConferenceParticipantsChanged(Connection c, |
| 381 | List<ConferenceParticipant> participants) {} |
Tyler Gunn | 8a2b119 | 2015-01-29 11:47:24 -0800 | [diff] [blame] | 382 | public void onConferenceStarted() {} |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 383 | public void onCallSubstateChanged(Connection c, int substate) {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 386 | public static abstract class VideoProvider { |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 387 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 388 | /** |
| 389 | * Video is not being received (no protocol pause was issued). |
| 390 | */ |
| 391 | public static final int SESSION_EVENT_RX_PAUSE = 1; |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 392 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 393 | /** |
| 394 | * Video reception has resumed after a SESSION_EVENT_RX_PAUSE. |
| 395 | */ |
| 396 | public static final int SESSION_EVENT_RX_RESUME = 2; |
| 397 | |
| 398 | /** |
| 399 | * Video transmission has begun. This occurs after a negotiated start of video transmission |
| 400 | * when the underlying protocol has actually begun transmitting video to the remote party. |
| 401 | */ |
| 402 | public static final int SESSION_EVENT_TX_START = 3; |
| 403 | |
| 404 | /** |
| 405 | * Video transmission has stopped. This occurs after a negotiated stop of video transmission |
| 406 | * when the underlying protocol has actually stopped transmitting video to the remote party. |
| 407 | */ |
| 408 | public static final int SESSION_EVENT_TX_STOP = 4; |
| 409 | |
| 410 | /** |
| 411 | * A camera failure has occurred for the selected camera. The In-Call UI can use this as a |
| 412 | * cue to inform the user the camera is not available. |
| 413 | */ |
| 414 | public static final int SESSION_EVENT_CAMERA_FAILURE = 5; |
| 415 | |
| 416 | /** |
| 417 | * Issued after {@code SESSION_EVENT_CAMERA_FAILURE} when the camera is once again ready for |
| 418 | * operation. The In-Call UI can use this as a cue to inform the user that the camera has |
| 419 | * become available again. |
| 420 | */ |
| 421 | public static final int SESSION_EVENT_CAMERA_READY = 6; |
| 422 | |
| 423 | /** |
| 424 | * Session modify request was successful. |
| 425 | */ |
| 426 | public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; |
| 427 | |
| 428 | /** |
| 429 | * Session modify request failed. |
| 430 | */ |
| 431 | public static final int SESSION_MODIFY_REQUEST_FAIL = 2; |
| 432 | |
| 433 | /** |
| 434 | * Session modify request ignored due to invalid parameters. |
| 435 | */ |
| 436 | public static final int SESSION_MODIFY_REQUEST_INVALID = 3; |
| 437 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 438 | /** |
| 439 | * Session modify request timed out. |
| 440 | */ |
| 441 | public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; |
| 442 | |
| 443 | /** |
| 444 | * Session modify request rejected by remote UE. |
| 445 | */ |
| 446 | public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; |
| 447 | |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 448 | private static final int MSG_SET_VIDEO_CALLBACK = 1; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 449 | private static final int MSG_SET_CAMERA = 2; |
| 450 | private static final int MSG_SET_PREVIEW_SURFACE = 3; |
| 451 | private static final int MSG_SET_DISPLAY_SURFACE = 4; |
| 452 | private static final int MSG_SET_DEVICE_ORIENTATION = 5; |
| 453 | private static final int MSG_SET_ZOOM = 6; |
| 454 | private static final int MSG_SEND_SESSION_MODIFY_REQUEST = 7; |
| 455 | private static final int MSG_SEND_SESSION_MODIFY_RESPONSE = 8; |
| 456 | private static final int MSG_REQUEST_CAMERA_CAPABILITIES = 9; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 457 | private static final int MSG_REQUEST_CONNECTION_DATA_USAGE = 10; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 458 | private static final int MSG_SET_PAUSE_IMAGE = 11; |
| 459 | |
| 460 | private final VideoProvider.VideoProviderHandler |
| 461 | mMessageHandler = new VideoProvider.VideoProviderHandler(); |
| 462 | private final VideoProvider.VideoProviderBinder mBinder; |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 463 | private IVideoCallback mVideoCallback; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 464 | |
| 465 | /** |
| 466 | * Default handler used to consolidate binder method calls onto a single thread. |
| 467 | */ |
| 468 | private final class VideoProviderHandler extends Handler { |
| 469 | @Override |
| 470 | public void handleMessage(Message msg) { |
| 471 | switch (msg.what) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 472 | case MSG_SET_VIDEO_CALLBACK: |
| 473 | mVideoCallback = IVideoCallback.Stub.asInterface((IBinder) msg.obj); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 474 | break; |
| 475 | case MSG_SET_CAMERA: |
| 476 | onSetCamera((String) msg.obj); |
| 477 | break; |
| 478 | case MSG_SET_PREVIEW_SURFACE: |
| 479 | onSetPreviewSurface((Surface) msg.obj); |
| 480 | break; |
| 481 | case MSG_SET_DISPLAY_SURFACE: |
| 482 | onSetDisplaySurface((Surface) msg.obj); |
| 483 | break; |
| 484 | case MSG_SET_DEVICE_ORIENTATION: |
| 485 | onSetDeviceOrientation(msg.arg1); |
| 486 | break; |
| 487 | case MSG_SET_ZOOM: |
| 488 | onSetZoom((Float) msg.obj); |
| 489 | break; |
| 490 | case MSG_SEND_SESSION_MODIFY_REQUEST: |
| 491 | onSendSessionModifyRequest((VideoProfile) msg.obj); |
| 492 | break; |
| 493 | case MSG_SEND_SESSION_MODIFY_RESPONSE: |
| 494 | onSendSessionModifyResponse((VideoProfile) msg.obj); |
| 495 | break; |
| 496 | case MSG_REQUEST_CAMERA_CAPABILITIES: |
| 497 | onRequestCameraCapabilities(); |
| 498 | break; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 499 | case MSG_REQUEST_CONNECTION_DATA_USAGE: |
| 500 | onRequestConnectionDataUsage(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 501 | break; |
| 502 | case MSG_SET_PAUSE_IMAGE: |
| 503 | onSetPauseImage((String) msg.obj); |
| 504 | break; |
| 505 | default: |
| 506 | break; |
| 507 | } |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * IVideoProvider stub implementation. |
| 513 | */ |
| 514 | private final class VideoProviderBinder extends IVideoProvider.Stub { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 515 | public void setVideoCallback(IBinder videoCallbackBinder) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 516 | mMessageHandler.obtainMessage( |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 517 | MSG_SET_VIDEO_CALLBACK, videoCallbackBinder).sendToTarget(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | public void setCamera(String cameraId) { |
| 521 | mMessageHandler.obtainMessage(MSG_SET_CAMERA, cameraId).sendToTarget(); |
| 522 | } |
| 523 | |
| 524 | public void setPreviewSurface(Surface surface) { |
| 525 | mMessageHandler.obtainMessage(MSG_SET_PREVIEW_SURFACE, surface).sendToTarget(); |
| 526 | } |
| 527 | |
| 528 | public void setDisplaySurface(Surface surface) { |
| 529 | mMessageHandler.obtainMessage(MSG_SET_DISPLAY_SURFACE, surface).sendToTarget(); |
| 530 | } |
| 531 | |
| 532 | public void setDeviceOrientation(int rotation) { |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 533 | mMessageHandler.obtainMessage( |
| 534 | MSG_SET_DEVICE_ORIENTATION, rotation, 0).sendToTarget(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 535 | } |
| 536 | |
| 537 | public void setZoom(float value) { |
| 538 | mMessageHandler.obtainMessage(MSG_SET_ZOOM, value).sendToTarget(); |
| 539 | } |
| 540 | |
| 541 | public void sendSessionModifyRequest(VideoProfile requestProfile) { |
| 542 | mMessageHandler.obtainMessage( |
| 543 | MSG_SEND_SESSION_MODIFY_REQUEST, requestProfile).sendToTarget(); |
| 544 | } |
| 545 | |
| 546 | public void sendSessionModifyResponse(VideoProfile responseProfile) { |
| 547 | mMessageHandler.obtainMessage( |
| 548 | MSG_SEND_SESSION_MODIFY_RESPONSE, responseProfile).sendToTarget(); |
| 549 | } |
| 550 | |
| 551 | public void requestCameraCapabilities() { |
| 552 | mMessageHandler.obtainMessage(MSG_REQUEST_CAMERA_CAPABILITIES).sendToTarget(); |
| 553 | } |
| 554 | |
| 555 | public void requestCallDataUsage() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 556 | mMessageHandler.obtainMessage(MSG_REQUEST_CONNECTION_DATA_USAGE).sendToTarget(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | public void setPauseImage(String uri) { |
| 560 | mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget(); |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | public VideoProvider() { |
| 565 | mBinder = new VideoProvider.VideoProviderBinder(); |
| 566 | } |
| 567 | |
| 568 | /** |
| 569 | * Returns binder object which can be used across IPC methods. |
| 570 | * @hide |
| 571 | */ |
| 572 | public final IVideoProvider getInterface() { |
| 573 | return mBinder; |
| 574 | } |
| 575 | |
| 576 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 577 | * Sets the camera to be used for video recording in a video connection. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 578 | * |
| 579 | * @param cameraId The id of the camera. |
| 580 | */ |
| 581 | public abstract void onSetCamera(String cameraId); |
| 582 | |
| 583 | /** |
| 584 | * Sets the surface to be used for displaying a preview of what the user's camera is |
| 585 | * currently capturing. When video transmission is enabled, this is the video signal which |
| 586 | * is sent to the remote device. |
| 587 | * |
| 588 | * @param surface The surface. |
| 589 | */ |
| 590 | public abstract void onSetPreviewSurface(Surface surface); |
| 591 | |
| 592 | /** |
| 593 | * Sets the surface to be used for displaying the video received from the remote device. |
| 594 | * |
| 595 | * @param surface The surface. |
| 596 | */ |
| 597 | public abstract void onSetDisplaySurface(Surface surface); |
| 598 | |
| 599 | /** |
| 600 | * Sets the device orientation, in degrees. Assumes that a standard portrait orientation of |
| 601 | * the device is 0 degrees. |
| 602 | * |
| 603 | * @param rotation The device orientation, in degrees. |
| 604 | */ |
| 605 | public abstract void onSetDeviceOrientation(int rotation); |
| 606 | |
| 607 | /** |
| 608 | * Sets camera zoom ratio. |
| 609 | * |
| 610 | * @param value The camera zoom ratio. |
| 611 | */ |
| 612 | public abstract void onSetZoom(float value); |
| 613 | |
| 614 | /** |
| 615 | * Issues a request to modify the properties of the current session. The request is |
| 616 | * sent to the remote device where it it handled by the In-Call UI. |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 617 | * Some examples of session modification requests: upgrade connection from audio to video, |
| 618 | * downgrade connection from video to audio, pause video. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 619 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 620 | * @param requestProfile The requested connection video properties. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 621 | */ |
| 622 | public abstract void onSendSessionModifyRequest(VideoProfile requestProfile); |
| 623 | |
| 624 | /**te |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 625 | * Provides a response to a request to change the current connection session video |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 626 | * properties. |
| 627 | * This is in response to a request the InCall UI has received via the InCall UI. |
| 628 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 629 | * @param responseProfile The response connection video properties. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 630 | */ |
| 631 | public abstract void onSendSessionModifyResponse(VideoProfile responseProfile); |
| 632 | |
| 633 | /** |
| 634 | * Issues a request to the video provider to retrieve the camera capabilities. |
| 635 | * Camera capabilities are reported back to the caller via the In-Call UI. |
| 636 | */ |
| 637 | public abstract void onRequestCameraCapabilities(); |
| 638 | |
| 639 | /** |
| 640 | * Issues a request to the video telephony framework to retrieve the cumulative data usage |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 641 | * for the current connection. Data usage is reported back to the caller via the |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 642 | * InCall UI. |
| 643 | */ |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 644 | public abstract void onRequestConnectionDataUsage(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 645 | |
| 646 | /** |
| 647 | * Provides the video telephony framework with the URI of an image to be displayed to remote |
| 648 | * devices when the video signal is paused. |
| 649 | * |
| 650 | * @param uri URI of image to display. |
| 651 | */ |
| 652 | public abstract void onSetPauseImage(String uri); |
| 653 | |
| 654 | /** |
| 655 | * Invokes callback method defined in In-Call UI. |
| 656 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 657 | * @param videoProfile The requested video connection profile. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 658 | */ |
| 659 | public void receiveSessionModifyRequest(VideoProfile videoProfile) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 660 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 661 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 662 | mVideoCallback.receiveSessionModifyRequest(videoProfile); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 663 | } catch (RemoteException ignored) { |
| 664 | } |
| 665 | } |
| 666 | } |
| 667 | |
| 668 | /** |
| 669 | * Invokes callback method defined in In-Call UI. |
| 670 | * |
| 671 | * @param status Status of the session modify request. Valid values are |
| 672 | * {@link VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, |
| 673 | * {@link VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, |
| 674 | * {@link VideoProvider#SESSION_MODIFY_REQUEST_INVALID} |
| 675 | * @param requestedProfile The original request which was sent to the remote device. |
| 676 | * @param responseProfile The actual profile changes made by the remote device. |
| 677 | */ |
| 678 | public void receiveSessionModifyResponse(int status, |
| 679 | VideoProfile requestedProfile, VideoProfile responseProfile) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 680 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 681 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 682 | mVideoCallback.receiveSessionModifyResponse( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 683 | status, requestedProfile, responseProfile); |
| 684 | } catch (RemoteException ignored) { |
| 685 | } |
| 686 | } |
| 687 | } |
| 688 | |
| 689 | /** |
| 690 | * Invokes callback method defined in In-Call UI. |
| 691 | * |
| 692 | * Valid values are: {@link VideoProvider#SESSION_EVENT_RX_PAUSE}, |
| 693 | * {@link VideoProvider#SESSION_EVENT_RX_RESUME}, |
| 694 | * {@link VideoProvider#SESSION_EVENT_TX_START}, |
| 695 | * {@link VideoProvider#SESSION_EVENT_TX_STOP} |
| 696 | * |
| 697 | * @param event The event. |
| 698 | */ |
| 699 | public void handleCallSessionEvent(int event) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 700 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 701 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 702 | mVideoCallback.handleCallSessionEvent(event); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 703 | } catch (RemoteException ignored) { |
| 704 | } |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * Invokes callback method defined in In-Call UI. |
| 710 | * |
| 711 | * @param width The updated peer video width. |
| 712 | * @param height The updated peer video height. |
| 713 | */ |
| 714 | public void changePeerDimensions(int width, int height) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 715 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 716 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 717 | mVideoCallback.changePeerDimensions(width, height); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 718 | } catch (RemoteException ignored) { |
| 719 | } |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | /** |
| 724 | * Invokes callback method defined in In-Call UI. |
| 725 | * |
| 726 | * @param dataUsage The updated data usage. |
| 727 | */ |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 728 | public void changeCallDataUsage(long dataUsage) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 729 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 730 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 731 | mVideoCallback.changeCallDataUsage(dataUsage); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 732 | } catch (RemoteException ignored) { |
| 733 | } |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | /** |
| 738 | * Invokes callback method defined in In-Call UI. |
| 739 | * |
| 740 | * @param cameraCapabilities The changed camera capabilities. |
| 741 | */ |
| 742 | public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 743 | if (mVideoCallback != null) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 744 | try { |
Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 745 | mVideoCallback.changeCameraCapabilities(cameraCapabilities); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 746 | } catch (RemoteException ignored) { |
| 747 | } |
| 748 | } |
| 749 | } |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 750 | |
| 751 | /** |
| 752 | * Invokes callback method defined in In-Call UI. |
| 753 | * |
| 754 | * @param videoQuality The updated video quality. |
| 755 | */ |
| 756 | public void changeVideoQuality(int videoQuality) { |
| 757 | if (mVideoCallback != null) { |
| 758 | try { |
| 759 | mVideoCallback.changeVideoQuality(videoQuality); |
| 760 | } catch (RemoteException ignored) { |
| 761 | } |
| 762 | } |
| 763 | } |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 764 | } |
| 765 | |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 766 | private final Listener mConnectionDeathListener = new Listener() { |
| 767 | @Override |
| 768 | public void onDestroyed(Connection c) { |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 769 | if (mConferenceables.remove(c)) { |
| 770 | fireOnConferenceableConnectionsChanged(); |
| 771 | } |
| 772 | } |
| 773 | }; |
| 774 | |
| 775 | private final Conference.Listener mConferenceDeathListener = new Conference.Listener() { |
| 776 | @Override |
| 777 | public void onDestroyed(Conference c) { |
| 778 | if (mConferenceables.remove(c)) { |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 779 | fireOnConferenceableConnectionsChanged(); |
| 780 | } |
| 781 | } |
| 782 | }; |
| 783 | |
Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 784 | /** |
| 785 | * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is |
| 786 | * load factor before resizing, 1 means we only expect a single thread to |
| 787 | * access the map so make only a single shard |
| 788 | */ |
| 789 | private final Set<Listener> mListeners = Collections.newSetFromMap( |
| 790 | new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 791 | private final List<IConferenceable> mConferenceables = new ArrayList<>(); |
| 792 | private final List<IConferenceable> mUnmodifiableConferenceables = |
| 793 | Collections.unmodifiableList(mConferenceables); |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 794 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 795 | private int mState = STATE_NEW; |
| 796 | private AudioState mAudioState; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 797 | private Uri mAddress; |
| 798 | private int mAddressPresentation; |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 799 | private String mCallerDisplayName; |
| 800 | private int mCallerDisplayNamePresentation; |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 801 | private boolean mRingbackRequested = false; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 802 | private int mConnectionCapabilities; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 803 | private VideoProvider mVideoProvider; |
Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 804 | private boolean mAudioModeIsVoip; |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 805 | private StatusHints mStatusHints; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 806 | private int mVideoState; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 807 | private DisconnectCause mDisconnectCause; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 808 | private Conference mConference; |
| 809 | private ConnectionService mConnectionService; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 810 | private int mCallSubstate; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 811 | |
| 812 | /** |
| 813 | * Create a new Connection. |
| 814 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 815 | public Connection() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 816 | |
| 817 | /** |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 818 | * @return The address (e.g., phone number) to which this Connection is currently communicating. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 819 | */ |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 820 | public final Uri getAddress() { |
| 821 | return mAddress; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 822 | } |
| 823 | |
| 824 | /** |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 825 | * @return The presentation requirements for the address. |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 826 | * See {@link TelecomManager} for valid values. |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 827 | */ |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 828 | public final int getAddressPresentation() { |
| 829 | return mAddressPresentation; |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | /** |
| 833 | * @return The caller display name (CNAP). |
| 834 | */ |
| 835 | public final String getCallerDisplayName() { |
| 836 | return mCallerDisplayName; |
| 837 | } |
| 838 | |
| 839 | /** |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 840 | * @return The presentation requirements for the handle. |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 841 | * See {@link TelecomManager} for valid values. |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 842 | */ |
| 843 | public final int getCallerDisplayNamePresentation() { |
| 844 | return mCallerDisplayNamePresentation; |
| 845 | } |
| 846 | |
| 847 | /** |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 848 | * @return The state of this Connection. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 849 | */ |
| 850 | public final int getState() { |
| 851 | return mState; |
| 852 | } |
| 853 | |
| 854 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 855 | * Returns the video state of the connection. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 856 | * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, |
| 857 | * {@link VideoProfile.VideoState#BIDIRECTIONAL}, |
| 858 | * {@link VideoProfile.VideoState#TX_ENABLED}, |
| 859 | * {@link VideoProfile.VideoState#RX_ENABLED}. |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 860 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 861 | * @return The video state of the connection. |
Tyler Gunn | 27d1e25 | 2014-08-21 16:38:40 -0700 | [diff] [blame] | 862 | * @hide |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 863 | */ |
| 864 | public final int getVideoState() { |
| 865 | return mVideoState; |
| 866 | } |
| 867 | |
| 868 | /** |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 869 | * Returns the call substate of the call. |
| 870 | * Valid values: {@link Connection#SUBSTATE_NONE}, |
| 871 | * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED}, |
| 872 | * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED}, |
| 873 | * {@link Connection#SUBSTATE_AVP_RETRY}, |
| 874 | * {@link Connection#SUBSTATE_MEDIA_PAUSED}. |
| 875 | * |
| 876 | * @param callSubstate The new call substate. |
| 877 | * @hide |
| 878 | */ |
| 879 | public final int getCallSubstate() { |
| 880 | return mCallSubstate; |
| 881 | } |
| 882 | |
| 883 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 884 | * @return The audio state of the connection, describing how its audio is currently |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 885 | * being routed by the system. This is {@code null} if this Connection |
| 886 | * does not directly know about its audio state. |
| 887 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 888 | public final AudioState getAudioState() { |
| 889 | return mAudioState; |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | /** |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 893 | * @return The conference that this connection is a part of. Null if it is not part of any |
| 894 | * conference. |
| 895 | */ |
| 896 | public final Conference getConference() { |
| 897 | return mConference; |
| 898 | } |
| 899 | |
| 900 | /** |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 901 | * Returns whether this connection is requesting that the system play a ringback tone |
| 902 | * on its behalf. |
| 903 | */ |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 904 | public final boolean isRingbackRequested() { |
| 905 | return mRingbackRequested; |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 906 | } |
| 907 | |
| 908 | /** |
Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 909 | * @return True if the connection's audio mode is VOIP. |
| 910 | */ |
| 911 | public final boolean getAudioModeIsVoip() { |
| 912 | return mAudioModeIsVoip; |
| 913 | } |
| 914 | |
| 915 | /** |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 916 | * @return The status hints for this connection. |
| 917 | */ |
| 918 | public final StatusHints getStatusHints() { |
| 919 | return mStatusHints; |
| 920 | } |
| 921 | |
| 922 | /** |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 923 | * Assign a listener to be notified of state changes. |
| 924 | * |
| 925 | * @param l A listener. |
| 926 | * @return This Connection. |
| 927 | * |
| 928 | * @hide |
| 929 | */ |
| 930 | public final Connection addConnectionListener(Listener l) { |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 931 | mListeners.add(l); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 932 | return this; |
| 933 | } |
| 934 | |
| 935 | /** |
| 936 | * Remove a previously assigned listener that was being notified of state changes. |
| 937 | * |
| 938 | * @param l A Listener. |
| 939 | * @return This Connection. |
| 940 | * |
| 941 | * @hide |
| 942 | */ |
| 943 | public final Connection removeConnectionListener(Listener l) { |
Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 944 | if (l != null) { |
| 945 | mListeners.remove(l); |
| 946 | } |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 947 | return this; |
| 948 | } |
| 949 | |
| 950 | /** |
Sailesh Nepal | cf7020b | 2014-08-20 10:07:19 -0700 | [diff] [blame] | 951 | * @return The {@link DisconnectCause} for this connection. |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 952 | */ |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 953 | public final DisconnectCause getDisconnectCause() { |
Sailesh Nepal | cf7020b | 2014-08-20 10:07:19 -0700 | [diff] [blame] | 954 | return mDisconnectCause; |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 955 | } |
| 956 | |
| 957 | /** |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 958 | * Inform this Connection that the state of its audio output has been changed externally. |
| 959 | * |
| 960 | * @param state The new audio state. |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 961 | * @hide |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 962 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 963 | final void setAudioState(AudioState state) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 964 | checkImmutable(); |
Ihab Awad | 60ac30b | 2014-05-20 22:32:12 -0700 | [diff] [blame] | 965 | Log.d(this, "setAudioState %s", state); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 966 | mAudioState = state; |
Nancy Chen | 354b2bd | 2014-09-08 18:27:26 -0700 | [diff] [blame] | 967 | onAudioStateChanged(state); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 968 | } |
| 969 | |
| 970 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 971 | * @param state An integer value of a {@code STATE_*} constant. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 972 | * @return A string representation of the value. |
| 973 | */ |
| 974 | public static String stateToString(int state) { |
| 975 | switch (state) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 976 | case STATE_INITIALIZING: |
| 977 | return "STATE_INITIALIZING"; |
| 978 | case STATE_NEW: |
| 979 | return "STATE_NEW"; |
| 980 | case STATE_RINGING: |
| 981 | return "STATE_RINGING"; |
| 982 | case STATE_DIALING: |
| 983 | return "STATE_DIALING"; |
| 984 | case STATE_ACTIVE: |
| 985 | return "STATE_ACTIVE"; |
| 986 | case STATE_HOLDING: |
| 987 | return "STATE_HOLDING"; |
| 988 | case STATE_DISCONNECTED: |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 989 | return "DISCONNECTED"; |
| 990 | default: |
Ihab Awad | 60ac30b | 2014-05-20 22:32:12 -0700 | [diff] [blame] | 991 | Log.wtf(Connection.class, "Unknown state %d", state); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 992 | return "UNKNOWN"; |
| 993 | } |
| 994 | } |
| 995 | |
| 996 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 997 | * Returns the connection's capabilities, as a bit mask of the {@code CAPABILITY_*} constants. |
Ihab Awad | 52a28f6 | 2014-06-18 10:26:34 -0700 | [diff] [blame] | 998 | */ |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 999 | public final int getConnectionCapabilities() { |
| 1000 | return mConnectionCapabilities; |
Ihab Awad | 52a28f6 | 2014-06-18 10:26:34 -0700 | [diff] [blame] | 1001 | } |
| 1002 | |
| 1003 | /** |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1004 | * Sets the value of the {@link #getAddress()} property. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1005 | * |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1006 | * @param address The new address. |
| 1007 | * @param presentation The presentation requirements for the address. |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 1008 | * See {@link TelecomManager} for valid values. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1009 | */ |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1010 | public final void setAddress(Uri address, int presentation) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1011 | checkImmutable(); |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1012 | Log.d(this, "setAddress %s", address); |
| 1013 | mAddress = address; |
| 1014 | mAddressPresentation = presentation; |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1015 | for (Listener l : mListeners) { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1016 | l.onAddressChanged(this, address, presentation); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1017 | } |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1018 | } |
| 1019 | |
| 1020 | /** |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 1021 | * Sets the caller display name (CNAP). |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 1022 | * |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 1023 | * @param callerDisplayName The new display name. |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 1024 | * @param presentation The presentation requirements for the handle. |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 1025 | * See {@link TelecomManager} for valid values. |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 1026 | */ |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 1027 | public final void setCallerDisplayName(String callerDisplayName, int presentation) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1028 | checkImmutable(); |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 1029 | Log.d(this, "setCallerDisplayName %s", callerDisplayName); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1030 | mCallerDisplayName = callerDisplayName; |
| 1031 | mCallerDisplayNamePresentation = presentation; |
| 1032 | for (Listener l : mListeners) { |
| 1033 | l.onCallerDisplayNameChanged(this, callerDisplayName, presentation); |
| 1034 | } |
Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 1035 | } |
| 1036 | |
| 1037 | /** |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 1038 | * Set the video state for the connection. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1039 | * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, |
| 1040 | * {@link VideoProfile.VideoState#BIDIRECTIONAL}, |
| 1041 | * {@link VideoProfile.VideoState#TX_ENABLED}, |
| 1042 | * {@link VideoProfile.VideoState#RX_ENABLED}. |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 1043 | * |
| 1044 | * @param videoState The new video state. |
Tyler Gunn | 27d1e25 | 2014-08-21 16:38:40 -0700 | [diff] [blame] | 1045 | * @hide |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 1046 | */ |
| 1047 | public final void setVideoState(int videoState) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1048 | checkImmutable(); |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 1049 | Log.d(this, "setVideoState %d", videoState); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1050 | mVideoState = videoState; |
| 1051 | for (Listener l : mListeners) { |
| 1052 | l.onVideoStateChanged(this, mVideoState); |
| 1053 | } |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 1054 | } |
| 1055 | |
| 1056 | /** |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 1057 | * Set the call substate for the connection. |
| 1058 | * Valid values: {@link Connection#SUBSTATE_NONE}, |
| 1059 | * {@link Connection#SUBSTATE_AUDIO_CONNECTED_SUSPENDED}, |
| 1060 | * {@link Connection#SUBSTATE_VIDEO_CONNECTED_SUSPENDED}, |
| 1061 | * {@link Connection#SUBSTATE_AVP_RETRY}, |
| 1062 | * {@link Connection#SUBSTATE_MEDIA_PAUSED}. |
| 1063 | * |
| 1064 | * @param callSubstate The new call substate. |
| 1065 | * @hide |
| 1066 | */ |
| 1067 | public final void setCallSubstate(int callSubstate) { |
| 1068 | Log.d(this, "setCallSubstate %d", callSubstate); |
| 1069 | mCallSubstate = callSubstate; |
| 1070 | for (Listener l : mListeners) { |
| 1071 | l.onCallSubstateChanged(this, mCallSubstate); |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1076 | * Sets state to active (e.g., an ongoing connection where two or more parties can actively |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1077 | * communicate). |
| 1078 | */ |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1079 | public final void setActive() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1080 | checkImmutable(); |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1081 | setRingbackRequested(false); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1082 | setState(STATE_ACTIVE); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1083 | } |
| 1084 | |
| 1085 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1086 | * Sets state to ringing (e.g., an inbound ringing connection). |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1087 | */ |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1088 | public final void setRinging() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1089 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1090 | setState(STATE_RINGING); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1091 | } |
| 1092 | |
| 1093 | /** |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1094 | * Sets state to initializing (this Connection is not yet ready to be used). |
| 1095 | */ |
| 1096 | public final void setInitializing() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1097 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1098 | setState(STATE_INITIALIZING); |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | /** |
| 1102 | * Sets state to initialized (the Connection has been set up and is now ready to be used). |
| 1103 | */ |
| 1104 | public final void setInitialized() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1105 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1106 | setState(STATE_NEW); |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1107 | } |
| 1108 | |
| 1109 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1110 | * Sets state to dialing (e.g., dialing an outbound connection). |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1111 | */ |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1112 | public final void setDialing() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1113 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1114 | setState(STATE_DIALING); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1115 | } |
| 1116 | |
| 1117 | /** |
| 1118 | * Sets state to be on hold. |
| 1119 | */ |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1120 | public final void setOnHold() { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1121 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1122 | setState(STATE_HOLDING); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1123 | } |
| 1124 | |
| 1125 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1126 | * Sets the video connection provider. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1127 | * @param videoProvider The video provider. |
Tyler Gunn | 27d1e25 | 2014-08-21 16:38:40 -0700 | [diff] [blame] | 1128 | * @hide |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 1129 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1130 | public final void setVideoProvider(VideoProvider videoProvider) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1131 | checkImmutable(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1132 | mVideoProvider = videoProvider; |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1133 | for (Listener l : mListeners) { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1134 | l.onVideoProviderChanged(this, videoProvider); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1135 | } |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 1136 | } |
| 1137 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1138 | public final VideoProvider getVideoProvider() { |
| 1139 | return mVideoProvider; |
Andrew Lee | a27a193 | 2014-07-09 17:07:13 -0700 | [diff] [blame] | 1140 | } |
| 1141 | |
Andrew Lee | 5ffbe8b | 2014-06-20 16:29:33 -0700 | [diff] [blame] | 1142 | /** |
Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 1143 | * Sets state to disconnected. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1144 | * |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1145 | * @param disconnectCause The reason for the disconnection, as specified by |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1146 | * {@link DisconnectCause}. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1147 | */ |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1148 | public final void setDisconnected(DisconnectCause disconnectCause) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1149 | checkImmutable(); |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1150 | mDisconnectCause = disconnectCause; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1151 | setState(STATE_DISCONNECTED); |
mike dooley | f34519b | 2014-09-16 17:33:40 -0700 | [diff] [blame] | 1152 | Log.d(this, "Disconnected with cause %s", disconnectCause); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1153 | for (Listener l : mListeners) { |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1154 | l.onDisconnected(this, disconnectCause); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1155 | } |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1159 | * Informs listeners that this {@code Connection} is in a post-dial wait state. This is done |
| 1160 | * when (a) the {@code Connection} is issuing a DTMF sequence; (b) it has encountered a "wait" |
| 1161 | * character; and (c) it wishes to inform the In-Call app that it is waiting for the end-user |
| 1162 | * to send an {@link #onPostDialContinue(boolean)} signal. |
| 1163 | * |
| 1164 | * @param remaining The DTMF character sequence remaining to be emitted once the |
| 1165 | * {@link #onPostDialContinue(boolean)} is received, including any "wait" characters |
| 1166 | * that remaining sequence may contain. |
Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 1167 | */ |
| 1168 | public final void setPostDialWait(String remaining) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1169 | checkImmutable(); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1170 | for (Listener l : mListeners) { |
| 1171 | l.onPostDialWait(this, remaining); |
| 1172 | } |
Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | /** |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 1176 | * Informs listeners that this {@code Connection} has processed a character in the post-dial |
| 1177 | * started state. This is done when (a) the {@code Connection} is issuing a DTMF sequence; |
Sailesh Nepal | 1ed8561 | 2015-01-31 15:17:19 -0800 | [diff] [blame] | 1178 | * and (b) it wishes to signal Telecom to play the corresponding DTMF tone locally. |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 1179 | * |
| 1180 | * @param nextChar The DTMF character that was just processed by the {@code Connection}. |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 1181 | */ |
Sailesh Nepal | 1ed8561 | 2015-01-31 15:17:19 -0800 | [diff] [blame] | 1182 | public final void setNextPostDialChar(char nextChar) { |
Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 1183 | checkImmutable(); |
| 1184 | for (Listener l : mListeners) { |
| 1185 | l.onPostDialChar(this, nextChar); |
| 1186 | } |
| 1187 | } |
| 1188 | |
| 1189 | /** |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1190 | * Requests that the framework play a ringback tone. This is to be invoked by implementations |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1191 | * that do not play a ringback tone themselves in the connection's audio stream. |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1192 | * |
| 1193 | * @param ringback Whether the ringback tone is to be played. |
| 1194 | */ |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1195 | public final void setRingbackRequested(boolean ringback) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1196 | checkImmutable(); |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1197 | if (mRingbackRequested != ringback) { |
| 1198 | mRingbackRequested = ringback; |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1199 | for (Listener l : mListeners) { |
Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 1200 | l.onRingbackRequested(this, ringback); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1201 | } |
| 1202 | } |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1203 | } |
| 1204 | |
| 1205 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1206 | * Sets the connection's capabilities as a bit mask of the {@code CAPABILITY_*} constants. |
Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 1207 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1208 | * @param connectionCapabilities The new connection capabilities. |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1209 | */ |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1210 | public final void setConnectionCapabilities(int connectionCapabilities) { |
| 1211 | checkImmutable(); |
| 1212 | if (mConnectionCapabilities != connectionCapabilities) { |
| 1213 | mConnectionCapabilities = connectionCapabilities; |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1214 | for (Listener l : mListeners) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1215 | l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1216 | } |
| 1217 | } |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1218 | } |
| 1219 | |
| 1220 | /** |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1221 | * Tears down the Connection object. |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1222 | */ |
Evan Charlton | 36a7134 | 2014-07-19 16:31:02 -0700 | [diff] [blame] | 1223 | public final void destroy() { |
Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 1224 | for (Listener l : mListeners) { |
| 1225 | l.onDestroyed(this); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1226 | } |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1227 | } |
| 1228 | |
| 1229 | /** |
Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 1230 | * Requests that the framework use VOIP audio mode for this connection. |
| 1231 | * |
| 1232 | * @param isVoip True if the audio mode is VOIP. |
| 1233 | */ |
| 1234 | public final void setAudioModeIsVoip(boolean isVoip) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1235 | checkImmutable(); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1236 | mAudioModeIsVoip = isVoip; |
| 1237 | for (Listener l : mListeners) { |
| 1238 | l.onAudioModeIsVoipChanged(this, isVoip); |
| 1239 | } |
Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 1240 | } |
| 1241 | |
| 1242 | /** |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 1243 | * Sets the label and icon status to display in the in-call UI. |
| 1244 | * |
| 1245 | * @param statusHints The status label and icon to set. |
| 1246 | */ |
| 1247 | public final void setStatusHints(StatusHints statusHints) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1248 | checkImmutable(); |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1249 | mStatusHints = statusHints; |
| 1250 | for (Listener l : mListeners) { |
| 1251 | l.onStatusHintsChanged(this, statusHints); |
| 1252 | } |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 1253 | } |
| 1254 | |
| 1255 | /** |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1256 | * Sets the connections with which this connection can be conferenced. |
| 1257 | * |
| 1258 | * @param conferenceableConnections The set of connections this connection can conference with. |
| 1259 | */ |
| 1260 | public final void setConferenceableConnections(List<Connection> conferenceableConnections) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1261 | checkImmutable(); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1262 | clearConferenceableList(); |
| 1263 | for (Connection c : conferenceableConnections) { |
| 1264 | // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a |
| 1265 | // small amount of items here. |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1266 | if (!mConferenceables.contains(c)) { |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1267 | c.addConnectionListener(mConnectionDeathListener); |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1268 | mConferenceables.add(c); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1269 | } |
| 1270 | } |
| 1271 | fireOnConferenceableConnectionsChanged(); |
| 1272 | } |
| 1273 | |
| 1274 | /** |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1275 | * Similar to {@link #setConferenceableConnections(java.util.List)}, sets a list of connections |
| 1276 | * or conferences with which this connection can be conferenced. |
| 1277 | * |
| 1278 | * @param conferenceables The conferenceables. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1279 | */ |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1280 | public final void setConferenceables(List<IConferenceable> conferenceables) { |
| 1281 | clearConferenceableList(); |
| 1282 | for (IConferenceable c : conferenceables) { |
| 1283 | // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a |
| 1284 | // small amount of items here. |
| 1285 | if (!mConferenceables.contains(c)) { |
| 1286 | if (c instanceof Connection) { |
| 1287 | Connection connection = (Connection) c; |
| 1288 | connection.addConnectionListener(mConnectionDeathListener); |
| 1289 | } else if (c instanceof Conference) { |
| 1290 | Conference conference = (Conference) c; |
| 1291 | conference.addListener(mConferenceDeathListener); |
| 1292 | } |
| 1293 | mConferenceables.add(c); |
| 1294 | } |
| 1295 | } |
| 1296 | fireOnConferenceableConnectionsChanged(); |
| 1297 | } |
| 1298 | |
| 1299 | /** |
| 1300 | * Returns the connections or conferences with which this connection can be conferenced. |
| 1301 | */ |
| 1302 | public final List<IConferenceable> getConferenceables() { |
| 1303 | return mUnmodifiableConferenceables; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1304 | } |
| 1305 | |
Evan Charlton | 8635c57 | 2014-09-24 14:04:51 -0700 | [diff] [blame] | 1306 | /* |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1307 | * @hide |
| 1308 | */ |
| 1309 | public final void setConnectionService(ConnectionService connectionService) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1310 | checkImmutable(); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1311 | if (mConnectionService != null) { |
| 1312 | Log.e(this, new Exception(), "Trying to set ConnectionService on a connection " + |
| 1313 | "which is already associated with another ConnectionService."); |
| 1314 | } else { |
| 1315 | mConnectionService = connectionService; |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | /** |
| 1320 | * @hide |
| 1321 | */ |
| 1322 | public final void unsetConnectionService(ConnectionService connectionService) { |
| 1323 | if (mConnectionService != connectionService) { |
| 1324 | Log.e(this, new Exception(), "Trying to remove ConnectionService from a Connection " + |
| 1325 | "that does not belong to the ConnectionService."); |
| 1326 | } else { |
| 1327 | mConnectionService = null; |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | /** |
Santos Cordon | af1b296 | 2014-10-16 19:23:54 -0700 | [diff] [blame] | 1332 | * @hide |
| 1333 | */ |
| 1334 | public final ConnectionService getConnectionService() { |
| 1335 | return mConnectionService; |
| 1336 | } |
| 1337 | |
| 1338 | /** |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1339 | * Sets the conference that this connection is a part of. This will fail if the connection is |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1340 | * already part of a conference. {@link #resetConference} to un-set the conference first. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1341 | * |
| 1342 | * @param conference The conference. |
| 1343 | * @return {@code true} if the conference was successfully set. |
| 1344 | * @hide |
| 1345 | */ |
| 1346 | public final boolean setConference(Conference conference) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1347 | checkImmutable(); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1348 | // We check to see if it is already part of another conference. |
Santos Cordon | 0159ac0 | 2014-08-21 14:28:11 -0700 | [diff] [blame] | 1349 | if (mConference == null) { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1350 | mConference = conference; |
Santos Cordon | 0159ac0 | 2014-08-21 14:28:11 -0700 | [diff] [blame] | 1351 | if (mConnectionService != null && mConnectionService.containsConference(conference)) { |
| 1352 | fireConferenceChanged(); |
| 1353 | } |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1354 | return true; |
| 1355 | } |
| 1356 | return false; |
| 1357 | } |
| 1358 | |
| 1359 | /** |
| 1360 | * Resets the conference that this connection is a part of. |
| 1361 | * @hide |
| 1362 | */ |
| 1363 | public final void resetConference() { |
| 1364 | if (mConference != null) { |
Santos Cordon | 0159ac0 | 2014-08-21 14:28:11 -0700 | [diff] [blame] | 1365 | Log.d(this, "Conference reset"); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1366 | mConference = null; |
| 1367 | fireConferenceChanged(); |
| 1368 | } |
| 1369 | } |
| 1370 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1371 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1372 | * Notifies this Connection that the {@link #getAudioState()} property has a new value. |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1373 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1374 | * @param state The new connection audio state. |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1375 | */ |
Nancy Chen | 354b2bd | 2014-09-08 18:27:26 -0700 | [diff] [blame] | 1376 | public void onAudioStateChanged(AudioState state) {} |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1377 | |
| 1378 | /** |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1379 | * Notifies this Connection of an internal state change. This method is called after the |
| 1380 | * state is changed. |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1381 | * |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1382 | * @param state The new state, one of the {@code STATE_*} constants. |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1383 | */ |
Nancy Chen | 354b2bd | 2014-09-08 18:27:26 -0700 | [diff] [blame] | 1384 | public void onStateChanged(int state) {} |
Ihab Awad | f835897 | 2014-05-28 16:46:42 -0700 | [diff] [blame] | 1385 | |
| 1386 | /** |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1387 | * Notifies this Connection of a request to play a DTMF tone. |
| 1388 | * |
| 1389 | * @param c A DTMF character. |
| 1390 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1391 | public void onPlayDtmfTone(char c) {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1392 | |
| 1393 | /** |
| 1394 | * Notifies this Connection of a request to stop any currently playing DTMF tones. |
| 1395 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1396 | public void onStopDtmfTone() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1397 | |
| 1398 | /** |
| 1399 | * Notifies this Connection of a request to disconnect. |
| 1400 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1401 | public void onDisconnect() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1402 | |
| 1403 | /** |
Tyler Gunn | 3b4b1dc | 2014-11-04 14:53:37 -0800 | [diff] [blame] | 1404 | * Notifies this Connection of a request to disconnect a participant of the conference managed |
| 1405 | * by the connection. |
| 1406 | * |
| 1407 | * @param endpoint the {@link Uri} of the participant to disconnect. |
| 1408 | * @hide |
| 1409 | */ |
| 1410 | public void onDisconnectConferenceParticipant(Uri endpoint) {} |
| 1411 | |
| 1412 | /** |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1413 | * Notifies this Connection of a request to separate from its parent conference. |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1414 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1415 | public void onSeparate() {} |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 1416 | |
| 1417 | /** |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1418 | * Notifies this Connection of a request to abort. |
| 1419 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1420 | public void onAbort() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1421 | |
| 1422 | /** |
| 1423 | * Notifies this Connection of a request to hold. |
| 1424 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1425 | public void onHold() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1426 | |
| 1427 | /** |
| 1428 | * Notifies this Connection of a request to exit a hold state. |
| 1429 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1430 | public void onUnhold() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1431 | |
| 1432 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1433 | * Notifies this Connection, which is in {@link #STATE_RINGING}, of |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1434 | * a request to accept. |
Andrew Lee | 8da4c3c | 2014-07-16 10:11:42 -0700 | [diff] [blame] | 1435 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1436 | * @param videoState The video state in which to answer the connection. |
Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 1437 | * @hide |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1438 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1439 | public void onAnswer(int videoState) {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1440 | |
| 1441 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1442 | * Notifies this Connection, which is in {@link #STATE_RINGING}, of |
Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 1443 | * a request to accept. |
| 1444 | */ |
| 1445 | public void onAnswer() { |
| 1446 | onAnswer(VideoProfile.VideoState.AUDIO_ONLY); |
| 1447 | } |
| 1448 | |
| 1449 | /** |
| 1450 | * Notifies this Connection, which is in {@link #STATE_RINGING}, of |
Santos Cordon | d34e571 | 2014-08-05 18:54:03 +0000 | [diff] [blame] | 1451 | * a request to reject. |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1452 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1453 | public void onReject() {} |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1454 | |
Evan Charlton | 6dea4ac | 2014-06-03 14:07:13 -0700 | [diff] [blame] | 1455 | /** |
| 1456 | * Notifies this Connection whether the user wishes to proceed with the post-dial DTMF codes. |
| 1457 | */ |
Santos Cordon | f295110 | 2014-07-20 19:06:29 -0700 | [diff] [blame] | 1458 | public void onPostDialContinue(boolean proceed) {} |
Evan Charlton | 6dea4ac | 2014-06-03 14:07:13 -0700 | [diff] [blame] | 1459 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1460 | static String toLogSafePhoneNumber(String number) { |
| 1461 | // For unknown number, log empty string. |
| 1462 | if (number == null) { |
| 1463 | return ""; |
| 1464 | } |
| 1465 | |
| 1466 | if (PII_DEBUG) { |
| 1467 | // When PII_DEBUG is true we emit PII. |
| 1468 | return number; |
| 1469 | } |
| 1470 | |
| 1471 | // Do exactly same thing as Uri#toSafeString() does, which will enable us to compare |
| 1472 | // sanitized phone numbers. |
| 1473 | StringBuilder builder = new StringBuilder(); |
| 1474 | for (int i = 0; i < number.length(); i++) { |
| 1475 | char c = number.charAt(i); |
| 1476 | if (c == '-' || c == '@' || c == '.') { |
| 1477 | builder.append(c); |
| 1478 | } else { |
| 1479 | builder.append('x'); |
| 1480 | } |
| 1481 | } |
| 1482 | return builder.toString(); |
| 1483 | } |
| 1484 | |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1485 | private void setState(int state) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1486 | checkImmutable(); |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1487 | if (mState == STATE_DISCONNECTED && mState != state) { |
| 1488 | Log.d(this, "Connection already DISCONNECTED; cannot transition out of this state."); |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1489 | return; |
Sailesh Nepal | 400cc48 | 2014-06-26 12:04:00 -0700 | [diff] [blame] | 1490 | } |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1491 | if (mState != state) { |
| 1492 | Log.d(this, "setState: %s", stateToString(state)); |
| 1493 | mState = state; |
Nancy Chen | 354b2bd | 2014-09-08 18:27:26 -0700 | [diff] [blame] | 1494 | onStateChanged(state); |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1495 | for (Listener l : mListeners) { |
| 1496 | l.onStateChanged(this, state); |
| 1497 | } |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1498 | } |
| 1499 | } |
| 1500 | |
Sailesh Nepal | cf7020b | 2014-08-20 10:07:19 -0700 | [diff] [blame] | 1501 | private static class FailureSignalingConnection extends Connection { |
Ihab Awad | 90e34e3 | 2014-12-01 16:23:17 -0800 | [diff] [blame] | 1502 | private boolean mImmutable = false; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1503 | public FailureSignalingConnection(DisconnectCause disconnectCause) { |
| 1504 | setDisconnected(disconnectCause); |
Ihab Awad | 90e34e3 | 2014-12-01 16:23:17 -0800 | [diff] [blame] | 1505 | mImmutable = true; |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1506 | } |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1507 | |
| 1508 | public void checkImmutable() { |
Ihab Awad | 90e34e3 | 2014-12-01 16:23:17 -0800 | [diff] [blame] | 1509 | if (mImmutable) { |
| 1510 | throw new UnsupportedOperationException("Connection is immutable"); |
| 1511 | } |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1512 | } |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1513 | } |
| 1514 | |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1515 | /** |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1516 | * Return a {@code Connection} which represents a failed connection attempt. The returned |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1517 | * {@code Connection} will have a {@link android.telecom.DisconnectCause} and as specified, |
| 1518 | * and a {@link #getState()} of {@link #STATE_DISCONNECTED}. |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1519 | * <p> |
| 1520 | * The returned {@code Connection} can be assumed to {@link #destroy()} itself when appropriate, |
| 1521 | * so users of this method need not maintain a reference to its return value to destroy it. |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1522 | * |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1523 | * @param disconnectCause The disconnect cause, ({@see android.telecomm.DisconnectCause}). |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1524 | * @return A {@code Connection} which indicates failure. |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1525 | */ |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1526 | public static Connection createFailedConnection(DisconnectCause disconnectCause) { |
| 1527 | return new FailureSignalingConnection(disconnectCause); |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1528 | } |
| 1529 | |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1530 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1531 | * Override to throw an {@link UnsupportedOperationException} if this {@code Connection} is |
| 1532 | * not intended to be mutated, e.g., if it is a marker for failure. Only for framework use; |
| 1533 | * this should never be un-@hide-den. |
| 1534 | * |
| 1535 | * @hide |
| 1536 | */ |
| 1537 | public void checkImmutable() {} |
| 1538 | |
| 1539 | /** |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1540 | * Return a {@code Connection} which represents a canceled connection attempt. The returned |
| 1541 | * {@code Connection} will have state {@link #STATE_DISCONNECTED}, and cannot be moved out of |
| 1542 | * that state. This connection should not be used for anything, and no other |
| 1543 | * {@code Connection}s should be attempted. |
| 1544 | * <p> |
Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 1545 | * so users of this method need not maintain a reference to its return value to destroy it. |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1546 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1547 | * @return A {@code Connection} which indicates that the underlying connection should |
| 1548 | * be canceled. |
Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1549 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 1550 | public static Connection createCanceledConnection() { |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1551 | return new FailureSignalingConnection(new DisconnectCause(DisconnectCause.CANCELED)); |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1552 | } |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1553 | |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 1554 | private final void fireOnConferenceableConnectionsChanged() { |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1555 | for (Listener l : mListeners) { |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1556 | l.onConferenceablesChanged(this, getConferenceables()); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1557 | } |
| 1558 | } |
| 1559 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1560 | private final void fireConferenceChanged() { |
| 1561 | for (Listener l : mListeners) { |
| 1562 | l.onConferenceChanged(this, mConference); |
| 1563 | } |
| 1564 | } |
| 1565 | |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1566 | private final void clearConferenceableList() { |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1567 | for (IConferenceable c : mConferenceables) { |
| 1568 | if (c instanceof Connection) { |
| 1569 | Connection connection = (Connection) c; |
| 1570 | connection.removeConnectionListener(mConnectionDeathListener); |
| 1571 | } else if (c instanceof Conference) { |
| 1572 | Conference conference = (Conference) c; |
| 1573 | conference.removeListener(mConferenceDeathListener); |
| 1574 | } |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1575 | } |
Tyler Gunn | 6d76ca0 | 2014-11-17 15:49:51 -0800 | [diff] [blame] | 1576 | mConferenceables.clear(); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 1577 | } |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 1578 | |
| 1579 | /** |
Tyler Gunn | ab4650c | 2014-11-06 20:06:23 -0800 | [diff] [blame] | 1580 | * Notifies listeners of a change to conference participant(s). |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 1581 | * |
Tyler Gunn | ab4650c | 2014-11-06 20:06:23 -0800 | [diff] [blame] | 1582 | * @param conferenceParticipants The participants. |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 1583 | * @hide |
| 1584 | */ |
Tyler Gunn | ab4650c | 2014-11-06 20:06:23 -0800 | [diff] [blame] | 1585 | protected final void updateConferenceParticipants( |
| 1586 | List<ConferenceParticipant> conferenceParticipants) { |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 1587 | for (Listener l : mListeners) { |
Tyler Gunn | ab4650c | 2014-11-06 20:06:23 -0800 | [diff] [blame] | 1588 | l.onConferenceParticipantsChanged(this, conferenceParticipants); |
Tyler Gunn | 3bffcf7 | 2014-10-28 13:51:27 -0700 | [diff] [blame] | 1589 | } |
| 1590 | } |
Tyler Gunn | 8a2b119 | 2015-01-29 11:47:24 -0800 | [diff] [blame] | 1591 | |
| 1592 | /** |
| 1593 | * Notifies listeners that a conference call has been started. |
Jay Shrauner | 55b9752 | 2015-04-09 15:15:43 -0700 | [diff] [blame] | 1594 | * @hide |
Tyler Gunn | 8a2b119 | 2015-01-29 11:47:24 -0800 | [diff] [blame] | 1595 | */ |
| 1596 | protected void notifyConferenceStarted() { |
| 1597 | for (Listener l : mListeners) { |
| 1598 | l.onConferenceStarted(); |
| 1599 | } |
| 1600 | } |
Ihab Awad | 542e0ea | 2014-05-16 10:22:16 -0700 | [diff] [blame] | 1601 | } |