Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 18 | |
Gabriel Peal | b95f169 | 2014-08-19 14:24:18 -0700 | [diff] [blame] | 19 | import android.annotation.SystemApi; |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 20 | import android.annotation.SdkConstant; |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 21 | import android.app.Service; |
| 22 | import android.content.Intent; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 23 | import android.os.Handler; |
| 24 | import android.os.IBinder; |
| 25 | import android.os.Looper; |
| 26 | import android.os.Message; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 27 | import android.view.Surface; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 28 | |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 29 | import com.android.internal.os.SomeArgs; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 30 | import com.android.internal.telecom.IInCallAdapter; |
| 31 | import com.android.internal.telecom.IInCallService; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 32 | |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 33 | import java.lang.String; |
| 34 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 35 | /** |
| 36 | * This service is implemented by any app that wishes to provide the user-interface for managing |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 37 | * phone calls. Telecom binds to this service while there exists a live (active or incoming) call, |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 38 | * and uses it to notify the in-call app of any live and and recently disconnected calls. |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 39 | * |
| 40 | * {@hide} |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 41 | */ |
Gabriel Peal | b95f169 | 2014-08-19 14:24:18 -0700 | [diff] [blame] | 42 | @SystemApi |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 43 | public abstract class InCallService extends Service { |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
| 46 | * The {@link Intent} that must be declared as handled by the service. |
| 47 | */ |
| 48 | @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 49 | public static final String SERVICE_INTERFACE = "android.telecom.InCallService"; |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 50 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 51 | private static final int MSG_SET_IN_CALL_ADAPTER = 1; |
| 52 | private static final int MSG_ADD_CALL = 2; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 53 | private static final int MSG_UPDATE_CALL = 3; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 54 | private static final int MSG_SET_POST_DIAL_WAIT = 4; |
| 55 | private static final int MSG_ON_AUDIO_STATE_CHANGED = 5; |
| 56 | private static final int MSG_BRING_TO_FOREGROUND = 6; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 57 | |
| 58 | /** Default Handler used to consolidate binder method calls onto a single thread. */ |
| 59 | private final Handler mHandler = new Handler(Looper.getMainLooper()) { |
| 60 | @Override |
| 61 | public void handleMessage(Message msg) { |
Jay Shrauner | 5e6162d | 2014-09-22 20:47:45 -0700 | [diff] [blame] | 62 | if (mPhone == null && msg.what != MSG_SET_IN_CALL_ADAPTER) { |
| 63 | return; |
| 64 | } |
| 65 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 66 | switch (msg.what) { |
| 67 | case MSG_SET_IN_CALL_ADAPTER: |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 68 | mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj)); |
| 69 | onPhoneCreated(mPhone); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 70 | break; |
| 71 | case MSG_ADD_CALL: |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 72 | mPhone.internalAddCall((ParcelableCall) msg.obj); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 73 | break; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 74 | case MSG_UPDATE_CALL: |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 75 | mPhone.internalUpdateCall((ParcelableCall) msg.obj); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 76 | break; |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 77 | case MSG_SET_POST_DIAL_WAIT: { |
| 78 | SomeArgs args = (SomeArgs) msg.obj; |
| 79 | try { |
| 80 | String callId = (String) args.arg1; |
| 81 | String remaining = (String) args.arg2; |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 82 | mPhone.internalSetPostDialWait(callId, remaining); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 83 | } finally { |
| 84 | args.recycle(); |
| 85 | } |
| 86 | break; |
| 87 | } |
Sailesh Nepal | 4cff392 | 2014-03-19 10:15:37 -0700 | [diff] [blame] | 88 | case MSG_ON_AUDIO_STATE_CHANGED: |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 89 | mPhone.internalAudioStateChanged((AudioState) msg.obj); |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 90 | break; |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 91 | case MSG_BRING_TO_FOREGROUND: |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 92 | mPhone.internalBringToForeground(msg.arg1 == 1); |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 93 | break; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 94 | default: |
| 95 | break; |
| 96 | } |
| 97 | } |
| 98 | }; |
| 99 | |
| 100 | /** Manages the binder calls so that the implementor does not need to deal with it. */ |
| 101 | private final class InCallServiceBinder extends IInCallService.Stub { |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 102 | @Override |
| 103 | public void setInCallAdapter(IInCallAdapter inCallAdapter) { |
| 104 | mHandler.obtainMessage(MSG_SET_IN_CALL_ADAPTER, inCallAdapter).sendToTarget(); |
| 105 | } |
| 106 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 107 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 108 | public void addCall(ParcelableCall call) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 109 | mHandler.obtainMessage(MSG_ADD_CALL, call).sendToTarget(); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 110 | } |
| 111 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 112 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 113 | public void updateCall(ParcelableCall call) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 114 | mHandler.obtainMessage(MSG_UPDATE_CALL, call).sendToTarget(); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public void setPostDial(String callId, String remaining) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 119 | // TODO: Unused |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public void setPostDialWait(String callId, String remaining) { |
| 124 | SomeArgs args = SomeArgs.obtain(); |
| 125 | args.arg1 = callId; |
| 126 | args.arg2 = remaining; |
| 127 | mHandler.obtainMessage(MSG_SET_POST_DIAL_WAIT, args).sendToTarget(); |
| 128 | } |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 129 | |
| 130 | @Override |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 131 | public void onAudioStateChanged(AudioState audioState) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 132 | mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget(); |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 133 | } |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 134 | |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 135 | @Override |
| 136 | public void bringToForeground(boolean showDialpad) { |
| 137 | mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget(); |
| 138 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 139 | } |
| 140 | |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 141 | private Phone mPhone; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 142 | |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 143 | public InCallService() { |
| 144 | } |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 145 | |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 146 | @Override |
| 147 | public IBinder onBind(Intent intent) { |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 148 | return new InCallServiceBinder(); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 149 | } |
| 150 | |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 151 | @Override |
| 152 | public boolean onUnbind(Intent intent) { |
Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 153 | if (mPhone != null) { |
| 154 | Phone oldPhone = mPhone; |
| 155 | mPhone = null; |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 156 | |
Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 157 | oldPhone.destroy(); |
| 158 | onPhoneDestroyed(oldPhone); |
| 159 | } |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 160 | return false; |
| 161 | } |
| 162 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 163 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 164 | * Obtain the {@code Phone} associated with this {@code InCallService}. |
| 165 | * |
| 166 | * @return The {@code Phone} object associated with this {@code InCallService}, or {@code null} |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 167 | * if the {@code InCallService} is not in a state where it has an associated |
| 168 | * {@code Phone}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 169 | */ |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 170 | public Phone getPhone() { |
| 171 | return mPhone; |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 175 | * Invoked when the {@code Phone} has been created. This is a signal to the in-call experience |
| 176 | * to start displaying in-call information to the user. Each instance of {@code InCallService} |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 177 | * will have only one {@code Phone}, and this method will be called exactly once in the lifetime |
| 178 | * of the {@code InCallService}. |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 179 | * |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 180 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 181 | */ |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 182 | public void onPhoneCreated(Phone phone) { |
| 183 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 184 | |
| 185 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 186 | * Invoked when a {@code Phone} has been destroyed. This is a signal to the in-call experience |
| 187 | * to stop displaying in-call information to the user. This method will be called exactly once |
| 188 | * in the lifetime of the {@code InCallService}, and it will always be called after a previous |
| 189 | * call to {@link #onPhoneCreated(Phone)}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 190 | * |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 191 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 192 | */ |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 193 | public void onPhoneDestroyed(Phone phone) { |
| 194 | } |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 195 | |
| 196 | /** |
| 197 | * Class to invoke functionality related to video calls. |
Tyler Gunn | 75537ae | 2014-08-22 11:33:13 -0700 | [diff] [blame] | 198 | * @hide |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 199 | */ |
| 200 | public static abstract class VideoCall { |
| 201 | |
| 202 | /** |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 203 | * Sets a listener to invoke callback methods in the InCallUI after performing video |
| 204 | * telephony actions. |
| 205 | * |
| 206 | * @param videoCallListener The call video client. |
| 207 | */ |
| 208 | public abstract void setVideoCallListener(VideoCall.Listener videoCallListener); |
| 209 | |
| 210 | /** |
| 211 | * Sets the camera to be used for video recording in a video call. |
| 212 | * |
| 213 | * @param cameraId The id of the camera. |
| 214 | */ |
| 215 | public abstract void setCamera(String cameraId); |
| 216 | |
| 217 | /** |
| 218 | * Sets the surface to be used for displaying a preview of what the user's camera is |
| 219 | * currently capturing. When video transmission is enabled, this is the video signal which |
| 220 | * is sent to the remote device. |
| 221 | * |
| 222 | * @param surface The surface. |
| 223 | */ |
| 224 | public abstract void setPreviewSurface(Surface surface); |
| 225 | |
| 226 | /** |
| 227 | * Sets the surface to be used for displaying the video received from the remote device. |
| 228 | * |
| 229 | * @param surface The surface. |
| 230 | */ |
| 231 | public abstract void setDisplaySurface(Surface surface); |
| 232 | |
| 233 | /** |
| 234 | * Sets the device orientation, in degrees. Assumes that a standard portrait orientation of |
| 235 | * the device is 0 degrees. |
| 236 | * |
| 237 | * @param rotation The device orientation, in degrees. |
| 238 | */ |
| 239 | public abstract void setDeviceOrientation(int rotation); |
| 240 | |
| 241 | /** |
| 242 | * Sets camera zoom ratio. |
| 243 | * |
| 244 | * @param value The camera zoom ratio. |
| 245 | */ |
| 246 | public abstract void setZoom(float value); |
| 247 | |
| 248 | /** |
| 249 | * Issues a request to modify the properties of the current session. The request is sent to |
| 250 | * the remote device where it it handled by |
| 251 | * {@link VideoCall.Listener#onSessionModifyRequestReceived}. |
| 252 | * Some examples of session modification requests: upgrade call from audio to video, |
| 253 | * downgrade call from video to audio, pause video. |
| 254 | * |
| 255 | * @param requestProfile The requested call video properties. |
| 256 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 257 | public abstract void sendSessionModifyRequest(VideoProfile requestProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 258 | |
| 259 | /** |
| 260 | * Provides a response to a request to change the current call session video |
| 261 | * properties. |
| 262 | * This is in response to a request the InCall UI has received via |
| 263 | * {@link VideoCall.Listener#onSessionModifyRequestReceived}. |
| 264 | * The response is handled on the remove device by |
| 265 | * {@link VideoCall.Listener#onSessionModifyResponseReceived}. |
| 266 | * |
| 267 | * @param responseProfile The response call video properties. |
| 268 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 269 | public abstract void sendSessionModifyResponse(VideoProfile responseProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 270 | |
| 271 | /** |
| 272 | * Issues a request to the video provider to retrieve the camera capabilities. |
| 273 | * Camera capabilities are reported back to the caller via |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 274 | * {@link VideoCall.Listener#onCameraCapabilitiesChanged(CameraCapabilities)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 275 | */ |
| 276 | public abstract void requestCameraCapabilities(); |
| 277 | |
| 278 | /** |
| 279 | * Issues a request to the video telephony framework to retrieve the cumulative data usage for |
| 280 | * the current call. Data usage is reported back to the caller via |
| 281 | * {@link VideoCall.Listener#onCallDataUsageChanged}. |
| 282 | */ |
| 283 | public abstract void requestCallDataUsage(); |
| 284 | |
| 285 | /** |
| 286 | * Provides the video telephony framework with the URI of an image to be displayed to remote |
| 287 | * devices when the video signal is paused. |
| 288 | * |
| 289 | * @param uri URI of image to display. |
| 290 | */ |
| 291 | public abstract void setPauseImage(String uri); |
| 292 | |
| 293 | /** |
| 294 | * Listener class which invokes callbacks after video call actions occur. |
Tyler Gunn | 75537ae | 2014-08-22 11:33:13 -0700 | [diff] [blame] | 295 | * @hide |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 296 | */ |
| 297 | public static abstract class Listener { |
| 298 | /** |
| 299 | * Called when a session modification request is received from the remote device. |
Andrew Lee | 1418576 | 2014-07-25 09:41:56 -0700 | [diff] [blame] | 300 | * The remote request is sent via |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 301 | * {@link Connection.VideoProvider#onSendSessionModifyRequest}. The InCall UI |
Andrew Lee | 1418576 | 2014-07-25 09:41:56 -0700 | [diff] [blame] | 302 | * is responsible for potentially prompting the user whether they wish to accept the new |
| 303 | * call profile (e.g. prompt user if they wish to accept an upgrade from an audio to a |
| 304 | * video call) and should call |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 305 | * {@link Connection.VideoProvider#onSendSessionModifyResponse} to indicate |
Andrew Lee | 1418576 | 2014-07-25 09:41:56 -0700 | [diff] [blame] | 306 | * the video settings the user has agreed to. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 307 | * |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 308 | * @param videoProfile The requested video call profile. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 309 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 310 | public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 311 | |
| 312 | /** |
| 313 | * Called when a response to a session modification request is received from the remote |
| 314 | * device. The remote InCall UI sends the response using |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 315 | * {@link Connection.VideoProvider#onSendSessionModifyResponse}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 316 | * |
| 317 | * @param status Status of the session modify request. Valid values are |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 318 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, |
| 319 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, |
| 320 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID} |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 321 | * @param requestedProfile The original request which was sent to the remote device. |
| 322 | * @param responseProfile The actual profile changes made by the remote device. |
| 323 | */ |
| 324 | public abstract void onSessionModifyResponseReceived(int status, |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 325 | VideoProfile requestedProfile, VideoProfile responseProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 326 | |
| 327 | /** |
| 328 | * Handles events related to the current session which the client may wish to handle. |
| 329 | * These are separate from requested changes to the session due to the underlying |
| 330 | * protocol or connection. |
| 331 | * |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 332 | * Valid values are: |
| 333 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE}, |
| 334 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME}, |
| 335 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_START}, |
| 336 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP}, |
| 337 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE}, |
| 338 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY} |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 339 | * |
| 340 | * @param event The event. |
| 341 | */ |
| 342 | public abstract void onCallSessionEvent(int event); |
| 343 | |
| 344 | /** |
| 345 | * Handles a change to the video dimensions from the remote caller (peer). This could |
| 346 | * happen if, for example, the peer changes orientation of their device. |
| 347 | * |
| 348 | * @param width The updated peer video width. |
| 349 | * @param height The updated peer video height. |
| 350 | */ |
| 351 | public abstract void onPeerDimensionsChanged(int width, int height); |
| 352 | |
| 353 | /** |
| 354 | * Handles an update to the total data used for the current session. |
| 355 | * |
| 356 | * @param dataUsage The updated data usage. |
| 357 | */ |
| 358 | public abstract void onCallDataUsageChanged(int dataUsage); |
| 359 | |
| 360 | /** |
| 361 | * Handles a change in camera capabilities. |
| 362 | * |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 363 | * @param cameraCapabilities The changed camera capabilities. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 364 | */ |
| 365 | public abstract void onCameraCapabilitiesChanged( |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 366 | CameraCapabilities cameraCapabilities); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 367 | } |
| 368 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 369 | } |