| 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 |  | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 18 |  | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 19 | import com.android.internal.telecom.IConnectionService; | 
|  | 20 | import com.android.internal.telecom.IVideoCallback; | 
|  | 21 | import com.android.internal.telecom.IVideoProvider; | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 22 |  | 
| Evan Charlton | 0e094d9 | 2014-11-08 15:49:16 -0800 | [diff] [blame] | 23 | import android.annotation.SystemApi; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 24 | import android.net.Uri; | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 25 | import android.os.IBinder; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 26 | import android.os.RemoteException; | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 27 | import android.view.Surface; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 28 |  | 
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 29 | import java.util.ArrayList; | 
| Sailesh Nepal | f4669df | 2014-08-14 17:43:13 -0700 | [diff] [blame] | 30 | import java.util.Collections; | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 31 | import java.util.List; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 32 | import java.util.Set; | 
| Sailesh Nepal | f4669df | 2014-08-14 17:43:13 -0700 | [diff] [blame] | 33 | import java.util.concurrent.ConcurrentHashMap; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 34 |  | 
|  | 35 | /** | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 36 | * A connection provided to a {@link ConnectionService} by another {@code ConnectionService} | 
|  | 37 | * running in a different process. | 
|  | 38 | * | 
|  | 39 | * @see ConnectionService#createRemoteOutgoingConnection(PhoneAccountHandle, ConnectionRequest) | 
|  | 40 | * @see ConnectionService#createRemoteIncomingConnection(PhoneAccountHandle, ConnectionRequest) | 
| Evan Charlton | 0e094d9 | 2014-11-08 15:49:16 -0800 | [diff] [blame] | 41 | * @hide | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 42 | */ | 
| Evan Charlton | 0e094d9 | 2014-11-08 15:49:16 -0800 | [diff] [blame] | 43 | @SystemApi | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 44 | public final class RemoteConnection { | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 45 |  | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 46 | public static abstract class Callback { | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 47 | /** | 
|  | 48 | * Invoked when the state of this {@code RemoteConnection} has changed. See | 
|  | 49 | * {@link #getState()}. | 
|  | 50 | * | 
|  | 51 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 52 | * @param state The new state of the {@code RemoteConnection}. | 
|  | 53 | */ | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 54 | public void onStateChanged(RemoteConnection connection, int state) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 55 |  | 
|  | 56 | /** | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 57 | * Invoked when this {@code RemoteConnection} is disconnected. | 
|  | 58 | * | 
|  | 59 | * @param connection The {@code RemoteConnection} invoking this method. | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 60 | * @param disconnectCause The ({@see DisconnectCause}) associated with this failed | 
|  | 61 | *     connection. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 62 | */ | 
|  | 63 | public void onDisconnected( | 
|  | 64 | RemoteConnection connection, | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 65 | DisconnectCause disconnectCause) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 66 |  | 
|  | 67 | /** | 
|  | 68 | * Invoked when this {@code RemoteConnection} is requesting ringback. See | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 69 | * {@link #isRingbackRequested()}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 70 | * | 
|  | 71 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 72 | * @param ringback Whether the {@code RemoteConnection} is requesting ringback. | 
|  | 73 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 74 | public void onRingbackRequested(RemoteConnection connection, boolean ringback) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 75 |  | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 76 | /** @hide */ | 
|  | 77 | @Deprecated public void onCallCapabilitiesChanged( | 
|  | 78 | RemoteConnection connection, | 
|  | 79 | int callCapabilities) {} | 
|  | 80 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 81 | /** | 
|  | 82 | * Indicates that the call capabilities of this {@code RemoteConnection} have changed. | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 83 | * See {@link #getConnectionCapabilities()}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 84 | * | 
|  | 85 | * @param connection The {@code RemoteConnection} invoking this method. | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 86 | * @param connectionCapabilities The new capabilities of the {@code RemoteConnection}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 87 | */ | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 88 | public void onConnectionCapabilitiesChanged( | 
|  | 89 | RemoteConnection connection, | 
|  | 90 | int connectionCapabilities) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 91 |  | 
|  | 92 | /** | 
|  | 93 | * Invoked when the post-dial sequence in the outgoing {@code Connection} has reached a | 
|  | 94 | * pause character. This causes the post-dial signals to stop pending user confirmation. An | 
|  | 95 | * implementation should present this choice to the user and invoke | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 96 | * {@link RemoteConnection#postDialContinue(boolean)} when the user makes the choice. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 97 | * | 
|  | 98 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 99 | * @param remainingPostDialSequence The post-dial characters that remain to be sent. | 
|  | 100 | */ | 
|  | 101 | public void onPostDialWait(RemoteConnection connection, String remainingPostDialSequence) {} | 
|  | 102 |  | 
|  | 103 | /** | 
| Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 104 | * Invoked when the post-dial sequence in the outgoing {@code Connection} has processed | 
|  | 105 | * a character. | 
|  | 106 | * | 
|  | 107 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 108 | * @param nextChar The character being processed. | 
|  | 109 | */ | 
|  | 110 | public void onPostDialChar(RemoteConnection connection, char nextChar) {} | 
|  | 111 |  | 
|  | 112 | /** | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 113 | * Indicates that the VOIP audio status of this {@code RemoteConnection} has changed. | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 114 | * See {@link #isVoipAudioMode()}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 115 | * | 
|  | 116 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 117 | * @param isVoip Whether the new audio state of the {@code RemoteConnection} is VOIP. | 
|  | 118 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 119 | public void onVoipAudioChanged(RemoteConnection connection, boolean isVoip) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 120 |  | 
|  | 121 | /** | 
|  | 122 | * Indicates that the status hints of this {@code RemoteConnection} have changed. See | 
|  | 123 | * {@link #getStatusHints()} ()}. | 
|  | 124 | * | 
|  | 125 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 126 | * @param statusHints The new status hints of the {@code RemoteConnection}. | 
|  | 127 | */ | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 128 | public void onStatusHintsChanged(RemoteConnection connection, StatusHints statusHints) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 129 |  | 
|  | 130 | /** | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 131 | * Indicates that the address (e.g., phone number) of this {@code RemoteConnection} has | 
|  | 132 | * changed. See {@link #getAddress()} and {@link #getAddressPresentation()}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 133 | * | 
|  | 134 | * @param connection The {@code RemoteConnection} invoking this method. | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 135 | * @param address The new address of the {@code RemoteConnection}. | 
|  | 136 | * @param presentation The presentation requirements for the address. | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 137 | *        See {@link TelecomManager} for valid values. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 138 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 139 | public void onAddressChanged(RemoteConnection connection, Uri address, int presentation) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 140 |  | 
|  | 141 | /** | 
|  | 142 | * Indicates that the caller display name of this {@code RemoteConnection} has changed. | 
|  | 143 | * See {@link #getCallerDisplayName()} and {@link #getCallerDisplayNamePresentation()}. | 
|  | 144 | * | 
|  | 145 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 146 | * @param callerDisplayName The new caller display name of the {@code RemoteConnection}. | 
| Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 147 | * @param presentation The presentation requirements for the handle. | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 148 | *        See {@link TelecomManager} for valid values. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 149 | */ | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 150 | public void onCallerDisplayNameChanged( | 
|  | 151 | RemoteConnection connection, String callerDisplayName, int presentation) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 152 |  | 
|  | 153 | /** | 
|  | 154 | * Indicates that the video state of this {@code RemoteConnection} has changed. | 
|  | 155 | * See {@link #getVideoState()}. | 
|  | 156 | * | 
|  | 157 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 158 | * @param videoState The new video state of the {@code RemoteConnection}. | 
| Tyler Gunn | 27d1e25 | 2014-08-21 16:38:40 -0700 | [diff] [blame] | 159 | * @hide | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 160 | */ | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 161 | public void onVideoStateChanged(RemoteConnection connection, int videoState) {} | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 162 |  | 
|  | 163 | /** | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 164 | * Indicates that the call substate of this {@code RemoteConnection} has changed. | 
|  | 165 | * See {@link #getCallSubstate()}. | 
|  | 166 | * | 
|  | 167 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 168 | * @param callSubstate The new call substate of the {@code RemoteConnection}. | 
|  | 169 | * @hide | 
|  | 170 | */ | 
|  | 171 | public void onCallSubstateChanged(RemoteConnection connection, int callSubstate) {} | 
|  | 172 |  | 
|  | 173 | /** | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 174 | * Indicates that this {@code RemoteConnection} has been destroyed. No further requests | 
|  | 175 | * should be made to the {@code RemoteConnection}, and references to it should be cleared. | 
|  | 176 | * | 
|  | 177 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 178 | */ | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 179 | public void onDestroyed(RemoteConnection connection) {} | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 180 |  | 
|  | 181 | /** | 
|  | 182 | * Indicates that the {@code RemoteConnection}s with which this {@code RemoteConnection} | 
|  | 183 | * may be asked to create a conference has changed. | 
|  | 184 | * | 
|  | 185 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 186 | * @param conferenceableConnections The {@code RemoteConnection}s with which this | 
|  | 187 | *         {@code RemoteConnection} may be asked to create a conference. | 
|  | 188 | */ | 
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 189 | public void onConferenceableConnectionsChanged( | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 190 | RemoteConnection connection, | 
|  | 191 | List<RemoteConnection> conferenceableConnections) {} | 
|  | 192 |  | 
|  | 193 | /** | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 194 | * Indicates that the {@code VideoProvider} associated with this {@code RemoteConnection} | 
|  | 195 | * has changed. | 
|  | 196 | * | 
|  | 197 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 198 | * @param videoProvider The new {@code VideoProvider} associated with this | 
|  | 199 | *         {@code RemoteConnection}. | 
|  | 200 | * @hide | 
|  | 201 | */ | 
|  | 202 | public void onVideoProviderChanged( | 
|  | 203 | RemoteConnection connection, VideoProvider videoProvider) {} | 
|  | 204 |  | 
|  | 205 | /** | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 206 | * Indicates that the {@code RemoteConference} that this {@code RemoteConnection} is a part | 
|  | 207 | * of has changed. | 
|  | 208 | * | 
|  | 209 | * @param connection The {@code RemoteConnection} invoking this method. | 
|  | 210 | * @param conference The {@code RemoteConference} of which this {@code RemoteConnection} is | 
|  | 211 | *         a part, which may be {@code null}. | 
|  | 212 | */ | 
|  | 213 | public void onConferenceChanged( | 
|  | 214 | RemoteConnection connection, | 
|  | 215 | RemoteConference conference) {} | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 216 | } | 
|  | 217 |  | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 218 | /** {@hide} */ | 
|  | 219 | public static class VideoProvider { | 
|  | 220 |  | 
|  | 221 | public abstract static class Listener { | 
|  | 222 | public void onReceiveSessionModifyRequest( | 
|  | 223 | VideoProvider videoProvider, | 
|  | 224 | VideoProfile videoProfile) {} | 
|  | 225 |  | 
|  | 226 | public void onReceiveSessionModifyResponse( | 
|  | 227 | VideoProvider videoProvider, | 
|  | 228 | int status, | 
|  | 229 | VideoProfile requestedProfile, | 
|  | 230 | VideoProfile responseProfile) {} | 
|  | 231 |  | 
|  | 232 | public void onHandleCallSessionEvent(VideoProvider videoProvider, int event) {} | 
|  | 233 |  | 
|  | 234 | public void onPeerDimensionsChanged(VideoProvider videoProvider, int width, int height) {} | 
|  | 235 |  | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 236 | public void onCallDataUsageChanged(VideoProvider videoProvider, long dataUsage) {} | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 237 |  | 
|  | 238 | public void onCameraCapabilitiesChanged( | 
|  | 239 | VideoProvider videoProvider, | 
|  | 240 | CameraCapabilities cameraCapabilities) {} | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 241 |  | 
|  | 242 | public void onVideoQualityChanged(VideoProvider videoProvider, int videoQuality) {} | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 243 | } | 
|  | 244 |  | 
|  | 245 | private final IVideoCallback mVideoCallbackDelegate = new IVideoCallback() { | 
|  | 246 | @Override | 
|  | 247 | public void receiveSessionModifyRequest(VideoProfile videoProfile) { | 
|  | 248 | for (Listener l : mListeners) { | 
|  | 249 | l.onReceiveSessionModifyRequest(VideoProvider.this, videoProfile); | 
|  | 250 | } | 
|  | 251 | } | 
|  | 252 |  | 
|  | 253 | @Override | 
|  | 254 | public void receiveSessionModifyResponse(int status, VideoProfile requestedProfile, | 
|  | 255 | VideoProfile responseProfile) { | 
|  | 256 | for (Listener l : mListeners) { | 
|  | 257 | l.onReceiveSessionModifyResponse( | 
|  | 258 | VideoProvider.this, | 
|  | 259 | status, | 
|  | 260 | requestedProfile, | 
|  | 261 | responseProfile); | 
|  | 262 | } | 
|  | 263 | } | 
|  | 264 |  | 
|  | 265 | @Override | 
|  | 266 | public void handleCallSessionEvent(int event) { | 
|  | 267 | for (Listener l : mListeners) { | 
|  | 268 | l.onHandleCallSessionEvent(VideoProvider.this, event); | 
|  | 269 | } | 
|  | 270 | } | 
|  | 271 |  | 
|  | 272 | @Override | 
|  | 273 | public void changePeerDimensions(int width, int height) { | 
|  | 274 | for (Listener l : mListeners) { | 
|  | 275 | l.onPeerDimensionsChanged(VideoProvider.this, width, height); | 
|  | 276 | } | 
|  | 277 | } | 
|  | 278 |  | 
|  | 279 | @Override | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 280 | public void changeCallDataUsage(long dataUsage) { | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 281 | for (Listener l : mListeners) { | 
|  | 282 | l.onCallDataUsageChanged(VideoProvider.this, dataUsage); | 
|  | 283 | } | 
|  | 284 | } | 
|  | 285 |  | 
|  | 286 | @Override | 
|  | 287 | public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { | 
|  | 288 | for (Listener l : mListeners) { | 
|  | 289 | l.onCameraCapabilitiesChanged(VideoProvider.this, cameraCapabilities); | 
|  | 290 | } | 
|  | 291 | } | 
|  | 292 |  | 
|  | 293 | @Override | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 294 | public void changeVideoQuality(int videoQuality) { | 
|  | 295 | for (Listener l : mListeners) { | 
|  | 296 | l.onVideoQualityChanged(VideoProvider.this, videoQuality); | 
|  | 297 | } | 
|  | 298 | } | 
|  | 299 |  | 
|  | 300 | @Override | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 301 | public IBinder asBinder() { | 
|  | 302 | return null; | 
|  | 303 | } | 
|  | 304 | }; | 
|  | 305 |  | 
|  | 306 | private final VideoCallbackServant mVideoCallbackServant = | 
|  | 307 | new VideoCallbackServant(mVideoCallbackDelegate); | 
|  | 308 |  | 
|  | 309 | private final IVideoProvider mVideoProviderBinder; | 
|  | 310 |  | 
|  | 311 | /** | 
|  | 312 | * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is | 
|  | 313 | * load factor before resizing, 1 means we only expect a single thread to | 
|  | 314 | * access the map so make only a single shard | 
|  | 315 | */ | 
|  | 316 | private final Set<Listener> mListeners = Collections.newSetFromMap( | 
|  | 317 | new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); | 
|  | 318 |  | 
|  | 319 | public VideoProvider(IVideoProvider videoProviderBinder) { | 
|  | 320 | mVideoProviderBinder = videoProviderBinder; | 
|  | 321 | try { | 
|  | 322 | mVideoProviderBinder.setVideoCallback(mVideoCallbackServant.getStub().asBinder()); | 
|  | 323 | } catch (RemoteException e) { | 
|  | 324 | } | 
|  | 325 | } | 
|  | 326 |  | 
|  | 327 | public void addListener(Listener l) { | 
|  | 328 | mListeners.add(l); | 
|  | 329 | } | 
|  | 330 |  | 
|  | 331 | public void removeListener(Listener l) { | 
|  | 332 | mListeners.remove(l); | 
|  | 333 | } | 
|  | 334 |  | 
|  | 335 | public void setCamera(String cameraId) { | 
|  | 336 | try { | 
|  | 337 | mVideoProviderBinder.setCamera(cameraId); | 
|  | 338 | } catch (RemoteException e) { | 
|  | 339 | } | 
|  | 340 | } | 
|  | 341 |  | 
|  | 342 | public void setPreviewSurface(Surface surface) { | 
|  | 343 | try { | 
|  | 344 | mVideoProviderBinder.setPreviewSurface(surface); | 
|  | 345 | } catch (RemoteException e) { | 
|  | 346 | } | 
|  | 347 | } | 
|  | 348 |  | 
|  | 349 | public void setDisplaySurface(Surface surface) { | 
|  | 350 | try { | 
|  | 351 | mVideoProviderBinder.setDisplaySurface(surface); | 
|  | 352 | } catch (RemoteException e) { | 
|  | 353 | } | 
|  | 354 | } | 
|  | 355 |  | 
|  | 356 | public void setDeviceOrientation(int rotation) { | 
|  | 357 | try { | 
|  | 358 | mVideoProviderBinder.setDeviceOrientation(rotation); | 
|  | 359 | } catch (RemoteException e) { | 
|  | 360 | } | 
|  | 361 | } | 
|  | 362 |  | 
|  | 363 | public void setZoom(float value) { | 
|  | 364 | try { | 
|  | 365 | mVideoProviderBinder.setZoom(value); | 
|  | 366 | } catch (RemoteException e) { | 
|  | 367 | } | 
|  | 368 | } | 
|  | 369 |  | 
|  | 370 | public void sendSessionModifyRequest(VideoProfile reqProfile) { | 
|  | 371 | try { | 
|  | 372 | mVideoProviderBinder.sendSessionModifyRequest(reqProfile); | 
|  | 373 | } catch (RemoteException e) { | 
|  | 374 | } | 
|  | 375 | } | 
|  | 376 |  | 
|  | 377 | public void sendSessionModifyResponse(VideoProfile responseProfile) { | 
|  | 378 | try { | 
|  | 379 | mVideoProviderBinder.sendSessionModifyResponse(responseProfile); | 
|  | 380 | } catch (RemoteException e) { | 
|  | 381 | } | 
|  | 382 | } | 
|  | 383 |  | 
|  | 384 | public void requestCameraCapabilities() { | 
|  | 385 | try { | 
|  | 386 | mVideoProviderBinder.requestCameraCapabilities(); | 
|  | 387 | } catch (RemoteException e) { | 
|  | 388 | } | 
|  | 389 | } | 
|  | 390 |  | 
|  | 391 | public void requestCallDataUsage() { | 
|  | 392 | try { | 
|  | 393 | mVideoProviderBinder.requestCallDataUsage(); | 
|  | 394 | } catch (RemoteException e) { | 
|  | 395 | } | 
|  | 396 | } | 
|  | 397 |  | 
|  | 398 | public void setPauseImage(String uri) { | 
|  | 399 | try { | 
|  | 400 | mVideoProviderBinder.setPauseImage(uri); | 
|  | 401 | } catch (RemoteException e) { | 
|  | 402 | } | 
|  | 403 | } | 
|  | 404 | } | 
|  | 405 |  | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 406 | private IConnectionService mConnectionService; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 407 | private final String mConnectionId; | 
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 408 | /** | 
|  | 409 | * ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is | 
|  | 410 | * load factor before resizing, 1 means we only expect a single thread to | 
|  | 411 | * access the map so make only a single shard | 
|  | 412 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 413 | private final Set<Callback> mCallbacks = Collections.newSetFromMap( | 
|  | 414 | new ConcurrentHashMap<Callback, Boolean>(8, 0.9f, 1)); | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 415 | private final List<RemoteConnection> mConferenceableConnections = new ArrayList<>(); | 
|  | 416 | private final List<RemoteConnection> mUnmodifiableconferenceableConnections = | 
|  | 417 | Collections.unmodifiableList(mConferenceableConnections); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 418 |  | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 419 | private int mState = Connection.STATE_NEW; | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 420 | private DisconnectCause mDisconnectCause; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 421 | private boolean mRingbackRequested; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 422 | private boolean mConnected; | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 423 | private int mConnectionCapabilities; | 
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 424 | private int mVideoState; | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 425 | private int mCallSubstate; | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 426 | private VideoProvider mVideoProvider; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 427 | private boolean mIsVoipAudioMode; | 
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 428 | private StatusHints mStatusHints; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 429 | private Uri mAddress; | 
|  | 430 | private int mAddressPresentation; | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 431 | private String mCallerDisplayName; | 
|  | 432 | private int mCallerDisplayNamePresentation; | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 433 | private RemoteConference mConference; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 434 |  | 
|  | 435 | /** | 
|  | 436 | * @hide | 
|  | 437 | */ | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 438 | RemoteConnection( | 
|  | 439 | String id, | 
|  | 440 | IConnectionService connectionService, | 
|  | 441 | ConnectionRequest request) { | 
|  | 442 | mConnectionId = id; | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 443 | mConnectionService = connectionService; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 444 | mConnected = true; | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 445 | mState = Connection.STATE_INITIALIZING; | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 446 | } | 
|  | 447 |  | 
|  | 448 | /** | 
| Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 449 | * @hide | 
|  | 450 | */ | 
|  | 451 | RemoteConnection(String callId, IConnectionService connectionService, | 
|  | 452 | ParcelableConnection connection) { | 
|  | 453 | mConnectionId = callId; | 
|  | 454 | mConnectionService = connectionService; | 
|  | 455 | mConnected = true; | 
|  | 456 | mState = connection.getState(); | 
|  | 457 | mDisconnectCause = connection.getDisconnectCause(); | 
|  | 458 | mRingbackRequested = connection.isRingbackRequested(); | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 459 | mConnectionCapabilities = connection.getConnectionCapabilities(); | 
| Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 460 | mVideoState = connection.getVideoState(); | 
|  | 461 | mVideoProvider = new RemoteConnection.VideoProvider(connection.getVideoProvider()); | 
|  | 462 | mIsVoipAudioMode = connection.getIsVoipAudioMode(); | 
|  | 463 | mStatusHints = connection.getStatusHints(); | 
|  | 464 | mAddress = connection.getHandle(); | 
|  | 465 | mAddressPresentation = connection.getHandlePresentation(); | 
|  | 466 | mCallerDisplayName = connection.getCallerDisplayName(); | 
|  | 467 | mCallerDisplayNamePresentation = connection.getCallerDisplayNamePresentation(); | 
|  | 468 | mConference = null; | 
|  | 469 | } | 
|  | 470 |  | 
|  | 471 | /** | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 472 | * Create a RemoteConnection which is used for failed connections. Note that using it for any | 
|  | 473 | * "real" purpose will almost certainly fail. Callers should note the failure and act | 
|  | 474 | * accordingly (moving on to another RemoteConnection, for example) | 
|  | 475 | * | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 476 | * @param disconnectCause The reason for the failed connection. | 
|  | 477 | * @hide | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 478 | */ | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 479 | RemoteConnection(DisconnectCause disconnectCause) { | 
| Tyler Gunn | 4a57b9b | 2014-10-30 14:27:48 -0700 | [diff] [blame] | 480 | mConnectionId = "NULL"; | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 481 | mConnected = false; | 
| Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 482 | mState = Connection.STATE_DISCONNECTED; | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 483 | mDisconnectCause = disconnectCause; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 484 | } | 
|  | 485 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 486 | /** | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 487 | * Adds a callback to this {@code RemoteConnection}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 488 | * | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 489 | * @param callback A {@code Callback}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 490 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 491 | public void registerCallback(Callback callback) { | 
|  | 492 | mCallbacks.add(callback); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 493 | } | 
|  | 494 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 495 | /** | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 496 | * Removes a callback from this {@code RemoteConnection}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 497 | * | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 498 | * @param callback A {@code Callback}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 499 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 500 | public void unregisterCallback(Callback callback) { | 
|  | 501 | if (callback != null) { | 
|  | 502 | mCallbacks.remove(callback); | 
| Jay Shrauner | 229e382 | 2014-08-15 09:23:07 -0700 | [diff] [blame] | 503 | } | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 504 | } | 
|  | 505 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 506 | /** | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 507 | * Obtains the state of this {@code RemoteConnection}. | 
|  | 508 | * | 
|  | 509 | * @return A state value, chosen from the {@code STATE_*} constants. | 
|  | 510 | */ | 
| Sailesh Nepal | ade3f25 | 2014-07-01 17:25:37 -0700 | [diff] [blame] | 511 | public int getState() { | 
|  | 512 | return mState; | 
|  | 513 | } | 
|  | 514 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 515 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 516 | * Obtains the reason why this {@code RemoteConnection} may have been disconnected. | 
|  | 517 | * | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 518 | * @return For a {@link Connection#STATE_DISCONNECTED} {@code RemoteConnection}, the | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 519 | *         disconnect cause expressed as a code chosen from among those declared in | 
|  | 520 | *         {@link DisconnectCause}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 521 | */ | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 522 | public DisconnectCause getDisconnectCause() { | 
|  | 523 | return mDisconnectCause; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 524 | } | 
|  | 525 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 526 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 527 | * Obtains the capabilities of this {@code RemoteConnection}. | 
|  | 528 | * | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 529 | * @return A bitmask of the capabilities of the {@code RemoteConnection}, as defined in | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 530 | *         the {@code CAPABILITY_*} constants in class {@link Connection}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 531 | */ | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 532 | public int getConnectionCapabilities() { | 
|  | 533 | return mConnectionCapabilities; | 
| Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 534 | } | 
|  | 535 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 536 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 537 | * Determines if the audio mode of this {@code RemoteConnection} is VOIP. | 
|  | 538 | * | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 539 | * @return {@code true} if the {@code RemoteConnection}'s current audio mode is VOIP. | 
|  | 540 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 541 | public boolean isVoipAudioMode() { | 
|  | 542 | return mIsVoipAudioMode; | 
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 543 | } | 
|  | 544 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 545 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 546 | * Obtains status hints pertaining to this {@code RemoteConnection}. | 
|  | 547 | * | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 548 | * @return The current {@link StatusHints} of this {@code RemoteConnection}, | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 549 | *         or {@code null} if none have been set. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 550 | */ | 
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 551 | public StatusHints getStatusHints() { | 
|  | 552 | return mStatusHints; | 
|  | 553 | } | 
|  | 554 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 555 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 556 | * Obtains the address of this {@code RemoteConnection}. | 
|  | 557 | * | 
|  | 558 | * @return The address (e.g., phone number) to which the {@code RemoteConnection} | 
|  | 559 | *         is currently connected. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 560 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 561 | public Uri getAddress() { | 
|  | 562 | return mAddress; | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 563 | } | 
|  | 564 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 565 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 566 | * Obtains the presentation requirements for the address of this {@code RemoteConnection}. | 
|  | 567 | * | 
|  | 568 | * @return The presentation requirements for the address. See | 
|  | 569 | *         {@link TelecomManager} for valid values. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 570 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 571 | public int getAddressPresentation() { | 
|  | 572 | return mAddressPresentation; | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 573 | } | 
|  | 574 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 575 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 576 | * Obtains the display name for this {@code RemoteConnection}'s caller. | 
|  | 577 | * | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 578 | * @return The display name for the caller. | 
|  | 579 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 580 | public CharSequence getCallerDisplayName() { | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 581 | return mCallerDisplayName; | 
|  | 582 | } | 
|  | 583 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 584 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 585 | * Obtains the presentation requirements for this {@code RemoteConnection}'s | 
|  | 586 | * caller's display name. | 
|  | 587 | * | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 588 | * @return The presentation requirements for the caller display name. See | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 589 | *         {@link TelecomManager} for valid values. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 590 | */ | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 591 | public int getCallerDisplayNamePresentation() { | 
|  | 592 | return mCallerDisplayNamePresentation; | 
|  | 593 | } | 
|  | 594 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 595 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 596 | * Obtains the video state of this {@code RemoteConnection}. | 
|  | 597 | * | 
|  | 598 | * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}. | 
| Tyler Gunn | 27d1e25 | 2014-08-21 16:38:40 -0700 | [diff] [blame] | 599 | * @hide | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 600 | */ | 
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 601 | public int getVideoState() { | 
|  | 602 | return mVideoState; | 
|  | 603 | } | 
|  | 604 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 605 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 606 | * | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 607 | * @return The call substate of the {@code RemoteConnection}. See | 
|  | 608 | * @hide | 
|  | 609 | */ | 
|  | 610 | public int getCallSubstate() { | 
|  | 611 | return mCallSubstate; | 
|  | 612 | } | 
|  | 613 |  | 
|  | 614 | /** | 
|  | 615 | * Obtains the video provider of this {@code RemoteConnection}. | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 616 | * @return The video provider associated with this {@code RemoteConnection}. | 
|  | 617 | * @hide | 
|  | 618 | */ | 
|  | 619 | public final VideoProvider getVideoProvider() { | 
|  | 620 | return mVideoProvider; | 
|  | 621 | } | 
|  | 622 |  | 
|  | 623 | /** | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 624 | * Determines whether this {@code RemoteConnection} is requesting ringback. | 
|  | 625 | * | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 626 | * @return Whether the {@code RemoteConnection} is requesting that the framework play a | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 627 | *         ringback tone on its behalf. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 628 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 629 | public boolean isRingbackRequested() { | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 630 | return false; | 
|  | 631 | } | 
|  | 632 |  | 
|  | 633 | /** | 
|  | 634 | * Instructs this {@code RemoteConnection} to abort. | 
|  | 635 | */ | 
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 636 | public void abort() { | 
|  | 637 | try { | 
|  | 638 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 639 | mConnectionService.abort(mConnectionId); | 
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 640 | } | 
|  | 641 | } catch (RemoteException ignored) { | 
|  | 642 | } | 
|  | 643 | } | 
|  | 644 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 645 | /** | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 646 | * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to answer. | 
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 647 | */ | 
|  | 648 | public void answer() { | 
|  | 649 | try { | 
|  | 650 | if (mConnected) { | 
|  | 651 | mConnectionService.answer(mConnectionId); | 
|  | 652 | } | 
|  | 653 | } catch (RemoteException ignored) { | 
|  | 654 | } | 
|  | 655 | } | 
|  | 656 |  | 
|  | 657 | /** | 
|  | 658 | * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to answer. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 659 | * @param videoState The video state in which to answer the call. | 
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 660 | * @hide | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 661 | */ | 
| Andrew Lee | 8da4c3c | 2014-07-16 10:11:42 -0700 | [diff] [blame] | 662 | public void answer(int videoState) { | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 663 | try { | 
|  | 664 | if (mConnected) { | 
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 665 | mConnectionService.answerVideo(mConnectionId, videoState); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 666 | } | 
|  | 667 | } catch (RemoteException ignored) { | 
|  | 668 | } | 
|  | 669 | } | 
|  | 670 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 671 | /** | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 672 | * Instructs this {@link Connection#STATE_RINGING} {@code RemoteConnection} to reject. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 673 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 674 | public void reject() { | 
|  | 675 | try { | 
|  | 676 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 677 | mConnectionService.reject(mConnectionId); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 678 | } | 
|  | 679 | } catch (RemoteException ignored) { | 
|  | 680 | } | 
|  | 681 | } | 
|  | 682 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 683 | /** | 
|  | 684 | * Instructs this {@code RemoteConnection} to go on hold. | 
|  | 685 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 686 | public void hold() { | 
|  | 687 | try { | 
|  | 688 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 689 | mConnectionService.hold(mConnectionId); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 690 | } | 
|  | 691 | } catch (RemoteException ignored) { | 
|  | 692 | } | 
|  | 693 | } | 
|  | 694 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 695 | /** | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 696 | * Instructs this {@link Connection#STATE_HOLDING} call to release from hold. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 697 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 698 | public void unhold() { | 
|  | 699 | try { | 
|  | 700 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 701 | mConnectionService.unhold(mConnectionId); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 702 | } | 
|  | 703 | } catch (RemoteException ignored) { | 
|  | 704 | } | 
|  | 705 | } | 
|  | 706 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 707 | /** | 
|  | 708 | * Instructs this {@code RemoteConnection} to disconnect. | 
|  | 709 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 710 | public void disconnect() { | 
|  | 711 | try { | 
|  | 712 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 713 | mConnectionService.disconnect(mConnectionId); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 714 | } | 
|  | 715 | } catch (RemoteException ignored) { | 
|  | 716 | } | 
|  | 717 | } | 
|  | 718 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 719 | /** | 
|  | 720 | * Instructs this {@code RemoteConnection} to play a dual-tone multi-frequency signaling | 
|  | 721 | * (DTMF) tone. | 
|  | 722 | * | 
|  | 723 | * Any other currently playing DTMF tone in the specified call is immediately stopped. | 
|  | 724 | * | 
|  | 725 | * @param digit A character representing the DTMF digit for which to play the tone. This | 
|  | 726 | *         value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}. | 
|  | 727 | */ | 
|  | 728 | public void playDtmfTone(char digit) { | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 729 | try { | 
|  | 730 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 731 | mConnectionService.playDtmfTone(mConnectionId, digit); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 732 | } | 
|  | 733 | } catch (RemoteException ignored) { | 
|  | 734 | } | 
|  | 735 | } | 
|  | 736 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 737 | /** | 
|  | 738 | * Instructs this {@code RemoteConnection} to stop any dual-tone multi-frequency signaling | 
|  | 739 | * (DTMF) tone currently playing. | 
|  | 740 | * | 
|  | 741 | * DTMF tones are played by calling {@link #playDtmfTone(char)}. If no DTMF tone is | 
|  | 742 | * currently playing, this method will do nothing. | 
|  | 743 | */ | 
|  | 744 | public void stopDtmfTone() { | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 745 | try { | 
|  | 746 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 747 | mConnectionService.stopDtmfTone(mConnectionId); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 748 | } | 
|  | 749 | } catch (RemoteException ignored) { | 
|  | 750 | } | 
|  | 751 | } | 
|  | 752 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 753 | /** | 
|  | 754 | * Instructs this {@code RemoteConnection} to continue playing a post-dial DTMF string. | 
|  | 755 | * | 
|  | 756 | * A post-dial DTMF string is a string of digits following the first instance of either | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 757 | * {@link TelecomManager#DTMF_CHARACTER_WAIT} or {@link TelecomManager#DTMF_CHARACTER_PAUSE}. | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 758 | * These digits are immediately sent as DTMF tones to the recipient as soon as the | 
|  | 759 | * connection is made. | 
|  | 760 | * | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 761 | * If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_PAUSE} symbol, this | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 762 | * {@code RemoteConnection} will temporarily pause playing the tones for a pre-defined period | 
|  | 763 | * of time. | 
|  | 764 | * | 
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 765 | * If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, this | 
| Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 766 | * {@code RemoteConnection} will pause playing the tones and notify callbacks via | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 767 | * {@link Callback#onPostDialWait(RemoteConnection, String)}. At this point, the in-call app | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 768 | * should display to the user an indication of this state and an affordance to continue | 
|  | 769 | * the postdial sequence. When the user decides to continue the postdial sequence, the in-call | 
|  | 770 | * app should invoke the {@link #postDialContinue(boolean)} method. | 
|  | 771 | * | 
|  | 772 | * @param proceed Whether or not to continue with the post-dial sequence. | 
|  | 773 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 774 | public void postDialContinue(boolean proceed) { | 
|  | 775 | try { | 
|  | 776 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 777 | mConnectionService.onPostDialContinue(mConnectionId, proceed); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 778 | } | 
|  | 779 | } catch (RemoteException ignored) { | 
|  | 780 | } | 
|  | 781 | } | 
|  | 782 |  | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 783 | /** | 
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 784 | * Set the audio state of this {@code RemoteConnection}. | 
|  | 785 | * | 
|  | 786 | * @param state The audio state of this {@code RemoteConnection}. | 
|  | 787 | */ | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 788 | public void setAudioState(AudioState state) { | 
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 789 | try { | 
|  | 790 | if (mConnected) { | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 791 | mConnectionService.onAudioStateChanged(mConnectionId, state); | 
| Sailesh Nepal | 091768c | 2014-06-30 15:15:23 -0700 | [diff] [blame] | 792 | } | 
|  | 793 | } catch (RemoteException ignored) { | 
|  | 794 | } | 
|  | 795 | } | 
|  | 796 |  | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 797 | /** | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 798 | * Obtain the {@code RemoteConnection}s with which this {@code RemoteConnection} may be | 
|  | 799 | * successfully asked to create a conference with. | 
|  | 800 | * | 
|  | 801 | * @return The {@code RemoteConnection}s with which this {@code RemoteConnection} may be | 
|  | 802 | *         merged into a {@link RemoteConference}. | 
|  | 803 | */ | 
|  | 804 | public List<RemoteConnection> getConferenceableConnections() { | 
|  | 805 | return mUnmodifiableconferenceableConnections; | 
|  | 806 | } | 
|  | 807 |  | 
|  | 808 | /** | 
|  | 809 | * Obtain the {@code RemoteConference} that this {@code RemoteConnection} may be a part | 
|  | 810 | * of, or {@code null} if there is no such {@code RemoteConference}. | 
|  | 811 | * | 
|  | 812 | * @return A {@code RemoteConference} or {@code null}; | 
|  | 813 | */ | 
|  | 814 | public RemoteConference getConference() { | 
|  | 815 | return mConference; | 
|  | 816 | } | 
|  | 817 |  | 
|  | 818 | /** {@hide} */ | 
|  | 819 | String getId() { | 
|  | 820 | return mConnectionId; | 
|  | 821 | } | 
|  | 822 |  | 
|  | 823 | /** {@hide} */ | 
|  | 824 | IConnectionService getConnectionService() { | 
|  | 825 | return mConnectionService; | 
|  | 826 | } | 
|  | 827 |  | 
|  | 828 | /** | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 829 | * @hide | 
|  | 830 | */ | 
|  | 831 | void setState(int state) { | 
|  | 832 | if (mState != state) { | 
|  | 833 | mState = state; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 834 | for (Callback c: mCallbacks) { | 
|  | 835 | c.onStateChanged(this, state); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 836 | } | 
|  | 837 | } | 
|  | 838 | } | 
|  | 839 |  | 
|  | 840 | /** | 
|  | 841 | * @hide | 
|  | 842 | */ | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 843 | void setDisconnected(DisconnectCause disconnectCause) { | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 844 | if (mState != Connection.STATE_DISCONNECTED) { | 
|  | 845 | mState = Connection.STATE_DISCONNECTED; | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 846 | mDisconnectCause = disconnectCause; | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 847 |  | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 848 | for (Callback c : mCallbacks) { | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 849 | c.onDisconnected(this, mDisconnectCause); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 850 | } | 
|  | 851 | } | 
|  | 852 | } | 
|  | 853 |  | 
|  | 854 | /** | 
|  | 855 | * @hide | 
|  | 856 | */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 857 | void setRingbackRequested(boolean ringback) { | 
|  | 858 | if (mRingbackRequested != ringback) { | 
|  | 859 | mRingbackRequested = ringback; | 
|  | 860 | for (Callback c : mCallbacks) { | 
|  | 861 | c.onRingbackRequested(this, ringback); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 862 | } | 
|  | 863 | } | 
|  | 864 | } | 
|  | 865 |  | 
|  | 866 | /** | 
|  | 867 | * @hide | 
|  | 868 | */ | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 869 | void setConnectionCapabilities(int connectionCapabilities) { | 
|  | 870 | mConnectionCapabilities = connectionCapabilities; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 871 | for (Callback c : mCallbacks) { | 
| Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 872 | c.onConnectionCapabilitiesChanged(this, connectionCapabilities); | 
|  | 873 | c.onCallCapabilitiesChanged(this, connectionCapabilities); | 
| Sailesh Nepal | 1a7061b | 2014-07-09 21:03:20 -0700 | [diff] [blame] | 874 | } | 
|  | 875 | } | 
|  | 876 |  | 
|  | 877 | /** | 
|  | 878 | * @hide | 
|  | 879 | */ | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 880 | void setDestroyed() { | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 881 | if (!mCallbacks.isEmpty()) { | 
|  | 882 | // Make sure that the callbacks are notified that the call is destroyed first. | 
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 883 | if (mState != Connection.STATE_DISCONNECTED) { | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 884 | setDisconnected( | 
|  | 885 | new DisconnectCause(DisconnectCause.ERROR, "Connection destroyed.")); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 886 | } | 
|  | 887 |  | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 888 | for (Callback c : mCallbacks) { | 
|  | 889 | c.onDestroyed(this); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 890 | } | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 891 | mCallbacks.clear(); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 892 |  | 
|  | 893 | mConnected = false; | 
|  | 894 | } | 
|  | 895 | } | 
|  | 896 |  | 
|  | 897 | /** | 
|  | 898 | * @hide | 
|  | 899 | */ | 
|  | 900 | void setPostDialWait(String remainingDigits) { | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 901 | for (Callback c : mCallbacks) { | 
|  | 902 | c.onPostDialWait(this, remainingDigits); | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 903 | } | 
|  | 904 | } | 
| Sailesh Nepal | 2a46b90 | 2014-07-04 17:21:07 -0700 | [diff] [blame] | 905 |  | 
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 906 | /** | 
|  | 907 | * @hide | 
|  | 908 | */ | 
| Nancy Chen | 27d1c2d | 2014-12-15 16:12:50 -0800 | [diff] [blame] | 909 | void onPostDialChar(char nextChar) { | 
|  | 910 | for (Callback c : mCallbacks) { | 
|  | 911 | c.onPostDialChar(this, nextChar); | 
|  | 912 | } | 
|  | 913 | } | 
|  | 914 |  | 
|  | 915 | /** | 
|  | 916 | * @hide | 
|  | 917 | */ | 
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 918 | void setVideoState(int videoState) { | 
|  | 919 | mVideoState = videoState; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 920 | for (Callback c : mCallbacks) { | 
|  | 921 | c.onVideoStateChanged(this, videoState); | 
| Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 922 | } | 
|  | 923 | } | 
|  | 924 |  | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 925 | /** | 
|  | 926 | * @hide | 
|  | 927 | */ | 
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame^] | 928 | void setCallSubstate(int callSubstate) { | 
|  | 929 | mCallSubstate = callSubstate; | 
|  | 930 | for (Callback c : mCallbacks) { | 
|  | 931 | c.onCallSubstateChanged(this, callSubstate); | 
|  | 932 | } | 
|  | 933 | } | 
|  | 934 |  | 
|  | 935 | /** | 
|  | 936 | * @hide | 
|  | 937 | */ | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 938 | void setVideoProvider(VideoProvider videoProvider) { | 
|  | 939 | mVideoProvider = videoProvider; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 940 | for (Callback c : mCallbacks) { | 
|  | 941 | c.onVideoProviderChanged(this, videoProvider); | 
| Ihab Awad | a64627c | 2014-08-20 09:36:40 -0700 | [diff] [blame] | 942 | } | 
|  | 943 | } | 
|  | 944 |  | 
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 945 | /** @hide */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 946 | void setIsVoipAudioMode(boolean isVoip) { | 
|  | 947 | mIsVoipAudioMode = isVoip; | 
|  | 948 | for (Callback c : mCallbacks) { | 
|  | 949 | c.onVoipAudioChanged(this, isVoip); | 
| Sailesh Nepal | 33aaae4 | 2014-07-07 22:49:44 -0700 | [diff] [blame] | 950 | } | 
|  | 951 | } | 
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 952 |  | 
|  | 953 | /** @hide */ | 
|  | 954 | void setStatusHints(StatusHints statusHints) { | 
|  | 955 | mStatusHints = statusHints; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 956 | for (Callback c : mCallbacks) { | 
|  | 957 | c.onStatusHintsChanged(this, statusHints); | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 958 | } | 
|  | 959 | } | 
|  | 960 |  | 
|  | 961 | /** @hide */ | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 962 | void setAddress(Uri address, int presentation) { | 
|  | 963 | mAddress = address; | 
|  | 964 | mAddressPresentation = presentation; | 
|  | 965 | for (Callback c : mCallbacks) { | 
|  | 966 | c.onAddressChanged(this, address, presentation); | 
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 967 | } | 
|  | 968 | } | 
|  | 969 |  | 
|  | 970 | /** @hide */ | 
|  | 971 | void setCallerDisplayName(String callerDisplayName, int presentation) { | 
|  | 972 | mCallerDisplayName = callerDisplayName; | 
|  | 973 | mCallerDisplayNamePresentation = presentation; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 974 | for (Callback c : mCallbacks) { | 
|  | 975 | c.onCallerDisplayNameChanged(this, callerDisplayName, presentation); | 
| Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 976 | } | 
|  | 977 | } | 
| Sailesh Nepal | 2ab88cc | 2014-07-18 14:49:18 -0700 | [diff] [blame] | 978 |  | 
|  | 979 | /** @hide */ | 
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 980 | void setConferenceableConnections(List<RemoteConnection> conferenceableConnections) { | 
|  | 981 | mConferenceableConnections.clear(); | 
|  | 982 | mConferenceableConnections.addAll(conferenceableConnections); | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 983 | for (Callback c : mCallbacks) { | 
|  | 984 | c.onConferenceableConnectionsChanged(this, mUnmodifiableconferenceableConnections); | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 985 | } | 
|  | 986 | } | 
|  | 987 |  | 
|  | 988 | /** @hide */ | 
|  | 989 | void setConference(RemoteConference conference) { | 
|  | 990 | if (mConference != conference) { | 
|  | 991 | mConference = conference; | 
| Andrew Lee | 100e293 | 2014-09-08 15:34:24 -0700 | [diff] [blame] | 992 | for (Callback c : mCallbacks) { | 
|  | 993 | c.onConferenceChanged(this, conference); | 
| Ihab Awad | b8e85c7 | 2014-08-23 20:34:57 -0700 | [diff] [blame] | 994 | } | 
| Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 995 | } | 
|  | 996 | } | 
|  | 997 |  | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 998 | /** | 
| Ihab Awad | 6107bab | 2014-08-18 09:23:25 -0700 | [diff] [blame] | 999 | * Create a RemoteConnection represents a failure, and which will be in | 
|  | 1000 | * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost | 
|  | 1001 | * certainly result in bad things happening. Do not do this. | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1002 | * | 
|  | 1003 | * @return a failed {@link RemoteConnection} | 
|  | 1004 | * | 
|  | 1005 | * @hide | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1006 | */ | 
| Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 1007 | public static RemoteConnection failure(DisconnectCause disconnectCause) { | 
|  | 1008 | return new RemoteConnection(disconnectCause); | 
| Evan Charlton | bf11f98 | 2014-07-20 22:06:28 -0700 | [diff] [blame] | 1009 | } | 
| Santos Cordon | 52d8a15 | 2014-06-17 19:08:45 -0700 | [diff] [blame] | 1010 | } |