1 /* 2 * Copyright (C) 2017 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.incallui.videotech; 18 19 import android.content.Context; 20 import com.android.incallui.video.protocol.VideoCallScreen; 21 import com.android.incallui.video.protocol.VideoCallScreenDelegate; 22 import com.android.incallui.videotech.utils.SessionModificationState; 23 24 /** Video calling interface. */ 25 public interface VideoTech { 26 27 boolean isAvailable(Context context); 28 29 boolean isTransmittingOrReceiving(); 30 31 /** 32 * Determines if the answer video UI should open the camera directly instead of letting the video 33 * tech manage the camera. 34 */ 35 boolean isSelfManagedCamera(); 36 37 boolean shouldUseSurfaceView(); 38 39 VideoCallScreenDelegate createVideoCallScreenDelegate( 40 Context context, VideoCallScreen videoCallScreen); 41 42 void onCallStateChanged(Context context, int newState); 43 44 @SessionModificationState 45 int getSessionModificationState(); 46 47 void upgradeToVideo(); 48 49 void acceptVideoRequest(); 50 51 void acceptVideoRequestAsAudio(); 52 53 void declineVideoRequest(); 54 55 boolean isTransmitting(); 56 57 void stopTransmission(); 58 59 void resumeTransmission(); 60 61 void pause(); 62 63 void unpause(); 64 65 void setCamera(String cameraId); 66 67 void setDeviceOrientation(int rotation); 68 69 /** Listener for video call events. */ 70 interface VideoTechListener { 71 72 void onVideoTechStateChanged(); 73 74 void onSessionModificationStateChanged(); 75 76 void onCameraDimensionsChanged(int width, int height); 77 78 void onPeerDimensionsChanged(int width, int height); 79 80 void onVideoUpgradeRequestReceived(); 81 82 void onUpgradedToVideo(boolean switchToSpeaker); 83 } 84 } 85