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