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