summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorBrandon Maxwell <maxwelb@google.com>2015-12-22 11:34:22 -0800
committerandroid-build-merger <android-build-merger@google.com>2015-12-22 11:34:22 -0800
commit936abdbe3cbd8a4761357322e744ac55eeaf0cdb (patch)
tree1154359b9749fc90b75d8dd405297063f6599e70 /InCallUI
parentf4c4436b0f75c923a8cf85b4c0e7af559ce62f22 (diff)
parentacf06a5d427e4a7540576bed34c31312b59c6113 (diff)
Backporting usage of VideoProfile
am: 342419f9b9 * commit '342419f9b920fa201b18812e0bd03c24cc32a335': Backporting usage of VideoProfile
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java25
-rw-r--r--InCallUI/src/com/android/incallui/VideoUtils.java11
-rw-r--r--InCallUI/src/com/android/incallui/compat/telecom/VideoProfileCompat.java13
3 files changed, 32 insertions, 17 deletions
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 9f1f8f89c..ebdf82048 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -39,6 +39,7 @@ import com.android.incallui.InCallPresenter.InCallStateListener;
import com.android.incallui.InCallPresenter.IncomingCallListener;
import com.android.incallui.InCallVideoCallCallbackNotifier.SurfaceChangeListener;
import com.android.incallui.InCallVideoCallCallbackNotifier.VideoEventListener;
+import com.android.incallui.compat.telecom.VideoProfileCompat;
import java.util.Objects;
@@ -487,8 +488,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
Log.d(this, "checkForVideoStateChange: isVideoCall= " + isVideoCall
+ " hasVideoStateChanged=" + hasVideoStateChanged + " isVideoMode="
+ isVideoMode() + " previousVideoState: " +
- VideoProfile.videoStateToString(mCurrentVideoState) + " newVideoState: "
- + VideoProfile.videoStateToString(call.getVideoState()));
+ VideoProfileCompat.videoStateToString(mCurrentVideoState) + " newVideoState: "
+ + VideoProfileCompat.videoStateToString(call.getVideoState()));
if (!hasVideoStateChanged) {
return;
@@ -658,12 +659,12 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private static boolean isCameraRequired(int videoState) {
- return VideoProfile.isBidirectional(videoState) ||
- VideoProfile.isTransmissionEnabled(videoState);
+ return VideoProfileCompat.isBidirectional(videoState) ||
+ VideoProfileCompat.isTransmissionEnabled(videoState);
}
private boolean isCameraRequired() {
- return mPrimaryCall != null ? isCameraRequired(mPrimaryCall.getVideoState()) : false;
+ return mPrimaryCall != null && isCameraRequired(mPrimaryCall.getVideoState());
}
/**
@@ -760,7 +761,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (showIncomingVideo || showOutgoingVideo) {
ui.showVideoViews(showOutgoingVideo, showIncomingVideo);
- if (VideoProfile.isReceptionEnabled(videoState)) {
+ if (VideoProfileCompat.isReceptionEnabled(videoState)) {
loadProfilePhotoAsync();
}
} else {
@@ -768,7 +769,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
InCallPresenter.getInstance().enableScreenTimeout(
- VideoProfile.isAudioOnly(videoState));
+ VideoProfileCompat.isAudioOnly(videoState));
}
/**
@@ -785,10 +786,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return false;
}
- boolean isPaused = VideoProfile.isPaused(videoState);
+ boolean isPaused = VideoProfileCompat.isPaused(videoState);
boolean isCallActive = callState == Call.State.ACTIVE;
- return !isPaused && isCallActive && VideoProfile.isReceptionEnabled(videoState);
+ return !isPaused && isCallActive && VideoProfileCompat.isReceptionEnabled(videoState);
}
/**
@@ -804,7 +805,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return false;
}
- return VideoProfile.isTransmissionEnabled(videoState);
+ return VideoProfileCompat.isTransmissionEnabled(videoState);
}
/**
@@ -1231,8 +1232,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private static int toCameraDirection(int videoState) {
- return VideoProfile.isTransmissionEnabled(videoState) &&
- !VideoProfile.isBidirectional(videoState)
+ return VideoProfileCompat.isTransmissionEnabled(videoState) &&
+ !VideoProfileCompat.isBidirectional(videoState)
? Call.VideoSettings.CAMERA_DIRECTION_BACK_FACING
: Call.VideoSettings.CAMERA_DIRECTION_FRONT_FACING;
}
diff --git a/InCallUI/src/com/android/incallui/VideoUtils.java b/InCallUI/src/com/android/incallui/VideoUtils.java
index 8641d60ec..7e0926b46 100644
--- a/InCallUI/src/com/android/incallui/VideoUtils.java
+++ b/InCallUI/src/com/android/incallui/VideoUtils.java
@@ -19,6 +19,7 @@ package com.android.incallui;
import android.telecom.VideoProfile;
import com.android.contacts.common.compat.CompatUtils;
+import com.android.incallui.compat.telecom.VideoProfileCompat;
import com.google.common.base.Preconditions;
@@ -33,8 +34,8 @@ public class VideoUtils {
return false;
}
- return VideoProfile.isTransmissionEnabled(videoState)
- || VideoProfile.isReceptionEnabled(videoState);
+ return VideoProfileCompat.isTransmissionEnabled(videoState)
+ || VideoProfileCompat.isReceptionEnabled(videoState);
}
public static boolean isBidirectionalVideoCall(Call call) {
@@ -42,7 +43,7 @@ public class VideoUtils {
return false;
}
- return VideoProfile.isBidirectional(call.getVideoState());
+ return VideoProfileCompat.isBidirectional(call.getVideoState());
}
public static boolean isIncomingVideoCall(Call call) {
@@ -71,7 +72,7 @@ public class VideoUtils {
return true;
}
- return call != null && VideoProfile.isAudioOnly(call.getVideoState());
+ return call != null && VideoProfileCompat.isAudioOnly(call.getVideoState());
}
// TODO (ims-vt) Check if special handling is needed for CONF calls.
@@ -81,7 +82,7 @@ public class VideoUtils {
public static VideoProfile makeVideoPauseProfile(Call call) {
Preconditions.checkNotNull(call);
- Preconditions.checkState(!VideoProfile.isAudioOnly(call.getVideoState()));
+ Preconditions.checkState(!VideoProfileCompat.isAudioOnly(call.getVideoState()));
return new VideoProfile(getPausedVideoState(call.getVideoState()));
}
diff --git a/InCallUI/src/com/android/incallui/compat/telecom/VideoProfileCompat.java b/InCallUI/src/com/android/incallui/compat/telecom/VideoProfileCompat.java
index 54d8eed65..6e81bd79a 100644
--- a/InCallUI/src/com/android/incallui/compat/telecom/VideoProfileCompat.java
+++ b/InCallUI/src/com/android/incallui/compat/telecom/VideoProfileCompat.java
@@ -124,4 +124,17 @@ public class VideoProfileCompat {
private static boolean hasState(int videoState, int state) {
return (videoState & state) == state;
}
+
+ /**
+ * Indicates whether the video state is bi-directional.
+ *
+ * @param videoState The video state.
+ * @return {@code True} if the video is bi-directional, {@code false} otherwise.
+ */
+ public static boolean isBidirectional(int videoState) {
+ if (CompatUtils.isMarshmallowCompatible()) {
+ return VideoProfile.isBidirectional(videoState);
+ }
+ return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
+ }
}