Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -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; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 18 | |
Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 20 | import android.os.Handler; |
| 21 | import android.os.IBinder; |
| 22 | import android.os.Looper; |
| 23 | import android.os.Message; |
| 24 | import android.os.RemoteException; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 25 | import android.telecom.InCallService.VideoCall; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 26 | import android.view.Surface; |
| 27 | |
Brad Ebinger | 0d55a30 | 2017-03-20 13:16:28 -0700 | [diff] [blame] | 28 | import com.android.internal.annotations.VisibleForTesting; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -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.IVideoCallback; |
| 31 | import com.android.internal.telecom.IVideoProvider; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Implementation of a Video Call, which allows InCallUi to communicate commands to the underlying |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 35 | * {@link Connection.VideoProvider}, and direct callbacks from the |
| 36 | * {@link Connection.VideoProvider} to the appropriate {@link VideoCall.Listener}. |
| 37 | * |
| 38 | * {@hide} |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 39 | */ |
| 40 | public class VideoCallImpl extends VideoCall { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 41 | |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 42 | private final IVideoProvider mVideoProvider; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 43 | private final VideoCallListenerBinder mBinder; |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 44 | private VideoCall.Callback mCallback; |
Tyler Gunn | 4538216 | 2015-05-06 08:52:27 -0700 | [diff] [blame] | 45 | private int mVideoQuality = VideoProfile.QUALITY_UNKNOWN; |
Tyler Gunn | 584ba6c | 2015-12-08 10:53:41 -0800 | [diff] [blame] | 46 | private int mVideoState = VideoProfile.STATE_AUDIO_ONLY; |
Tyler Gunn | bf9c6fd | 2016-11-09 10:19:23 -0800 | [diff] [blame] | 47 | private final String mCallingPackageName; |
Brad Ebinger | 0d55a30 | 2017-03-20 13:16:28 -0700 | [diff] [blame] | 48 | |
| 49 | private int mTargetSdkVersion; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 50 | |
| 51 | private IBinder.DeathRecipient mDeathRecipient = new IBinder.DeathRecipient() { |
| 52 | @Override |
| 53 | public void binderDied() { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 54 | mVideoProvider.asBinder().unlinkToDeath(this, 0); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 55 | } |
| 56 | }; |
| 57 | |
| 58 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 59 | * IVideoCallback stub implementation. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 60 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 61 | private final class VideoCallListenerBinder extends IVideoCallback.Stub { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 62 | @Override |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 63 | public void receiveSessionModifyRequest(VideoProfile videoProfile) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 64 | if (mHandler == null) { |
| 65 | return; |
| 66 | } |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 67 | mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_REQUEST, |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 68 | videoProfile).sendToTarget(); |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 69 | |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 70 | } |
| 71 | |
| 72 | @Override |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 73 | public void receiveSessionModifyResponse(int status, VideoProfile requestProfile, |
| 74 | VideoProfile responseProfile) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 75 | if (mHandler == null) { |
| 76 | return; |
| 77 | } |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 78 | SomeArgs args = SomeArgs.obtain(); |
| 79 | args.arg1 = status; |
| 80 | args.arg2 = requestProfile; |
| 81 | args.arg3 = responseProfile; |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 82 | mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_RESPONSE, args) |
| 83 | .sendToTarget(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public void handleCallSessionEvent(int event) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 88 | if (mHandler == null) { |
| 89 | return; |
| 90 | } |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 91 | mHandler.obtainMessage(MessageHandler.MSG_HANDLE_CALL_SESSION_EVENT, event) |
| 92 | .sendToTarget(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | @Override |
| 96 | public void changePeerDimensions(int width, int height) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 97 | if (mHandler == null) { |
| 98 | return; |
| 99 | } |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 100 | SomeArgs args = SomeArgs.obtain(); |
| 101 | args.arg1 = width; |
| 102 | args.arg2 = height; |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 103 | mHandler.obtainMessage(MessageHandler.MSG_CHANGE_PEER_DIMENSIONS, args).sendToTarget(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | @Override |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 107 | public void changeVideoQuality(int videoQuality) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 108 | if (mHandler == null) { |
| 109 | return; |
| 110 | } |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 111 | mHandler.obtainMessage(MessageHandler.MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0) |
| 112 | .sendToTarget(); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | @Override |
| 116 | public void changeCallDataUsage(long dataUsage) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 117 | if (mHandler == null) { |
| 118 | return; |
| 119 | } |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 120 | mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CALL_DATA_USAGE, dataUsage) |
| 121 | .sendToTarget(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | @Override |
Yorke Lee | 400470f | 2015-05-12 13:31:25 -0700 | [diff] [blame] | 125 | public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) { |
Tyler Gunn | e988cf7 | 2015-05-28 15:47:06 -0700 | [diff] [blame] | 126 | if (mHandler == null) { |
| 127 | return; |
| 128 | } |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 129 | mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CAMERA_CAPABILITIES, |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 130 | cameraCapabilities).sendToTarget(); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /** Default handler used to consolidate binder method calls onto a single thread. */ |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 135 | private final class MessageHandler extends Handler { |
| 136 | private static final int MSG_RECEIVE_SESSION_MODIFY_REQUEST = 1; |
| 137 | private static final int MSG_RECEIVE_SESSION_MODIFY_RESPONSE = 2; |
| 138 | private static final int MSG_HANDLE_CALL_SESSION_EVENT = 3; |
| 139 | private static final int MSG_CHANGE_PEER_DIMENSIONS = 4; |
| 140 | private static final int MSG_CHANGE_CALL_DATA_USAGE = 5; |
| 141 | private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6; |
| 142 | private static final int MSG_CHANGE_VIDEO_QUALITY = 7; |
| 143 | |
| 144 | public MessageHandler(Looper looper) { |
| 145 | super(looper); |
| 146 | } |
| 147 | |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 148 | @Override |
| 149 | public void handleMessage(Message msg) { |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 150 | if (mCallback == null) { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 151 | return; |
| 152 | } |
| 153 | |
| 154 | SomeArgs args; |
| 155 | switch (msg.what) { |
| 156 | case MSG_RECEIVE_SESSION_MODIFY_REQUEST: |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 157 | mCallback.onSessionModifyRequestReceived((VideoProfile) msg.obj); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 158 | break; |
| 159 | case MSG_RECEIVE_SESSION_MODIFY_RESPONSE: |
| 160 | args = (SomeArgs) msg.obj; |
| 161 | try { |
| 162 | int status = (int) args.arg1; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 163 | VideoProfile requestProfile = (VideoProfile) args.arg2; |
| 164 | VideoProfile responseProfile = (VideoProfile) args.arg3; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 165 | |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 166 | mCallback.onSessionModifyResponseReceived( |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 167 | status, requestProfile, responseProfile); |
| 168 | } finally { |
| 169 | args.recycle(); |
| 170 | } |
| 171 | break; |
| 172 | case MSG_HANDLE_CALL_SESSION_EVENT: |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 173 | mCallback.onCallSessionEvent((int) msg.obj); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 174 | break; |
| 175 | case MSG_CHANGE_PEER_DIMENSIONS: |
| 176 | args = (SomeArgs) msg.obj; |
| 177 | try { |
| 178 | int width = (int) args.arg1; |
| 179 | int height = (int) args.arg2; |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 180 | mCallback.onPeerDimensionsChanged(width, height); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 181 | } finally { |
| 182 | args.recycle(); |
| 183 | } |
| 184 | break; |
| 185 | case MSG_CHANGE_CALL_DATA_USAGE: |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 186 | mCallback.onCallDataUsageChanged((long) msg.obj); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 187 | break; |
| 188 | case MSG_CHANGE_CAMERA_CAPABILITIES: |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 189 | mCallback.onCameraCapabilitiesChanged( |
Yorke Lee | 400470f | 2015-05-12 13:31:25 -0700 | [diff] [blame] | 190 | (VideoProfile.CameraCapabilities) msg.obj); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 191 | break; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 192 | case MSG_CHANGE_VIDEO_QUALITY: |
Tyler Gunn | 4538216 | 2015-05-06 08:52:27 -0700 | [diff] [blame] | 193 | mVideoQuality = msg.arg1; |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 194 | mCallback.onVideoQualityChanged(msg.arg1); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 195 | break; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 196 | default: |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | }; |
| 201 | |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 202 | private Handler mHandler; |
| 203 | |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 204 | VideoCallImpl(IVideoProvider videoProvider, String callingPackageName, int targetSdkVersion) |
| 205 | throws RemoteException { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 206 | mVideoProvider = videoProvider; |
| 207 | mVideoProvider.asBinder().linkToDeath(mDeathRecipient, 0); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 208 | |
| 209 | mBinder = new VideoCallListenerBinder(); |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 210 | mVideoProvider.addVideoCallback(mBinder); |
Tyler Gunn | bf9c6fd | 2016-11-09 10:19:23 -0800 | [diff] [blame] | 211 | mCallingPackageName = callingPackageName; |
Brad Ebinger | 0d55a30 | 2017-03-20 13:16:28 -0700 | [diff] [blame] | 212 | setTargetSdkVersion(targetSdkVersion); |
| 213 | } |
| 214 | |
| 215 | @VisibleForTesting |
| 216 | public void setTargetSdkVersion(int sdkVersion) { |
| 217 | mTargetSdkVersion = sdkVersion; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 218 | } |
| 219 | |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 220 | public void destroy() { |
| 221 | unregisterCallback(mCallback); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | /** {@inheritDoc} */ |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 225 | public void registerCallback(VideoCall.Callback callback) { |
| 226 | registerCallback(callback, null); |
| 227 | } |
| 228 | |
| 229 | /** {@inheritDoc} */ |
| 230 | public void registerCallback(VideoCall.Callback callback, Handler handler) { |
| 231 | mCallback = callback; |
| 232 | if (handler == null) { |
| 233 | mHandler = new MessageHandler(Looper.getMainLooper()); |
| 234 | } else { |
| 235 | mHandler = new MessageHandler(handler.getLooper()); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | /** {@inheritDoc} */ |
| 240 | public void unregisterCallback(VideoCall.Callback callback) { |
| 241 | if (callback != mCallback) { |
| 242 | return; |
| 243 | } |
| 244 | |
Etan Cohen | 8942724 | 2015-04-23 12:26:37 -0700 | [diff] [blame] | 245 | mCallback = null; |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 246 | try { |
| 247 | mVideoProvider.removeVideoCallback(mBinder); |
| 248 | } catch (RemoteException e) { |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | /** {@inheritDoc} */ |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 253 | public void setCamera(String cameraId) { |
| 254 | try { |
Tyler Gunn | bf9c6fd | 2016-11-09 10:19:23 -0800 | [diff] [blame] | 255 | Log.w(this, "setCamera: cameraId=%s, calling=%s", cameraId, mCallingPackageName); |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 256 | mVideoProvider.setCamera(cameraId, mCallingPackageName, mTargetSdkVersion); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 257 | } catch (RemoteException e) { |
| 258 | } |
| 259 | } |
| 260 | |
| 261 | /** {@inheritDoc} */ |
| 262 | public void setPreviewSurface(Surface surface) { |
| 263 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 264 | mVideoProvider.setPreviewSurface(surface); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 265 | } catch (RemoteException e) { |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | /** {@inheritDoc} */ |
| 270 | public void setDisplaySurface(Surface surface) { |
| 271 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 272 | mVideoProvider.setDisplaySurface(surface); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 273 | } catch (RemoteException e) { |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | /** {@inheritDoc} */ |
| 278 | public void setDeviceOrientation(int rotation) { |
| 279 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 280 | mVideoProvider.setDeviceOrientation(rotation); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 281 | } catch (RemoteException e) { |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | /** {@inheritDoc} */ |
| 286 | public void setZoom(float value) { |
| 287 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 288 | mVideoProvider.setZoom(value); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 289 | } catch (RemoteException e) { |
| 290 | } |
| 291 | } |
| 292 | |
Tyler Gunn | 4538216 | 2015-05-06 08:52:27 -0700 | [diff] [blame] | 293 | /** |
| 294 | * Sends a session modification request to the video provider. |
| 295 | * <p> |
| 296 | * The {@link InCallService} will create the {@code requestProfile} based on the current |
| 297 | * video state (i.e. {@link Call.Details#getVideoState()}). It is, however, possible that the |
| 298 | * video state maintained by the {@link InCallService} could get out of sync with what is known |
| 299 | * by the {@link android.telecom.Connection.VideoProvider}. To remove ambiguity, the |
| 300 | * {@link VideoCallImpl} passes along the pre-modify video profile to the {@code VideoProvider} |
| 301 | * to ensure it has full context of the requested change. |
| 302 | * |
| 303 | * @param requestProfile The requested video profile. |
| 304 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 305 | public void sendSessionModifyRequest(VideoProfile requestProfile) { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 306 | try { |
Tyler Gunn | 584ba6c | 2015-12-08 10:53:41 -0800 | [diff] [blame] | 307 | VideoProfile originalProfile = new VideoProfile(mVideoState, mVideoQuality); |
Tyler Gunn | 4538216 | 2015-05-06 08:52:27 -0700 | [diff] [blame] | 308 | |
| 309 | mVideoProvider.sendSessionModifyRequest(originalProfile, requestProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 310 | } catch (RemoteException e) { |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /** {@inheritDoc} */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 315 | public void sendSessionModifyResponse(VideoProfile responseProfile) { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 316 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 317 | mVideoProvider.sendSessionModifyResponse(responseProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 318 | } catch (RemoteException e) { |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | /** {@inheritDoc} */ |
| 323 | public void requestCameraCapabilities() { |
| 324 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 325 | mVideoProvider.requestCameraCapabilities(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 326 | } catch (RemoteException e) { |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | /** {@inheritDoc} */ |
| 331 | public void requestCallDataUsage() { |
| 332 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 333 | mVideoProvider.requestCallDataUsage(); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 334 | } catch (RemoteException e) { |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | /** {@inheritDoc} */ |
Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 339 | public void setPauseImage(Uri uri) { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 340 | try { |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 341 | mVideoProvider.setPauseImage(uri); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 342 | } catch (RemoteException e) { |
| 343 | } |
| 344 | } |
Tyler Gunn | 584ba6c | 2015-12-08 10:53:41 -0800 | [diff] [blame] | 345 | |
| 346 | /** |
| 347 | * Sets the video state for the current video call. |
| 348 | * @param videoState the new video state. |
| 349 | */ |
| 350 | public void setVideoState(int videoState) { |
| 351 | mVideoState = videoState; |
| 352 | } |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 353 | } |