| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -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 | |
| 17 | package android.telecomm; |
| 18 | |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 19 | import com.android.internal.telecomm.IConnectionService; |
| 20 | |
| Sailesh Nepal | 2ab88cc | 2014-07-18 14:49:18 -0700 | [diff] [blame] | 21 | import android.app.PendingIntent; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 22 | import android.net.Uri; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 23 | import android.os.RemoteException; |
| 24 | import android.telephony.DisconnectCause; |
| 25 | |
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 26 | import java.util.ArrayList; |
| Sailesh Nepal | f4669df | 2014-08-14 17:43:13 -0700 | [diff] [blame] | 27 | import java.util.Collections; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 28 | import java.util.HashSet; |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 29 | import java.util.List; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 30 | import java.util.Set; |
| Sailesh Nepal | f4669df | 2014-08-14 17:43:13 -0700 | [diff] [blame] | 31 | import java.util.concurrent.ConcurrentHashMap; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 34 | * A connection provided to a {@link ConnectionService} by another {@code ConnectionService} |
| 35 | * running in a different process. |
| 36 | * |
| 37 | * @see ConnectionService#createRemoteOutgoingConnection(PhoneAccountHandle, ConnectionRequest) |
| 38 | * @see ConnectionService#createRemoteIncomingConnection(PhoneAccountHandle, ConnectionRequest) |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 39 | */ |
| 40 | public final class RemoteConnection { |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 41 | |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 42 | public static abstract class Listener { |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 43 | /** |
| 44 | * Invoked when the state of this {@code RemoteConnection} has changed. See |
| 45 | * {@link #getState()}. |
| 46 | * |
| 47 | * @param connection The {@code RemoteConnection} invoking this method. |
| 48 | * @param state The new state of the {@code RemoteConnection}. |
| 49 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 50 | public void onStateChanged(RemoteConnection connection, int state) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Invoked when the parent of this {@code RemoteConnection} has changed. See |
| 54 | * {@link #getParent()}. |
| 55 | * |
| 56 | * @param connection The {@code RemoteConnection} invoking this method. |
| 57 | * @param parent The new parent of the {@code RemoteConnection}. |
| 58 | */ |
| 59 | public void onParentChanged(RemoteConnection connection, RemoteConnection parent) {} |
| 60 | |
| 61 | /** |
| 62 | * Invoked when the children of this {@code RemoteConnection} have changed. See |
| 63 | * {@link #getChildren()}. |
| 64 | * |
| 65 | * @param connection The {@code RemoteConnection} invoking this method. |
| 66 | * @param children The new children of the {@code RemoteConnection}. |
| 67 | */ |
| 68 | public void onChildrenChanged( |
| 69 | RemoteConnection connection, List<RemoteConnection> children) {} |
| 70 | |
| 71 | /** |
| 72 | * Invoked when this {@code RemoteConnection} is disconnected. |
| 73 | * |
| 74 | * @param connection The {@code RemoteConnection} invoking this method. |
| 75 | * @param disconnectCauseCode The failure code ({@see DisconnectCause}) associated with this |
| 76 | * failed connection. |
| 77 | * @param disconnectCauseMessage The reason for the connection failure. This will not be |
| 78 | * displayed to the user. |
| 79 | */ |
| 80 | public void onDisconnected( |
| 81 | RemoteConnection connection, |
| 82 | int disconnectCauseCode, |
| 83 | String disconnectCauseMessage) {} |
| 84 | |
| 85 | /** |
| 86 | * Invoked when this {@code RemoteConnection} is requesting ringback. See |
| 87 | * {@link #isRequestingRingback()}. |
| 88 | * |
| 89 | * @param connection The {@code RemoteConnection} invoking this method. |
| 90 | * @param ringback Whether the {@code RemoteConnection} is requesting ringback. |
| 91 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 92 | public void onRequestingRingback(RemoteConnection connection, boolean ringback) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 93 | |
| 94 | /** |
| 95 | * Indicates that the call capabilities of this {@code RemoteConnection} have changed. |
| 96 | * See {@link #getCallCapabilities()}. |
| 97 | * |
| 98 | * @param connection The {@code RemoteConnection} invoking this method. |
| 99 | * @param callCapabilities The new call capabilities of the {@code RemoteConnection}. |
| 100 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 101 | public void onCallCapabilitiesChanged(RemoteConnection connection, int callCapabilities) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 102 | |
| 103 | /** |
| 104 | * Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a |
| 105 | * pause character. This causes the post-dial signals to stop pending user confirmation. An |
| 106 | * implementation should present this choice to the user and invoke |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 107 | * {@link RemoteConnection#postDialContinue(boolean)} when the user makes the choice. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 108 | * |
| 109 | * @param connection The {@code RemoteConnection} invoking this method. |
| 110 | * @param remainingPostDialSequence The post-dial characters that remain to be sent. |
| 111 | */ |
| 112 | public void onPostDialWait(RemoteConnection connection, String remainingPostDialSequence) {} |
| 113 | |
| 114 | /** |
| 115 | * Indicates that the VOIP audio status of this {@code RemoteConnection} has changed. |
| 116 | * See {@link #getAudioModeIsVoip()}. |
| 117 | * |
| 118 | * @param connection The {@code RemoteConnection} invoking this method. |
| 119 | * @param isVoip Whether the new audio state of the {@code RemoteConnection} is VOIP. |
| 120 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 121 | public void onAudioModeIsVoipChanged(RemoteConnection connection, boolean isVoip) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Indicates that the status hints of this {@code RemoteConnection} have changed. See |
| 125 | * {@link #getStatusHints()} ()}. |
| 126 | * |
| 127 | * @param connection The {@code RemoteConnection} invoking this method. |
| 128 | * @param statusHints The new status hints of the {@code RemoteConnection}. |
| 129 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 130 | public void onStatusHintsChanged(RemoteConnection connection, StatusHints statusHints) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 131 | |
| 132 | /** |
| 133 | * Indicates that the handle (e.g., phone number) of this {@code RemoteConnection} has |
| 134 | * changed. See {@link #getHandle()} and {@link #getHandlePresentation()}. |
| 135 | * |
| 136 | * @param connection The {@code RemoteConnection} invoking this method. |
| 137 | * @param handle The new handle of the {@code RemoteConnection}. |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 138 | * @param presentation The {@link PropertyPresentation} which controls how the |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 139 | * handle is shown. |
| 140 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 141 | public void onHandleChanged(RemoteConnection connection, Uri handle, int presentation) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * Indicates that the caller display name of this {@code RemoteConnection} has changed. |
| 145 | * See {@link #getCallerDisplayName()} and {@link #getCallerDisplayNamePresentation()}. |
| 146 | * |
| 147 | * @param connection The {@code RemoteConnection} invoking this method. |
| 148 | * @param callerDisplayName The new caller display name of the {@code RemoteConnection}. |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 149 | * @param presentation The {@link PropertyPresentation} which controls how the |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 150 | * caller display name is shown. |
| 151 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 152 | public void onCallerDisplayNameChanged( |
| 153 | RemoteConnection connection, String callerDisplayName, int presentation) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 154 | |
| 155 | /** |
| 156 | * Indicates that the video state of this {@code RemoteConnection} has changed. |
| 157 | * See {@link #getVideoState()}. |
| 158 | * |
| 159 | * @param connection The {@code RemoteConnection} invoking this method. |
| 160 | * @param videoState The new video state of the {@code RemoteConnection}. |
| 161 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 162 | public void onVideoStateChanged(RemoteConnection connection, int videoState) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 163 | |
| 164 | /** |
| 165 | * Indicates that this {@code RemoteConnection} is requesting that the in-call UI |
| 166 | * launch the specified activity. |
| 167 | * |
| 168 | * @param connection The {@code RemoteConnection} invoking this method. |
| 169 | * @param intent A {@link PendingIntent} that the {@code RemoteConnection} wishes to |
| 170 | * have launched on its behalf. |
| 171 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 172 | public void onStartActivityFromInCall(RemoteConnection connection, PendingIntent intent) {} |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 173 | |
| 174 | /** |
| 175 | * Indicates that this {@code RemoteConnection} has been destroyed. No further requests |
| 176 | * should be made to the {@code RemoteConnection}, and references to it should be cleared. |
| 177 | * |
| 178 | * @param connection The {@code RemoteConnection} invoking this method. |
| 179 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 180 | public void onDestroyed(RemoteConnection connection) {} |
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 181 | public void onConferenceableConnectionsChanged( |
| 182 | RemoteConnection connection, List<RemoteConnection> conferenceableConnections) {} |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 183 | } |
| 184 | |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 185 | private IConnectionService mConnectionService; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 186 | private final String mConnectionId; |
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 187 | /** |
| 188 | * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is |
| 189 | * load factor before resizing, 1 means we only expect a single thread to |
| 190 | * access the map so make only a single shard |
| 191 | */ |
| Sailesh Nepal | f4669df | 2014-08-14 17:43:13 -0700 | [diff] [blame] | 192 | private final Set<Listener> mListeners = Collections.newSetFromMap( |
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 193 | new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); |
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 194 | private final Set<RemoteConnection> mConferenceableConnections = new HashSet<>(); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 195 | |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 196 | private int mState = Connection.STATE_NEW; |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 197 | private int mDisconnectCauseCode = DisconnectCause.NOT_VALID; |
| 198 | private String mDisconnectCauseMessage; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 199 | private boolean mRequestingRingback; |
| 200 | private boolean mConnected; |
| Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 201 | private int mCallCapabilities; |
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 202 | private int mVideoState; |
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 203 | private boolean mAudioModeIsVoip; |
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 204 | private StatusHints mStatusHints; |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 205 | private Uri mHandle; |
| 206 | private int mHandlePresentation; |
| 207 | private String mCallerDisplayName; |
| 208 | private int mCallerDisplayNamePresentation; |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 209 | private int mFailureCode; |
| 210 | private String mFailureMessage; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 211 | |
| 212 | /** |
| 213 | * @hide |
| 214 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 215 | RemoteConnection( |
| 216 | String id, |
| 217 | IConnectionService connectionService, |
| 218 | ConnectionRequest request) { |
| 219 | mConnectionId = id; |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 220 | mConnectionService = connectionService; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 221 | mConnected = true; |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 222 | mState = Connection.STATE_INITIALIZING; |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Create a RemoteConnection which is used for failed connections. Note that using it for any |
| 227 | * "real" purpose will almost certainly fail. Callers should note the failure and act |
| 228 | * accordingly (moving on to another RemoteConnection, for example) |
| 229 | * |
| 230 | * @param failureCode |
| 231 | * @param failureMessage |
| 232 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 233 | RemoteConnection(int failureCode, String failureMessage) { |
| 234 | this("NULL", null, null); |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 235 | mConnected = false; |
| Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame^] | 236 | mState = Connection.STATE_DISCONNECTED; |
| 237 | mFailureCode = DisconnectCause.OUTGOING_FAILURE; |
| 238 | mFailureMessage = failureMessage + " original code = " + failureCode; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 239 | } |
| 240 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 241 | /** |
| 242 | * Adds a listener to this {@code RemoteConnection}. |
| 243 | * |
| 244 | * @param listener A {@code Listener}. |
| 245 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 246 | public void addListener(Listener listener) { |
| 247 | mListeners.add(listener); |
| 248 | } |
| 249 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 250 | /** |
| 251 | * Removes a listener from this {@code RemoteConnection}. |
| 252 | * |
| 253 | * @param listener A {@code Listener}. |
| 254 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 255 | public void removeListener(Listener listener) { |
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 256 | if (listener != null) { |
| 257 | mListeners.remove(listener); |
| 258 | } |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 259 | } |
| 260 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 261 | /** |
| 262 | * Obtains the parent of this {@code RemoteConnection} in a conference, if any. |
| 263 | * |
| 264 | * @return The parent {@code RemoteConnection}, or {@code null} if this {@code RemoteConnection} |
| 265 | * is not a child of any conference {@code RemoteConnection}s. |
| 266 | */ |
| 267 | public RemoteConnection getParent() { return null; } |
| 268 | |
| 269 | /** |
| 270 | * Obtains the children of this conference {@code RemoteConnection}, if any. |
| 271 | * |
| 272 | * @return The children of this {@code RemoteConnection} if this {@code RemoteConnection} is |
| 273 | * a conference, or an empty {@code List} otherwise. |
| 274 | */ |
| 275 | public List<RemoteConnection> getChildren() { return null; } |
| 276 | |
| 277 | /** |
| 278 | * Obtains the state of this {@code RemoteConnection}. |
| 279 | * |
| 280 | * @return A state value, chosen from the {@code STATE_*} constants. |
| 281 | */ |
| Sailesh Nepal | ade3f25 | 2014-07-01 17:25:37 -0700 | [diff] [blame] | 282 | public int getState() { |
| 283 | return mState; |
| 284 | } |
| 285 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 286 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 287 | * @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, the |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 288 | * disconnect cause expressed as a code chosen from among those declared in |
| 289 | * {@link DisconnectCause}. |
| 290 | */ |
| 291 | public int getDisconnectCauseCode() { |
| 292 | return mDisconnectCauseCode; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 293 | } |
| 294 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 295 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 296 | * @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, an optional |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 297 | * reason for disconnection expressed as a free text message. |
| 298 | */ |
| 299 | public String getDisconnectCauseMessage() { |
| 300 | return mDisconnectCauseMessage; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 301 | } |
| 302 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 303 | /** |
| 304 | * @return A bitmask of the capabilities of the {@code RemoteConnection}, as defined in |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 305 | * {@link PhoneCapabilities}. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 306 | */ |
| Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 307 | public int getCallCapabilities() { |
| 308 | return mCallCapabilities; |
| 309 | } |
| 310 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 311 | /** |
| 312 | * @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP. |
| 313 | */ |
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 314 | public boolean getAudioModeIsVoip() { |
| 315 | return mAudioModeIsVoip; |
| 316 | } |
| 317 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 318 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 319 | * @return The current {@link StatusHints} of this {@code RemoteConnection}, |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 320 | * or {@code null} if none have been set. |
| 321 | */ |
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 322 | public StatusHints getStatusHints() { |
| 323 | return mStatusHints; |
| 324 | } |
| 325 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 326 | /** |
| 327 | * @return The handle (e.g., phone number) to which the {@code RemoteConnection} is currently |
| 328 | * connected. |
| 329 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 330 | public Uri getHandle() { |
| 331 | return mHandle; |
| 332 | } |
| 333 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 334 | /** |
| 335 | * @return The presentation requirements for the handle. See |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 336 | * {@link PropertyPresentation} for valid values. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 337 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 338 | public int getHandlePresentation() { |
| 339 | return mHandlePresentation; |
| 340 | } |
| 341 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 342 | /** |
| 343 | * @return The display name for the caller. |
| 344 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 345 | public String getCallerDisplayName() { |
| 346 | return mCallerDisplayName; |
| 347 | } |
| 348 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 349 | /** |
| 350 | * @return The presentation requirements for the caller display name. See |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 351 | * {@link PropertyPresentation} for valid values. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 352 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 353 | public int getCallerDisplayNamePresentation() { |
| 354 | return mCallerDisplayNamePresentation; |
| 355 | } |
| 356 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 357 | /** |
| 358 | * @return The video state of the {@code RemoteConnection}. See |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 359 | * {@link VideoProfile.VideoState}. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 360 | */ |
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 361 | public int getVideoState() { |
| 362 | return mVideoState; |
| 363 | } |
| 364 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 365 | /** |
| 366 | * @return The failure code ({@see DisconnectCause}) associated with this failed |
| 367 | * {@code RemoteConnection}. |
| 368 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 369 | public int getFailureCode() { |
| 370 | return mFailureCode; |
| 371 | } |
| 372 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 373 | /** |
| 374 | * @return The reason for the connection failure. This will not be displayed to the user. |
| 375 | */ |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 376 | public String getFailureMessage() { |
| 377 | return mFailureMessage; |
| 378 | } |
| 379 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 380 | /** |
| 381 | * @return Whether the {@code RemoteConnection} is requesting that the framework play a |
| 382 | * ringback tone on its behalf. |
| 383 | */ |
| 384 | public boolean isRequestingRingback() { |
| 385 | return false; |
| 386 | } |
| 387 | |
| 388 | /** |
| 389 | * Instructs this {@code RemoteConnection} to abort. |
| 390 | */ |
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 391 | public void abort() { |
| 392 | try { |
| 393 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 394 | mConnectionService.abort(mConnectionId); |
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 395 | } |
| 396 | } catch (RemoteException ignored) { |
| 397 | } |
| 398 | } |
| 399 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 400 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 401 | * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to answer. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 402 | * @param videoState The video state in which to answer the call. |
| 403 | */ |
| Andrew Lee | 8da4c3c | 2014-07-16 10:11:42 -0700 | [diff] [blame] | 404 | public void answer(int videoState) { |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 405 | try { |
| 406 | if (mConnected) { |
| Andrew Lee | 8da4c3c | 2014-07-16 10:11:42 -0700 | [diff] [blame] | 407 | mConnectionService.answer(mConnectionId, videoState); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 408 | } |
| 409 | } catch (RemoteException ignored) { |
| 410 | } |
| 411 | } |
| 412 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 413 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 414 | * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to reject. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 415 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 416 | public void reject() { |
| 417 | try { |
| 418 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 419 | mConnectionService.reject(mConnectionId); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 420 | } |
| 421 | } catch (RemoteException ignored) { |
| 422 | } |
| 423 | } |
| 424 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 425 | /** |
| 426 | * Instructs this {@code RemoteConnection} to go on hold. |
| 427 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 428 | public void hold() { |
| 429 | try { |
| 430 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 431 | mConnectionService.hold(mConnectionId); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 432 | } |
| 433 | } catch (RemoteException ignored) { |
| 434 | } |
| 435 | } |
| 436 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 437 | /** |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 438 | * Instructs this {@link Connection#STATE_HOLDING} call to release from hold. |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 439 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 440 | public void unhold() { |
| 441 | try { |
| 442 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 443 | mConnectionService.unhold(mConnectionId); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 444 | } |
| 445 | } catch (RemoteException ignored) { |
| 446 | } |
| 447 | } |
| 448 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 449 | /** |
| 450 | * Instructs this {@code RemoteConnection} to disconnect. |
| 451 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 452 | public void disconnect() { |
| 453 | try { |
| 454 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 455 | mConnectionService.disconnect(mConnectionId); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 456 | } |
| 457 | } catch (RemoteException ignored) { |
| 458 | } |
| 459 | } |
| 460 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 461 | /** |
| 462 | * Instructs this {@code RemoteConnection} to play a dual-tone multi-frequency signaling |
| 463 | * (DTMF) tone. |
| 464 | * |
| 465 | * Any other currently playing DTMF tone in the specified call is immediately stopped. |
| 466 | * |
| 467 | * @param digit A character representing the DTMF digit for which to play the tone. This |
| 468 | * value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}. |
| 469 | */ |
| 470 | public void playDtmfTone(char digit) { |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 471 | try { |
| 472 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 473 | mConnectionService.playDtmfTone(mConnectionId, digit); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 474 | } |
| 475 | } catch (RemoteException ignored) { |
| 476 | } |
| 477 | } |
| 478 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 479 | /** |
| 480 | * Instructs this {@code RemoteConnection} to stop any dual-tone multi-frequency signaling |
| 481 | * (DTMF) tone currently playing. |
| 482 | * |
| 483 | * DTMF tones are played by calling {@link #playDtmfTone(char)}. If no DTMF tone is |
| 484 | * currently playing, this method will do nothing. |
| 485 | */ |
| 486 | public void stopDtmfTone() { |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 487 | try { |
| 488 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 489 | mConnectionService.stopDtmfTone(mConnectionId); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 490 | } |
| 491 | } catch (RemoteException ignored) { |
| 492 | } |
| 493 | } |
| 494 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 495 | /** |
| 496 | * Instructs this {@code RemoteConnection} to continue playing a post-dial DTMF string. |
| 497 | * |
| 498 | * A post-dial DTMF string is a string of digits following the first instance of either |
| 499 | * {@link TelecommManager#DTMF_CHARACTER_WAIT} or {@link TelecommManager#DTMF_CHARACTER_PAUSE}. |
| 500 | * These digits are immediately sent as DTMF tones to the recipient as soon as the |
| 501 | * connection is made. |
| 502 | * |
| 503 | * If the DTMF string contains a {@link TelecommManager#DTMF_CHARACTER_PAUSE} symbol, this |
| 504 | * {@code RemoteConnection} will temporarily pause playing the tones for a pre-defined period |
| 505 | * of time. |
| 506 | * |
| 507 | * If the DTMF string contains a {@link TelecommManager#DTMF_CHARACTER_WAIT} symbol, this |
| 508 | * {@code RemoteConnection} will pause playing the tones and notify listeners via |
| 509 | * {@link Listener#onPostDialWait(RemoteConnection, String)}. At this point, the in-call app |
| 510 | * should display to the user an indication of this state and an affordance to continue |
| 511 | * the postdial sequence. When the user decides to continue the postdial sequence, the in-call |
| 512 | * app should invoke the {@link #postDialContinue(boolean)} method. |
| 513 | * |
| 514 | * @param proceed Whether or not to continue with the post-dial sequence. |
| 515 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 516 | public void postDialContinue(boolean proceed) { |
| 517 | try { |
| 518 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 519 | mConnectionService.onPostDialContinue(mConnectionId, proceed); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 520 | } |
| 521 | } catch (RemoteException ignored) { |
| 522 | } |
| 523 | } |
| 524 | |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 525 | /** |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 526 | * Set the audio state of this {@code RemoteConnection}. |
| 527 | * |
| 528 | * @param state The audio state of this {@code RemoteConnection}. |
| 529 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 530 | public void setAudioState(AudioState state) { |
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 531 | try { |
| 532 | if (mConnected) { |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 533 | mConnectionService.onAudioStateChanged(mConnectionId, state); |
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 534 | } |
| 535 | } catch (RemoteException ignored) { |
| 536 | } |
| 537 | } |
| 538 | |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 539 | /** |
| 540 | * @hide |
| 541 | */ |
| 542 | void setState(int state) { |
| 543 | if (mState != state) { |
| 544 | mState = state; |
| 545 | for (Listener l: mListeners) { |
| 546 | l.onStateChanged(this, state); |
| 547 | } |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | /** |
| 552 | * @hide |
| 553 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 554 | void setDisconnected(int cause, String message) { |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 555 | if (mState != Connection.STATE_DISCONNECTED) { |
| 556 | mState = Connection.STATE_DISCONNECTED; |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 557 | mDisconnectCauseCode = cause; |
| 558 | mDisconnectCauseMessage = message; |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 559 | |
| 560 | for (Listener l : mListeners) { |
| 561 | l.onDisconnected(this, cause, message); |
| 562 | } |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | /** |
| 567 | * @hide |
| 568 | */ |
| 569 | void setRequestingRingback(boolean ringback) { |
| 570 | if (mRequestingRingback != ringback) { |
| 571 | mRequestingRingback = ringback; |
| 572 | for (Listener l : mListeners) { |
| 573 | l.onRequestingRingback(this, ringback); |
| 574 | } |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | /** |
| 579 | * @hide |
| 580 | */ |
| Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 581 | void setCallCapabilities(int callCapabilities) { |
| 582 | mCallCapabilities = callCapabilities; |
| 583 | for (Listener l : mListeners) { |
| 584 | l.onCallCapabilitiesChanged(this, callCapabilities); |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | /** |
| 589 | * @hide |
| 590 | */ |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 591 | void setDestroyed() { |
| 592 | if (!mListeners.isEmpty()) { |
| 593 | // Make sure that the listeners are notified that the call is destroyed first. |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 594 | if (mState != Connection.STATE_DISCONNECTED) { |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 595 | setDisconnected(DisconnectCause.ERROR_UNSPECIFIED, "Connection destroyed."); |
| 596 | } |
| 597 | |
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 598 | for (Listener l : mListeners) { |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 599 | l.onDestroyed(this); |
| 600 | } |
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 601 | mListeners.clear(); |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 602 | |
| 603 | mConnected = false; |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | /** |
| 608 | * @hide |
| 609 | */ |
| 610 | void setPostDialWait(String remainingDigits) { |
| 611 | for (Listener l : mListeners) { |
| 612 | l.onPostDialWait(this, remainingDigits); |
| 613 | } |
| 614 | } |
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 615 | |
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 616 | /** |
| 617 | * @hide |
| 618 | */ |
| 619 | void setVideoState(int videoState) { |
| 620 | mVideoState = videoState; |
| 621 | for (Listener l : mListeners) { |
| 622 | l.onVideoStateChanged(this, videoState); |
| 623 | } |
| 624 | } |
| 625 | |
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 626 | /** @hide */ |
| 627 | void setAudioModeIsVoip(boolean isVoip) { |
| 628 | mAudioModeIsVoip = isVoip; |
| 629 | for (Listener l : mListeners) { |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 630 | l.onAudioModeIsVoipChanged(this, isVoip); |
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 631 | } |
| 632 | } |
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 633 | |
| 634 | /** @hide */ |
| 635 | void setStatusHints(StatusHints statusHints) { |
| 636 | mStatusHints = statusHints; |
| 637 | for (Listener l : mListeners) { |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 638 | l.onStatusHintsChanged(this, statusHints); |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | /** @hide */ |
| 643 | void setHandle(Uri handle, int presentation) { |
| 644 | mHandle = handle; |
| 645 | mHandlePresentation = presentation; |
| 646 | for (Listener l : mListeners) { |
| 647 | l.onHandleChanged(this, handle, presentation); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | /** @hide */ |
| 652 | void setCallerDisplayName(String callerDisplayName, int presentation) { |
| 653 | mCallerDisplayName = callerDisplayName; |
| 654 | mCallerDisplayNamePresentation = presentation; |
| 655 | for (Listener l : mListeners) { |
| 656 | l.onCallerDisplayNameChanged(this, callerDisplayName, presentation); |
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 657 | } |
| 658 | } |
| Sailesh Nepal | 2ab88cc | 2014-07-18 14:49:18 -0700 | [diff] [blame] | 659 | |
| 660 | /** @hide */ |
| 661 | void startActivityFromInCall(PendingIntent intent) { |
| 662 | for (Listener l : mListeners) { |
| 663 | l.onStartActivityFromInCall(this, intent); |
| 664 | } |
| 665 | } |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 666 | |
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 667 | /** @hide */ |
| 668 | void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) { |
| 669 | mConferenceableConnections.clear(); |
| 670 | mConferenceableConnections.addAll(conferenceableConnections); |
| 671 | for (Listener l : mListeners) { |
| 672 | l.onConferenceableConnectionsChanged( |
| 673 | this, new ArrayList<RemoteConnection>(mConferenceableConnections)); |
| 674 | } |
| 675 | } |
| 676 | |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 677 | /** |
| Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame^] | 678 | * Create a RemoteConnection represents a failure, and which will be in |
| 679 | * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost |
| 680 | * certainly result in bad things happening. Do not do this. |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 681 | * |
| 682 | * @return a failed {@link RemoteConnection} |
| 683 | * |
| 684 | * @hide |
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 685 | */ |
| 686 | public static RemoteConnection failure(int failureCode, String failureMessage) { |
| 687 | return new RemoteConnection(failureCode, failureMessage); |
| 688 | } |
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 689 | } |