Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -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; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 18 | |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 20 | import android.annotation.Nullable; |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
Tyler Gunn | 6c14a699 | 2019-02-04 15:12:06 -0800 | [diff] [blame] | 22 | import android.annotation.TestApi; |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 23 | import android.net.Uri; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 24 | import android.os.Bundle; |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 25 | import android.os.SystemClock; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 26 | import android.telecom.Connection.VideoProvider; |
Wei Huang | 7f7f72e | 2018-05-30 19:21:36 +0800 | [diff] [blame] | 27 | import android.telephony.ServiceState; |
| 28 | import android.telephony.TelephonyManager; |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 29 | import android.util.ArraySet; |
Evan Charlton | 0e094d9 | 2014-11-08 15:49:16 -0800 | [diff] [blame] | 30 | |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 31 | import java.util.ArrayList; |
Tyler Gunn | 071be6f | 2016-05-10 14:52:33 -0700 | [diff] [blame] | 32 | import java.util.Arrays; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 33 | import java.util.Collections; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 34 | import java.util.List; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 35 | import java.util.Locale; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 36 | import java.util.Set; |
| 37 | import java.util.concurrent.CopyOnWriteArrayList; |
| 38 | import java.util.concurrent.CopyOnWriteArraySet; |
| 39 | |
| 40 | /** |
| 41 | * Represents a conference call which can contain any number of {@link Connection} objects. |
| 42 | */ |
Yorke Lee | abfcfdc | 2015-05-13 18:55:18 -0700 | [diff] [blame] | 43 | public abstract class Conference extends Conferenceable { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 44 | |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 45 | /** |
| 46 | * Used to indicate that the conference connection time is not specified. If not specified, |
| 47 | * Telecom will set the connect time. |
| 48 | */ |
Jay Shrauner | 164a0ac | 2015-04-14 18:16:10 -0700 | [diff] [blame] | 49 | public static final long CONNECT_TIME_NOT_SPECIFIED = 0; |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 50 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 51 | /** @hide */ |
| 52 | public abstract static class Listener { |
| 53 | public void onStateChanged(Conference conference, int oldState, int newState) {} |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 54 | public void onDisconnected(Conference conference, DisconnectCause disconnectCause) {} |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 55 | public void onConnectionAdded(Conference conference, Connection connection) {} |
| 56 | public void onConnectionRemoved(Conference conference, Connection connection) {} |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 57 | public void onConferenceableConnectionsChanged( |
| 58 | Conference conference, List<Connection> conferenceableConnections) {} |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 59 | public void onDestroyed(Conference conference) {} |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 60 | public void onConnectionCapabilitiesChanged( |
| 61 | Conference conference, int connectionCapabilities) {} |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 62 | public void onConnectionPropertiesChanged( |
| 63 | Conference conference, int connectionProperties) {} |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 64 | public void onVideoStateChanged(Conference c, int videoState) { } |
| 65 | public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {} |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 66 | public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {} |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 67 | public void onExtrasChanged(Conference c, Bundle extras) {} |
| 68 | public void onExtrasRemoved(Conference c, List<String> keys) {} |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 69 | public void onConferenceStateChanged(Conference c, boolean isConference) {} |
| 70 | public void onAddressChanged(Conference c, Uri newAddress, int presentation) {} |
Hall Liu | c9bc1c6 | 2019-04-16 14:00:55 -0700 | [diff] [blame] | 71 | public void onConnectionEvent(Conference c, String event, Bundle extras) {} |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 72 | public void onCallerDisplayNameChanged( |
| 73 | Conference c, String callerDisplayName, int presentation) {} |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | private final Set<Listener> mListeners = new CopyOnWriteArraySet<>(); |
| 77 | private final List<Connection> mChildConnections = new CopyOnWriteArrayList<>(); |
Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 78 | private final List<Connection> mUnmodifiableChildConnections = |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 79 | Collections.unmodifiableList(mChildConnections); |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 80 | private final List<Connection> mConferenceableConnections = new ArrayList<>(); |
| 81 | private final List<Connection> mUnmodifiableConferenceableConnections = |
| 82 | Collections.unmodifiableList(mConferenceableConnections); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 83 | |
Jack Yu | 6714030 | 2015-12-10 12:27:58 -0800 | [diff] [blame] | 84 | private String mTelecomCallId; |
Jay Shrauner | 164a0ac | 2015-04-14 18:16:10 -0700 | [diff] [blame] | 85 | private PhoneAccountHandle mPhoneAccount; |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 86 | private CallAudioState mCallAudioState; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 87 | private int mState = Connection.STATE_NEW; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 88 | private DisconnectCause mDisconnectCause; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 89 | private int mConnectionCapabilities; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 90 | private int mConnectionProperties; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 91 | private String mDisconnectMessage; |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 92 | private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED; |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 93 | private long mConnectionStartElapsedRealTime = CONNECT_TIME_NOT_SPECIFIED; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 94 | private StatusHints mStatusHints; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 95 | private Bundle mExtras; |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 96 | private Set<String> mPreviousExtraKeys; |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 97 | private final Object mExtrasLock = new Object(); |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 98 | private Uri mAddress; |
| 99 | private int mAddressPresentation; |
| 100 | private String mCallerDisplayName; |
| 101 | private int mCallerDisplayNamePresentation; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 102 | |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 103 | private final Connection.Listener mConnectionDeathListener = new Connection.Listener() { |
| 104 | @Override |
| 105 | public void onDestroyed(Connection c) { |
| 106 | if (mConferenceableConnections.remove(c)) { |
| 107 | fireOnConferenceableConnectionsChanged(); |
| 108 | } |
| 109 | } |
| 110 | }; |
| 111 | |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 112 | /** |
| 113 | * Constructs a new Conference with a mandatory {@link PhoneAccountHandle} |
| 114 | * |
| 115 | * @param phoneAccount The {@code PhoneAccountHandle} associated with the conference. |
| 116 | */ |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 117 | public Conference(PhoneAccountHandle phoneAccount) { |
| 118 | mPhoneAccount = phoneAccount; |
| 119 | } |
| 120 | |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 121 | /** |
Jack Yu | 6714030 | 2015-12-10 12:27:58 -0800 | [diff] [blame] | 122 | * Returns the telecom internal call ID associated with this conference. |
| 123 | * |
| 124 | * @return The telecom call ID. |
| 125 | * @hide |
| 126 | */ |
| 127 | public final String getTelecomCallId() { |
| 128 | return mTelecomCallId; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * Sets the telecom internal call ID associated with this conference. |
| 133 | * |
| 134 | * @param telecomCallId The telecom call ID. |
| 135 | * @hide |
| 136 | */ |
| 137 | public final void setTelecomCallId(String telecomCallId) { |
| 138 | mTelecomCallId = telecomCallId; |
| 139 | } |
| 140 | |
| 141 | /** |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 142 | * Returns the {@link PhoneAccountHandle} the conference call is being placed through. |
| 143 | * |
| 144 | * @return A {@code PhoneAccountHandle} object representing the PhoneAccount of the conference. |
| 145 | */ |
Nancy Chen | ea38cca | 2014-09-05 16:38:49 -0700 | [diff] [blame] | 146 | public final PhoneAccountHandle getPhoneAccountHandle() { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 147 | return mPhoneAccount; |
| 148 | } |
| 149 | |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 150 | /** |
| 151 | * Returns the list of connections currently associated with the conference call. |
| 152 | * |
| 153 | * @return A list of {@code Connection} objects which represent the children of the conference. |
| 154 | */ |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 155 | public final List<Connection> getConnections() { |
Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 156 | return mUnmodifiableChildConnections; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 157 | } |
| 158 | |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 159 | /** |
| 160 | * Gets the state of the conference call. See {@link Connection} for valid values. |
| 161 | * |
| 162 | * @return A constant representing the state the conference call is currently in. |
| 163 | */ |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 164 | public final int getState() { |
| 165 | return mState; |
| 166 | } |
| 167 | |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 168 | /** |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 169 | * Returns the capabilities of the conference. See {@code CAPABILITY_*} constants in class |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 170 | * {@link Connection} for valid values. |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 171 | * |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 172 | * @return A bitmask of the capabilities of the conference call. |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 173 | */ |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 174 | public final int getConnectionCapabilities() { |
| 175 | return mConnectionCapabilities; |
| 176 | } |
| 177 | |
| 178 | /** |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 179 | * Returns the properties of the conference. See {@code PROPERTY_*} constants in class |
| 180 | * {@link Connection} for valid values. |
| 181 | * |
| 182 | * @return A bitmask of the properties of the conference call. |
| 183 | */ |
| 184 | public final int getConnectionProperties() { |
| 185 | return mConnectionProperties; |
| 186 | } |
| 187 | |
| 188 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 189 | * Whether the given capabilities support the specified capability. |
| 190 | * |
| 191 | * @param capabilities A capability bit field. |
| 192 | * @param capability The capability to check capabilities for. |
| 193 | * @return Whether the specified capability is supported. |
| 194 | * @hide |
| 195 | */ |
| 196 | public static boolean can(int capabilities, int capability) { |
| 197 | return (capabilities & capability) != 0; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * Whether the capabilities of this {@code Connection} supports the specified capability. |
| 202 | * |
| 203 | * @param capability The capability to check capabilities for. |
| 204 | * @return Whether the specified capability is supported. |
| 205 | * @hide |
| 206 | */ |
| 207 | public boolean can(int capability) { |
| 208 | return can(mConnectionCapabilities, capability); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Removes the specified capability from the set of capabilities of this {@code Conference}. |
| 213 | * |
| 214 | * @param capability The capability to remove from the set. |
| 215 | * @hide |
| 216 | */ |
| 217 | public void removeCapability(int capability) { |
Omkar Kolangade | a0f46a9 | 2015-03-23 17:51:16 -0700 | [diff] [blame] | 218 | int newCapabilities = mConnectionCapabilities; |
| 219 | newCapabilities &= ~capability; |
| 220 | |
| 221 | setConnectionCapabilities(newCapabilities); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Adds the specified capability to the set of capabilities of this {@code Conference}. |
| 226 | * |
| 227 | * @param capability The capability to add to the set. |
| 228 | * @hide |
| 229 | */ |
| 230 | public void addCapability(int capability) { |
Omkar Kolangade | a0f46a9 | 2015-03-23 17:51:16 -0700 | [diff] [blame] | 231 | int newCapabilities = mConnectionCapabilities; |
| 232 | newCapabilities |= capability; |
| 233 | |
| 234 | setConnectionCapabilities(newCapabilities); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 235 | } |
| 236 | |
| 237 | /** |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 238 | * @return The audio state of the conference, describing how its audio is currently |
| 239 | * being routed by the system. This is {@code null} if this Conference |
| 240 | * does not directly know about its audio state. |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 241 | * @deprecated Use {@link #getCallAudioState()} instead. |
| 242 | * @hide |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 243 | */ |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 244 | @Deprecated |
| 245 | @SystemApi |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 246 | public final AudioState getAudioState() { |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 247 | return new AudioState(mCallAudioState); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * @return The audio state of the conference, describing how its audio is currently |
| 252 | * being routed by the system. This is {@code null} if this Conference |
| 253 | * does not directly know about its audio state. |
| 254 | */ |
| 255 | public final CallAudioState getCallAudioState() { |
| 256 | return mCallAudioState; |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | /** |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 260 | * Returns VideoProvider of the primary call. This can be null. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 261 | */ |
| 262 | public VideoProvider getVideoProvider() { |
| 263 | return null; |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Returns video state of the primary call. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 268 | */ |
| 269 | public int getVideoState() { |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 270 | return VideoProfile.STATE_AUDIO_ONLY; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 274 | * Notifies the {@link Conference} when the Conference and all it's {@link Connection}s should |
| 275 | * be disconnected. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 276 | */ |
| 277 | public void onDisconnect() {} |
| 278 | |
| 279 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 280 | * Notifies the {@link Conference} when the specified {@link Connection} should be separated |
| 281 | * from the conference call. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 282 | * |
| 283 | * @param connection The connection to separate. |
| 284 | */ |
| 285 | public void onSeparate(Connection connection) {} |
| 286 | |
| 287 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 288 | * Notifies the {@link Conference} when the specified {@link Connection} should merged with the |
| 289 | * conference call. |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 290 | * |
| 291 | * @param connection The {@code Connection} to merge. |
| 292 | */ |
| 293 | public void onMerge(Connection connection) {} |
| 294 | |
| 295 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 296 | * Notifies the {@link Conference} when it should be put on hold. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 297 | */ |
| 298 | public void onHold() {} |
| 299 | |
| 300 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 301 | * Notifies the {@link Conference} when it should be moved from a held to active state. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 302 | */ |
| 303 | public void onUnhold() {} |
| 304 | |
| 305 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 306 | * Notifies the {@link Conference} when the child calls should be merged. Only invoked if the |
| 307 | * conference contains the capability {@link Connection#CAPABILITY_MERGE_CONFERENCE}. |
Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 308 | */ |
| 309 | public void onMerge() {} |
| 310 | |
| 311 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 312 | * Notifies the {@link Conference} when the child calls should be swapped. Only invoked if the |
| 313 | * conference contains the capability {@link Connection#CAPABILITY_SWAP_CONFERENCE}. |
Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 314 | */ |
| 315 | public void onSwap() {} |
| 316 | |
| 317 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 318 | * Notifies the {@link Conference} of a request to play a DTMF tone. |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 319 | * |
| 320 | * @param c A DTMF character. |
| 321 | */ |
| 322 | public void onPlayDtmfTone(char c) {} |
| 323 | |
| 324 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 325 | * Notifies the {@link Conference} of a request to stop any currently playing DTMF tones. |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 326 | */ |
| 327 | public void onStopDtmfTone() {} |
| 328 | |
| 329 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 330 | * Notifies the {@link Conference} that the {@link #getAudioState()} property has a new value. |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 331 | * |
| 332 | * @param state The new call audio state. |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 333 | * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState)} instead. |
| 334 | * @hide |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 335 | */ |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 336 | @SystemApi |
| 337 | @Deprecated |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 338 | public void onAudioStateChanged(AudioState state) {} |
| 339 | |
| 340 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 341 | * Notifies the {@link Conference} that the {@link #getCallAudioState()} property has a new |
| 342 | * value. |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 343 | * |
| 344 | * @param state The new call audio state. |
| 345 | */ |
| 346 | public void onCallAudioStateChanged(CallAudioState state) {} |
| 347 | |
| 348 | /** |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 349 | * Notifies the {@link Conference} that a {@link Connection} has been added to it. |
Andrew Lee | 46f7f5d | 2014-11-06 17:00:25 -0800 | [diff] [blame] | 350 | * |
| 351 | * @param connection The newly added connection. |
| 352 | */ |
| 353 | public void onConnectionAdded(Connection connection) {} |
| 354 | |
| 355 | /** |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 356 | * Sets state to be on hold. |
| 357 | */ |
| 358 | public final void setOnHold() { |
| 359 | setState(Connection.STATE_HOLDING); |
| 360 | } |
| 361 | |
| 362 | /** |
Tyler Gunn | d46595a | 2015-06-01 14:29:11 -0700 | [diff] [blame] | 363 | * Sets state to be dialing. |
| 364 | */ |
| 365 | public final void setDialing() { |
| 366 | setState(Connection.STATE_DIALING); |
| 367 | } |
| 368 | |
| 369 | /** |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 370 | * Sets state to be active. |
| 371 | */ |
| 372 | public final void setActive() { |
| 373 | setState(Connection.STATE_ACTIVE); |
| 374 | } |
| 375 | |
| 376 | /** |
| 377 | * Sets state to disconnected. |
| 378 | * |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 379 | * @param disconnectCause The reason for the disconnection, as described by |
| 380 | * {@link android.telecom.DisconnectCause}. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 381 | */ |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 382 | public final void setDisconnected(DisconnectCause disconnectCause) { |
| 383 | mDisconnectCause = disconnectCause;; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 384 | setState(Connection.STATE_DISCONNECTED); |
| 385 | for (Listener l : mListeners) { |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 386 | l.onDisconnected(this, mDisconnectCause); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
| 390 | /** |
mike dooley | 1cf14ac | 2014-11-04 10:59:53 -0800 | [diff] [blame] | 391 | * @return The {@link DisconnectCause} for this connection. |
| 392 | */ |
| 393 | public final DisconnectCause getDisconnectCause() { |
| 394 | return mDisconnectCause; |
| 395 | } |
| 396 | |
| 397 | /** |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 398 | * Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class |
| 399 | * {@link Connection} for valid values. |
Nancy Chen | 56fc25d | 2014-09-09 12:24:51 -0700 | [diff] [blame] | 400 | * |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 401 | * @param connectionCapabilities A bitmask of the {@code Capabilities} of the conference call. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 402 | */ |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 403 | public final void setConnectionCapabilities(int connectionCapabilities) { |
| 404 | if (connectionCapabilities != mConnectionCapabilities) { |
| 405 | mConnectionCapabilities = connectionCapabilities; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 406 | |
| 407 | for (Listener l : mListeners) { |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 408 | l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | /** |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 414 | * Sets the properties of a conference. See {@code PROPERTY_*} constants of class |
| 415 | * {@link Connection} for valid values. |
| 416 | * |
| 417 | * @param connectionProperties A bitmask of the {@code Properties} of the conference call. |
| 418 | */ |
| 419 | public final void setConnectionProperties(int connectionProperties) { |
| 420 | if (connectionProperties != mConnectionProperties) { |
| 421 | mConnectionProperties = connectionProperties; |
| 422 | |
| 423 | for (Listener l : mListeners) { |
| 424 | l.onConnectionPropertiesChanged(this, mConnectionProperties); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | |
| 429 | /** |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 430 | * Adds the specified connection as a child of this conference. |
| 431 | * |
| 432 | * @param connection The connection to add. |
| 433 | * @return True if the connection was successfully added. |
| 434 | */ |
Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 435 | public final boolean addConnection(Connection connection) { |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 436 | Log.d(this, "Connection=%s, connection=", connection); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 437 | if (connection != null && !mChildConnections.contains(connection)) { |
| 438 | if (connection.setConference(this)) { |
| 439 | mChildConnections.add(connection); |
Andrew Lee | 46f7f5d | 2014-11-06 17:00:25 -0800 | [diff] [blame] | 440 | onConnectionAdded(connection); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 441 | for (Listener l : mListeners) { |
| 442 | l.onConnectionAdded(this, connection); |
| 443 | } |
| 444 | return true; |
| 445 | } |
| 446 | } |
| 447 | return false; |
| 448 | } |
| 449 | |
| 450 | /** |
| 451 | * Removes the specified connection as a child of this conference. |
| 452 | * |
| 453 | * @param connection The connection to remove. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 454 | */ |
Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 455 | public final void removeConnection(Connection connection) { |
Santos Cordon | 0159ac0 | 2014-08-21 14:28:11 -0700 | [diff] [blame] | 456 | Log.d(this, "removing %s from %s", connection, mChildConnections); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 457 | if (connection != null && mChildConnections.remove(connection)) { |
| 458 | connection.resetConference(); |
| 459 | for (Listener l : mListeners) { |
| 460 | l.onConnectionRemoved(this, connection); |
| 461 | } |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | /** |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 466 | * Sets the connections with which this connection can be conferenced. |
| 467 | * |
| 468 | * @param conferenceableConnections The set of connections this connection can conference with. |
| 469 | */ |
| 470 | public final void setConferenceableConnections(List<Connection> conferenceableConnections) { |
| 471 | clearConferenceableList(); |
| 472 | for (Connection c : conferenceableConnections) { |
| 473 | // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a |
| 474 | // small amount of items here. |
| 475 | if (!mConferenceableConnections.contains(c)) { |
| 476 | c.addConnectionListener(mConnectionDeathListener); |
| 477 | mConferenceableConnections.add(c); |
| 478 | } |
| 479 | } |
| 480 | fireOnConferenceableConnectionsChanged(); |
| 481 | } |
| 482 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 483 | /** |
| 484 | * Set the video state for the conference. |
Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 485 | * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, |
| 486 | * {@link VideoProfile#STATE_BIDIRECTIONAL}, |
| 487 | * {@link VideoProfile#STATE_TX_ENABLED}, |
| 488 | * {@link VideoProfile#STATE_RX_ENABLED}. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 489 | * |
| 490 | * @param videoState The new video state. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 491 | */ |
| 492 | public final void setVideoState(Connection c, int videoState) { |
| 493 | Log.d(this, "setVideoState Conference: %s Connection: %s VideoState: %s", |
| 494 | this, c, videoState); |
| 495 | for (Listener l : mListeners) { |
| 496 | l.onVideoStateChanged(this, videoState); |
| 497 | } |
| 498 | } |
| 499 | |
| 500 | /** |
| 501 | * Sets the video connection provider. |
| 502 | * |
| 503 | * @param videoProvider The video provider. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 504 | */ |
| 505 | public final void setVideoProvider(Connection c, Connection.VideoProvider videoProvider) { |
| 506 | Log.d(this, "setVideoProvider Conference: %s Connection: %s VideoState: %s", |
| 507 | this, c, videoProvider); |
| 508 | for (Listener l : mListeners) { |
| 509 | l.onVideoProviderChanged(this, videoProvider); |
| 510 | } |
| 511 | } |
| 512 | |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 513 | private final void fireOnConferenceableConnectionsChanged() { |
| 514 | for (Listener l : mListeners) { |
| 515 | l.onConferenceableConnectionsChanged(this, getConferenceableConnections()); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | /** |
| 520 | * Returns the connections with which this connection can be conferenced. |
| 521 | */ |
| 522 | public final List<Connection> getConferenceableConnections() { |
| 523 | return mUnmodifiableConferenceableConnections; |
| 524 | } |
| 525 | |
| 526 | /** |
Nancy Chen | ea38cca | 2014-09-05 16:38:49 -0700 | [diff] [blame] | 527 | * Tears down the conference object and any of its current connections. |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 528 | */ |
Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 529 | public final void destroy() { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 530 | Log.d(this, "destroying conference : %s", this); |
| 531 | // Tear down the children. |
Santos Cordon | 0159ac0 | 2014-08-21 14:28:11 -0700 | [diff] [blame] | 532 | for (Connection connection : mChildConnections) { |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 533 | Log.d(this, "removing connection %s", connection); |
| 534 | removeConnection(connection); |
| 535 | } |
| 536 | |
| 537 | // If not yet disconnected, set the conference call as disconnected first. |
| 538 | if (mState != Connection.STATE_DISCONNECTED) { |
| 539 | Log.d(this, "setting to disconnected"); |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 540 | setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 541 | } |
| 542 | |
| 543 | // ...and notify. |
| 544 | for (Listener l : mListeners) { |
| 545 | l.onDestroyed(this); |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | /** |
| 550 | * Add a listener to be notified of a state change. |
| 551 | * |
| 552 | * @param listener The new listener. |
| 553 | * @return This conference. |
| 554 | * @hide |
| 555 | */ |
| 556 | public final Conference addListener(Listener listener) { |
| 557 | mListeners.add(listener); |
| 558 | return this; |
| 559 | } |
| 560 | |
| 561 | /** |
| 562 | * Removes the specified listener. |
| 563 | * |
| 564 | * @param listener The listener to remove. |
| 565 | * @return This conference. |
| 566 | * @hide |
| 567 | */ |
| 568 | public final Conference removeListener(Listener listener) { |
| 569 | mListeners.remove(listener); |
| 570 | return this; |
| 571 | } |
| 572 | |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 573 | /** |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 574 | * Retrieves the primary connection associated with the conference. The primary connection is |
| 575 | * the connection from which the conference will retrieve its current state. |
| 576 | * |
| 577 | * @return The primary connection. |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 578 | * @hide |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 579 | */ |
Tyler Gunn | 6c14a699 | 2019-02-04 15:12:06 -0800 | [diff] [blame] | 580 | @TestApi |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 581 | @SystemApi |
Santos Cordon | 4055d64 | 2015-05-12 14:19:24 -0700 | [diff] [blame] | 582 | public Connection getPrimaryConnection() { |
Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 583 | if (mUnmodifiableChildConnections == null || mUnmodifiableChildConnections.isEmpty()) { |
| 584 | return null; |
| 585 | } |
| 586 | return mUnmodifiableChildConnections.get(0); |
| 587 | } |
| 588 | |
| 589 | /** |
Wei Huang | 7f7f72e | 2018-05-30 19:21:36 +0800 | [diff] [blame] | 590 | * Updates RIL voice radio technology used for current conference after its creation. |
| 591 | * |
| 592 | * @hide |
| 593 | */ |
| 594 | public void updateCallRadioTechAfterCreation() { |
| 595 | final Connection primaryConnection = getPrimaryConnection(); |
| 596 | if (primaryConnection != null) { |
| 597 | setCallRadioTech(primaryConnection.getCallRadioTech()); |
| 598 | } else { |
| 599 | Log.w(this, "No primary connection found while updateCallRadioTechAfterCreation"); |
| 600 | } |
| 601 | } |
| 602 | |
| 603 | /** |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 604 | * @hide |
| 605 | * @deprecated Use {@link #setConnectionTime}. |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 606 | */ |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 607 | @Deprecated |
| 608 | @SystemApi |
| 609 | public final void setConnectTimeMillis(long connectTimeMillis) { |
| 610 | setConnectionTime(connectTimeMillis); |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 611 | } |
| 612 | |
| 613 | /** |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 614 | * Sets the connection start time of the {@code Conference}. This is used in the call log to |
| 615 | * indicate the date and time when the conference took place. |
| 616 | * <p> |
| 617 | * Should be specified in wall-clock time returned by {@link System#currentTimeMillis()}. |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 618 | * <p> |
| 619 | * When setting the connection time, you should always set the connection elapsed time via |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 620 | * {@link #setConnectionStartElapsedRealTime(long)} to ensure the duration is reflected. |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 621 | * |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 622 | * @param connectionTimeMillis The connection time, in milliseconds, as returned by |
| 623 | * {@link System#currentTimeMillis()}. |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 624 | */ |
| 625 | public final void setConnectionTime(long connectionTimeMillis) { |
| 626 | mConnectTimeMillis = connectionTimeMillis; |
| 627 | } |
| 628 | |
| 629 | /** |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 630 | * Sets the start time of the {@link Conference} which is the basis for the determining the |
| 631 | * duration of the {@link Conference}. |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 632 | * <p> |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 633 | * You should use a value returned by {@link SystemClock#elapsedRealtime()} to ensure that time |
| 634 | * zone changes do not impact the conference duration. |
| 635 | * <p> |
| 636 | * When setting this, you should also set the connection time via |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 637 | * {@link #setConnectionTime(long)}. |
| 638 | * |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 639 | * @param connectionStartElapsedRealTime The connection time, as measured by |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 640 | * {@link SystemClock#elapsedRealtime()}. |
| 641 | */ |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 642 | public final void setConnectionStartElapsedRealTime(long connectionStartElapsedRealTime) { |
| 643 | mConnectionStartElapsedRealTime = connectionStartElapsedRealTime; |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 644 | } |
| 645 | |
| 646 | /** |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 647 | * @hide |
| 648 | * @deprecated Use {@link #getConnectionTime}. |
| 649 | */ |
| 650 | @Deprecated |
| 651 | @SystemApi |
| 652 | public final long getConnectTimeMillis() { |
| 653 | return getConnectionTime(); |
| 654 | } |
| 655 | |
| 656 | /** |
| 657 | * Retrieves the connection start time of the {@code Conference}, if specified. A value of |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 658 | * {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time |
| 659 | * of the conference. |
| 660 | * |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 661 | * @return The time at which the {@code Conference} was connected. |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 662 | */ |
Santos Cordon | 5d2e4f2 | 2015-05-12 12:32:51 -0700 | [diff] [blame] | 663 | public final long getConnectionTime() { |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 664 | return mConnectTimeMillis; |
| 665 | } |
| 666 | |
| 667 | /** |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 668 | * Retrieves the connection start time of the {@link Conference}, if specified. A value of |
| 669 | * {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time |
| 670 | * of the conference. |
| 671 | * |
| 672 | * This is based on the value of {@link SystemClock#elapsedRealtime()} to ensure that it is not |
| 673 | * impacted by wall clock changes (user initiated, network initiated, time zone change, etc). |
| 674 | * |
| 675 | * @return The elapsed time at which the {@link Conference} was connected. |
| 676 | * @hide |
| 677 | */ |
Tyler Gunn | 1754139 | 2018-02-01 08:58:38 -0800 | [diff] [blame] | 678 | public final long getConnectionStartElapsedRealTime() { |
| 679 | return mConnectionStartElapsedRealTime; |
Tyler Gunn | 3fa819c | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 680 | } |
| 681 | |
| 682 | /** |
Wei Huang | 7f7f72e | 2018-05-30 19:21:36 +0800 | [diff] [blame] | 683 | * Sets RIL voice radio technology used for current conference. |
| 684 | * |
| 685 | * @param vrat the RIL voice radio technology used for current conference, |
| 686 | * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. |
| 687 | * |
| 688 | * @hide |
| 689 | */ |
| 690 | public final void setCallRadioTech(@ServiceState.RilRadioTechnology int vrat) { |
| 691 | putExtra(TelecomManager.EXTRA_CALL_NETWORK_TYPE, |
| 692 | ServiceState.rilRadioTechnologyToNetworkType(vrat)); |
| 693 | } |
| 694 | |
| 695 | /** |
| 696 | * Returns RIL voice radio technology used for current conference. |
| 697 | * |
| 698 | * @return the RIL voice radio technology used for current conference, |
| 699 | * see {@code RIL_RADIO_TECHNOLOGY_*} in {@link android.telephony.ServiceState}. |
| 700 | * |
| 701 | * @hide |
| 702 | */ |
| 703 | public final @ServiceState.RilRadioTechnology int getCallRadioTech() { |
| 704 | int voiceNetworkType = TelephonyManager.NETWORK_TYPE_UNKNOWN; |
| 705 | Bundle extras = getExtras(); |
| 706 | if (extras != null) { |
| 707 | voiceNetworkType = extras.getInt(TelecomManager.EXTRA_CALL_NETWORK_TYPE, |
| 708 | TelephonyManager.NETWORK_TYPE_UNKNOWN); |
| 709 | } |
| 710 | return ServiceState.networkTypeToRilRadioTechnology(voiceNetworkType); |
| 711 | } |
| 712 | |
| 713 | /** |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 714 | * Inform this Conference that the state of its audio output has been changed externally. |
| 715 | * |
| 716 | * @param state The new audio state. |
| 717 | * @hide |
| 718 | */ |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 719 | final void setCallAudioState(CallAudioState state) { |
| 720 | Log.d(this, "setCallAudioState %s", state); |
| 721 | mCallAudioState = state; |
| 722 | onAudioStateChanged(getAudioState()); |
| 723 | onCallAudioStateChanged(state); |
Yorke Lee | a0d3ca9 | 2014-09-15 19:18:13 -0700 | [diff] [blame] | 724 | } |
| 725 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 726 | private void setState(int newState) { |
| 727 | if (newState != Connection.STATE_ACTIVE && |
| 728 | newState != Connection.STATE_HOLDING && |
| 729 | newState != Connection.STATE_DISCONNECTED) { |
| 730 | Log.w(this, "Unsupported state transition for Conference call.", |
| 731 | Connection.stateToString(newState)); |
| 732 | return; |
| 733 | } |
| 734 | |
| 735 | if (mState != newState) { |
| 736 | int oldState = mState; |
| 737 | mState = newState; |
| 738 | for (Listener l : mListeners) { |
| 739 | l.onStateChanged(this, oldState, newState); |
| 740 | } |
| 741 | } |
| 742 | } |
Ihab Awad | 50e3506 | 2014-09-30 09:17:03 -0700 | [diff] [blame] | 743 | |
| 744 | private final void clearConferenceableList() { |
| 745 | for (Connection c : mConferenceableConnections) { |
| 746 | c.removeConnectionListener(mConnectionDeathListener); |
| 747 | } |
| 748 | mConferenceableConnections.clear(); |
| 749 | } |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 750 | |
| 751 | @Override |
| 752 | public String toString() { |
| 753 | return String.format(Locale.US, |
| 754 | "[State: %s,Capabilites: %s, VideoState: %s, VideoProvider: %s, ThisObject %s]", |
| 755 | Connection.stateToString(mState), |
| 756 | Call.Details.capabilitiesToString(mConnectionCapabilities), |
| 757 | getVideoState(), |
| 758 | getVideoProvider(), |
| 759 | super.toString()); |
| 760 | } |
Andrew Lee | 0f51da3 | 2015-04-16 13:11:55 -0700 | [diff] [blame] | 761 | |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 762 | /** |
| 763 | * Sets the label and icon status to display in the InCall UI. |
| 764 | * |
| 765 | * @param statusHints The status label and icon to set. |
| 766 | */ |
| 767 | public final void setStatusHints(StatusHints statusHints) { |
| 768 | mStatusHints = statusHints; |
| 769 | for (Listener l : mListeners) { |
| 770 | l.onStatusHintsChanged(this, statusHints); |
| 771 | } |
| 772 | } |
| 773 | |
| 774 | /** |
| 775 | * @return The status hints for this conference. |
| 776 | */ |
| 777 | public final StatusHints getStatusHints() { |
| 778 | return mStatusHints; |
| 779 | } |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 780 | |
| 781 | /** |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 782 | * Replaces all the extras associated with this {@code Conference}. |
| 783 | * <p> |
| 784 | * New or existing keys are replaced in the {@code Conference} extras. Keys which are no longer |
| 785 | * in the new extras, but were present the last time {@code setExtras} was called are removed. |
| 786 | * <p> |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 787 | * Alternatively you may use the {@link #putExtras(Bundle)}, and |
| 788 | * {@link #removeExtras(String...)} methods to modify the extras. |
| 789 | * <p> |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 790 | * No assumptions should be made as to how an In-Call UI or service will handle these extras. |
Tyler Gunn | 9c0eb0b | 2016-06-29 11:23:25 -0700 | [diff] [blame] | 791 | * Keys should be fully qualified (e.g., com.example.extras.MY_EXTRA) to avoid conflicts. |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 792 | * |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 793 | * @param extras The extras associated with this {@code Conference}. |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 794 | */ |
| 795 | public final void setExtras(@Nullable Bundle extras) { |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 796 | // Keeping putExtras and removeExtras in the same lock so that this operation happens as a |
| 797 | // block instead of letting other threads put/remove while this method is running. |
| 798 | synchronized (mExtrasLock) { |
| 799 | // Add/replace any new or changed extras values. |
| 800 | putExtras(extras); |
| 801 | // If we have used "setExtras" in the past, compare the key set from the last invocation |
| 802 | // to the current one and remove any keys that went away. |
| 803 | if (mPreviousExtraKeys != null) { |
| 804 | List<String> toRemove = new ArrayList<String>(); |
| 805 | for (String oldKey : mPreviousExtraKeys) { |
| 806 | if (extras == null || !extras.containsKey(oldKey)) { |
| 807 | toRemove.add(oldKey); |
| 808 | } |
| 809 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 810 | |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 811 | if (!toRemove.isEmpty()) { |
| 812 | removeExtras(toRemove); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 813 | } |
| 814 | } |
| 815 | |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 816 | // Track the keys the last time set called setExtras. This way, the next time setExtras |
| 817 | // is called we can see if the caller has removed any extras values. |
| 818 | if (mPreviousExtraKeys == null) { |
| 819 | mPreviousExtraKeys = new ArraySet<String>(); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 820 | } |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 821 | mPreviousExtraKeys.clear(); |
| 822 | if (extras != null) { |
| 823 | mPreviousExtraKeys.addAll(extras.keySet()); |
| 824 | } |
Tyler Gunn | a8fb8ab | 2016-03-29 10:24:22 -0700 | [diff] [blame] | 825 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 826 | } |
| 827 | |
| 828 | /** |
| 829 | * Adds some extras to this {@link Conference}. Existing keys are replaced and new ones are |
| 830 | * added. |
| 831 | * <p> |
| 832 | * No assumptions should be made as to how an In-Call UI or service will handle these extras. |
| 833 | * Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts. |
| 834 | * |
| 835 | * @param extras The extras to add. |
| 836 | */ |
| 837 | public final void putExtras(@NonNull Bundle extras) { |
| 838 | if (extras == null) { |
| 839 | return; |
| 840 | } |
| 841 | |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 842 | // Creating a Bundle clone so we don't have to synchronize on mExtrasLock while calling |
| 843 | // onExtrasChanged. |
| 844 | Bundle listenersBundle; |
| 845 | synchronized (mExtrasLock) { |
| 846 | if (mExtras == null) { |
| 847 | mExtras = new Bundle(); |
| 848 | } |
| 849 | mExtras.putAll(extras); |
| 850 | listenersBundle = new Bundle(mExtras); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 851 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 852 | |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 853 | for (Listener l : mListeners) { |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 854 | l.onExtrasChanged(this, new Bundle(listenersBundle)); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 855 | } |
| 856 | } |
| 857 | |
| 858 | /** |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 859 | * Adds a boolean extra to this {@link Conference}. |
| 860 | * |
| 861 | * @param key The extra key. |
| 862 | * @param value The value. |
| 863 | * @hide |
| 864 | */ |
| 865 | public final void putExtra(String key, boolean value) { |
| 866 | Bundle newExtras = new Bundle(); |
| 867 | newExtras.putBoolean(key, value); |
| 868 | putExtras(newExtras); |
| 869 | } |
| 870 | |
| 871 | /** |
| 872 | * Adds an integer extra to this {@link Conference}. |
| 873 | * |
| 874 | * @param key The extra key. |
| 875 | * @param value The value. |
| 876 | * @hide |
| 877 | */ |
| 878 | public final void putExtra(String key, int value) { |
| 879 | Bundle newExtras = new Bundle(); |
| 880 | newExtras.putInt(key, value); |
| 881 | putExtras(newExtras); |
| 882 | } |
| 883 | |
| 884 | /** |
| 885 | * Adds a string extra to this {@link Conference}. |
| 886 | * |
| 887 | * @param key The extra key. |
| 888 | * @param value The value. |
| 889 | * @hide |
| 890 | */ |
| 891 | public final void putExtra(String key, String value) { |
| 892 | Bundle newExtras = new Bundle(); |
| 893 | newExtras.putString(key, value); |
| 894 | putExtras(newExtras); |
| 895 | } |
| 896 | |
| 897 | /** |
Tyler Gunn | 071be6f | 2016-05-10 14:52:33 -0700 | [diff] [blame] | 898 | * Removes extras from this {@link Conference}. |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 899 | * |
Tyler Gunn | 071be6f | 2016-05-10 14:52:33 -0700 | [diff] [blame] | 900 | * @param keys The keys of the extras to remove. |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 901 | */ |
| 902 | public final void removeExtras(List<String> keys) { |
| 903 | if (keys == null || keys.isEmpty()) { |
| 904 | return; |
| 905 | } |
| 906 | |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 907 | synchronized (mExtrasLock) { |
| 908 | if (mExtras != null) { |
| 909 | for (String key : keys) { |
| 910 | mExtras.remove(key); |
| 911 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 912 | } |
| 913 | } |
| 914 | |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 915 | List<String> unmodifiableKeys = Collections.unmodifiableList(keys); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 916 | for (Listener l : mListeners) { |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 917 | l.onExtrasRemoved(this, unmodifiableKeys); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 918 | } |
| 919 | } |
| 920 | |
| 921 | /** |
Tyler Gunn | 071be6f | 2016-05-10 14:52:33 -0700 | [diff] [blame] | 922 | * Removes extras from this {@link Conference}. |
| 923 | * |
| 924 | * @param keys The keys of the extras to remove. |
| 925 | */ |
| 926 | public final void removeExtras(String ... keys) { |
| 927 | removeExtras(Arrays.asList(keys)); |
| 928 | } |
| 929 | |
| 930 | /** |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 931 | * Returns the extras associated with this conference. |
Tyler Gunn | 2cbe2b5 | 2016-05-04 15:48:10 +0000 | [diff] [blame] | 932 | * <p> |
| 933 | * Extras should be updated using {@link #putExtras(Bundle)} and {@link #removeExtras(List)}. |
| 934 | * <p> |
| 935 | * Telecom or an {@link InCallService} can also update the extras via |
| 936 | * {@link android.telecom.Call#putExtras(Bundle)}, and |
| 937 | * {@link Call#removeExtras(List)}. |
| 938 | * <p> |
| 939 | * The conference is notified of changes to the extras made by Telecom or an |
| 940 | * {@link InCallService} by {@link #onExtrasChanged(Bundle)}. |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 941 | * |
| 942 | * @return The extras associated with this connection. |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 943 | */ |
| 944 | public final Bundle getExtras() { |
| 945 | return mExtras; |
| 946 | } |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 947 | |
| 948 | /** |
| 949 | * Notifies this {@link Conference} of a change to the extras made outside the |
| 950 | * {@link ConnectionService}. |
| 951 | * <p> |
| 952 | * These extras changes can originate from Telecom itself, or from an {@link InCallService} via |
| 953 | * {@link android.telecom.Call#putExtras(Bundle)}, and |
| 954 | * {@link Call#removeExtras(List)}. |
| 955 | * |
| 956 | * @param extras The new extras bundle. |
| 957 | */ |
| 958 | public void onExtrasChanged(Bundle extras) {} |
| 959 | |
| 960 | /** |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 961 | * Set whether Telecom should treat this {@link Conference} as a conference call or if it |
| 962 | * should treat it as a single-party call. |
| 963 | * This method is used as part of a workaround regarding IMS conference calls and user |
| 964 | * expectation. In IMS, once a conference is formed, the UE is connected to an IMS conference |
| 965 | * server. If all participants of the conference drop out of the conference except for one, the |
| 966 | * UE is still connected to the IMS conference server. At this point, the user logically |
| 967 | * assumes they're no longer in a conference, yet the underlying network actually is. |
| 968 | * To help provide a better user experiece, IMS conference calls can pretend to actually be a |
| 969 | * single-party call when the participant count drops to 1. Although the dialer/phone app |
| 970 | * could perform this trickery, it makes sense to do this in Telephony since a fix there will |
| 971 | * ensure that bluetooth head units, auto and wearable apps all behave consistently. |
| 972 | * |
| 973 | * @param isConference {@code true} if this {@link Conference} should be treated like a |
| 974 | * conference call, {@code false} if it should be treated like a single-party call. |
| 975 | * @hide |
| 976 | */ |
| 977 | public void setConferenceState(boolean isConference) { |
| 978 | for (Listener l : mListeners) { |
| 979 | l.onConferenceStateChanged(this, isConference); |
| 980 | } |
| 981 | } |
| 982 | |
| 983 | /** |
| 984 | * Sets the address of this {@link Conference}. Used when {@link #setConferenceState(boolean)} |
| 985 | * is called to mark a conference temporarily as NOT a conference. |
| 986 | * |
| 987 | * @param address The new address. |
| 988 | * @param presentation The presentation requirements for the address. |
| 989 | * See {@link TelecomManager} for valid values. |
| 990 | * @hide |
| 991 | */ |
| 992 | public final void setAddress(Uri address, int presentation) { |
| 993 | Log.d(this, "setAddress %s", address); |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 994 | mAddress = address; |
| 995 | mAddressPresentation = presentation; |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 996 | for (Listener l : mListeners) { |
| 997 | l.onAddressChanged(this, address, presentation); |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | /** |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 1002 | * Returns the "address" associated with the conference. This is applicable in two cases: |
| 1003 | * <ol> |
| 1004 | * <li>When {@link #setConferenceState(boolean)} is used to mark a conference as |
| 1005 | * temporarily "not a conference"; we need to present the correct address in the in-call |
| 1006 | * UI.</li> |
| 1007 | * <li>When the conference is not hosted on the current device, we need to know the address |
| 1008 | * information for the purpose of showing the original address to the user, as well as for |
| 1009 | * logging to the call log.</li> |
| 1010 | * </ol> |
| 1011 | * @return The address of the conference, or {@code null} if not applicable. |
| 1012 | * @hide |
| 1013 | */ |
| 1014 | public final Uri getAddress() { |
| 1015 | return mAddress; |
| 1016 | } |
| 1017 | |
| 1018 | /** |
| 1019 | * Returns the address presentation associated with the conference. |
| 1020 | * <p> |
| 1021 | * This is applicable in two cases: |
| 1022 | * <ol> |
| 1023 | * <li>When {@link #setConferenceState(boolean)} is used to mark a conference as |
| 1024 | * temporarily "not a conference"; we need to present the correct address in the in-call |
| 1025 | * UI.</li> |
| 1026 | * <li>When the conference is not hosted on the current device, we need to know the address |
| 1027 | * information for the purpose of showing the original address to the user, as well as for |
| 1028 | * logging to the call log.</li> |
| 1029 | * </ol> |
| 1030 | * @return The address of the conference, or {@code null} if not applicable. |
| 1031 | * @hide |
| 1032 | */ |
| 1033 | public final int getAddressPresentation() { |
| 1034 | return mAddressPresentation; |
| 1035 | } |
| 1036 | |
| 1037 | /** |
| 1038 | * @return The caller display name (CNAP). |
| 1039 | * @hide |
| 1040 | */ |
| 1041 | public final String getCallerDisplayName() { |
| 1042 | return mCallerDisplayName; |
| 1043 | } |
| 1044 | |
| 1045 | /** |
| 1046 | * @return The presentation requirements for the handle. |
| 1047 | * See {@link TelecomManager} for valid values. |
| 1048 | * @hide |
| 1049 | */ |
| 1050 | public final int getCallerDisplayNamePresentation() { |
| 1051 | return mCallerDisplayNamePresentation; |
| 1052 | } |
| 1053 | |
| 1054 | /** |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 1055 | * Sets the caller display name (CNAP) of this {@link Conference}. Used when |
| 1056 | * {@link #setConferenceState(boolean)} is called to mark a conference temporarily as NOT a |
| 1057 | * conference. |
| 1058 | * |
| 1059 | * @param callerDisplayName The new display name. |
| 1060 | * @param presentation The presentation requirements for the handle. |
| 1061 | * See {@link TelecomManager} for valid values. |
| 1062 | * @hide |
| 1063 | */ |
| 1064 | public final void setCallerDisplayName(String callerDisplayName, int presentation) { |
| 1065 | Log.d(this, "setCallerDisplayName %s", callerDisplayName); |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 1066 | mCallerDisplayName = callerDisplayName; |
| 1067 | mCallerDisplayNamePresentation = presentation; |
Tyler Gunn | 68a73a4 | 2018-10-03 15:38:57 -0700 | [diff] [blame] | 1068 | for (Listener l : mListeners) { |
| 1069 | l.onCallerDisplayNameChanged(this, callerDisplayName, presentation); |
| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | /** |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 1074 | * Handles a change to extras received from Telecom. |
| 1075 | * |
| 1076 | * @param extras The new extras. |
| 1077 | * @hide |
| 1078 | */ |
| 1079 | final void handleExtrasChanged(Bundle extras) { |
Brad Ebinger | 4fa6a01 | 2016-06-14 17:04:01 -0700 | [diff] [blame] | 1080 | Bundle b = null; |
| 1081 | synchronized (mExtrasLock) { |
| 1082 | mExtras = extras; |
| 1083 | if (mExtras != null) { |
| 1084 | b = new Bundle(mExtras); |
| 1085 | } |
| 1086 | } |
| 1087 | onExtrasChanged(b); |
Tyler Gunn | dee56a8 | 2016-03-23 16:06:34 -0700 | [diff] [blame] | 1088 | } |
Hall Liu | c9bc1c6 | 2019-04-16 14:00:55 -0700 | [diff] [blame] | 1089 | |
| 1090 | /** |
| 1091 | * See {@link Connection#sendConnectionEvent(String, Bundle)} |
| 1092 | * @hide |
| 1093 | */ |
| 1094 | public void sendConnectionEvent(String event, Bundle extras) { |
| 1095 | for (Listener l : mListeners) { |
| 1096 | l.onConnectionEvent(this, event, extras); |
| 1097 | } |
| 1098 | } |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1099 | } |