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