Home | History | Annotate | Download | only in videotech
      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 android.support.annotation.NonNull;
     21 import android.support.annotation.Nullable;
     22 import android.telecom.PhoneAccountHandle;
     23 import com.android.dialer.logging.DialerImpression;
     24 import com.android.incallui.video.protocol.VideoCallScreen;
     25 import com.android.incallui.video.protocol.VideoCallScreenDelegate;
     26 import com.android.incallui.videotech.utils.SessionModificationState;
     27 
     28 /** Video calling interface. */
     29 public interface VideoTech {
     30 
     31   boolean isAvailable(Context context, PhoneAccountHandle phoneAccountHandle);
     32 
     33   boolean isTransmittingOrReceiving();
     34 
     35   /**
     36    * Determines if the answer video UI should open the camera directly instead of letting the video
     37    * tech manage the camera.
     38    */
     39   boolean isSelfManagedCamera();
     40 
     41   boolean shouldUseSurfaceView();
     42 
     43   /**
     44    * Returns true if the video is paused. This is different than if the video stream has been turned
     45    * off.
     46    *
     47    * <p>See {@link #isTransmitting()}
     48    */
     49   boolean isPaused();
     50 
     51   VideoCallScreenDelegate createVideoCallScreenDelegate(
     52       Context context, VideoCallScreen videoCallScreen);
     53 
     54   void onCallStateChanged(Context context, int newState, PhoneAccountHandle phoneAccountHandle);
     55 
     56   void onRemovedFromCallList();
     57 
     58   @SessionModificationState
     59   int getSessionModificationState();
     60 
     61   void upgradeToVideo(@NonNull Context context);
     62 
     63   void acceptVideoRequest(@NonNull Context context);
     64 
     65   void acceptVideoRequestAsAudio();
     66 
     67   void declineVideoRequest();
     68 
     69   boolean isTransmitting();
     70 
     71   void stopTransmission();
     72 
     73   void resumeTransmission(@NonNull Context context);
     74 
     75   void pause();
     76 
     77   void unpause();
     78 
     79   void setCamera(@Nullable String cameraId);
     80 
     81   void setDeviceOrientation(int rotation);
     82 
     83   /**
     84    * Called on {@code VideoTechManager.savedTech} when it's first selected and it will always be
     85    * used.
     86    */
     87   void becomePrimary();
     88 
     89   com.android.dialer.logging.VideoTech.Type getVideoTechType();
     90 
     91   /** Listener for video call events. */
     92   interface VideoTechListener {
     93 
     94     void onVideoTechStateChanged();
     95 
     96     void onSessionModificationStateChanged();
     97 
     98     void onCameraDimensionsChanged(int width, int height);
     99 
    100     void onPeerDimensionsChanged(int width, int height);
    101 
    102     void onVideoUpgradeRequestReceived();
    103 
    104     void onUpgradedToVideo(boolean switchToSpeaker);
    105 
    106     void onImpressionLoggingNeeded(DialerImpression.Type impressionType);
    107   }
    108 }
    109