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 17 package com.android.server.telecom.testapps; 18 19 import android.telecom.CameraCapabilities; 20 import android.telecom.Connection; 21 import android.telecom.RemoteConnection; 22 import android.telecom.VideoProfile; 23 import android.view.Surface; 24 25 public class TestManagedVideoProvider extends Connection.VideoProvider { 26 27 private final RemoteConnection.VideoProvider.Listener mRemoteListener = 28 new RemoteConnection.VideoProvider.Listener() { 29 @Override 30 public void onReceiveSessionModifyRequest(RemoteConnection.VideoProvider rvp, 31 VideoProfile videoProfile) { 32 super.onReceiveSessionModifyRequest(rvp, videoProfile); 33 } 34 35 @Override 36 public void onReceiveSessionModifyResponse(RemoteConnection.VideoProvider rvp, 37 int status, 38 VideoProfile requestedProfile, VideoProfile responseProfile) { 39 super.onReceiveSessionModifyResponse(rvp, status, requestedProfile, 40 responseProfile); 41 } 42 43 @Override 44 public void onHandleCallSessionEvent(RemoteConnection.VideoProvider rvp, int event) { 45 super.onHandleCallSessionEvent(rvp, event); 46 } 47 48 @Override 49 public void onPeerDimensionsChanged(RemoteConnection.VideoProvider rvp, int width, 50 int height) { 51 super.onPeerDimensionsChanged(rvp, width, height); 52 } 53 54 @Override 55 public void onCallDataUsageChanged(RemoteConnection.VideoProvider rvp, int dataUsage) { 56 super.onCallDataUsageChanged(rvp, dataUsage); 57 } 58 59 @Override 60 public void onCameraCapabilitiesChanged(RemoteConnection.VideoProvider rvp, 61 CameraCapabilities cameraCapabilities) { 62 super.onCameraCapabilitiesChanged(rvp, cameraCapabilities); 63 } 64 }; 65 66 private final RemoteConnection.VideoProvider mRemoteVideoProvider; 67 68 public TestManagedVideoProvider(RemoteConnection.VideoProvider remoteVideoProvider) { 69 mRemoteVideoProvider = remoteVideoProvider; 70 mRemoteVideoProvider.addListener(mRemoteListener); 71 } 72 73 @Override 74 public void onSetCamera(String cameraId) { 75 mRemoteVideoProvider.setCamera(cameraId); 76 } 77 78 @Override 79 public void onSetPreviewSurface(Surface surface) { 80 mRemoteVideoProvider.setPreviewSurface(surface); 81 } 82 83 @Override 84 public void onSetDisplaySurface(Surface surface) { 85 mRemoteVideoProvider.setDisplaySurface(surface); 86 } 87 88 @Override 89 public void onSetDeviceOrientation(int rotation) { 90 mRemoteVideoProvider.setDeviceOrientation(rotation); 91 } 92 93 @Override 94 public void onSetZoom(float value) { 95 mRemoteVideoProvider.setZoom(value); 96 } 97 98 @Override 99 public void onSendSessionModifyRequest(VideoProfile requestProfile) { 100 mRemoteVideoProvider.sendSessionModifyRequest(requestProfile); 101 } 102 103 @Override 104 public void onSendSessionModifyResponse(VideoProfile responseProfile) { 105 mRemoteVideoProvider.sendSessionModifyResponse(responseProfile); 106 } 107 108 @Override 109 public void onRequestCameraCapabilities() { 110 mRemoteVideoProvider.requestCameraCapabilities(); 111 } 112 113 @Override 114 public void onRequestCallDataUsage() { 115 mRemoteVideoProvider.requestCallDataUsage(); 116 } 117 118 @Override 119 public void onSetPauseImage(String uri) { 120 mRemoteVideoProvider.setPauseImage(uri); 121 } 122 } 123