Merge "Use some Call.Details methods available in L-Mr1." into ub-contactsdialer-b-dev
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 4bb86d0..d4dbda8 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -54,6 +54,7 @@
import com.android.dialer.filterednumber.FilteredNumbersUtil;
import com.android.dialer.logging.InteractionEvent;
import com.android.dialer.logging.Logger;
+import com.android.dialer.util.TelecomUtil;
import com.android.incallui.compat.telecom.DetailsCompat;
import com.android.incallui.util.TelecomCallUtil;
import com.android.incalluibind.ObjectFactory;
@@ -237,7 +238,7 @@
if (id != null) {
// Silence the ringer now to prevent ringing and vibration before the call is
// terminated when Telecom attempts to add it.
- getTelecomManager().silenceRinger();
+ TelecomUtil.silenceRinger(mContext);
}
}
};
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 9f1f8f8..ebdf820 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.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 @@
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 @@
}
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 @@
if (showIncomingVideo || showOutgoingVideo) {
ui.showVideoViews(showOutgoingVideo, showIncomingVideo);
- if (VideoProfile.isReceptionEnabled(videoState)) {
+ if (VideoProfileCompat.isReceptionEnabled(videoState)) {
loadProfilePhotoAsync();
}
} else {
@@ -768,7 +769,7 @@
}
InCallPresenter.getInstance().enableScreenTimeout(
- VideoProfile.isAudioOnly(videoState));
+ VideoProfileCompat.isAudioOnly(videoState));
}
/**
@@ -785,10 +786,10 @@
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 @@
return false;
}
- return VideoProfile.isTransmissionEnabled(videoState);
+ return VideoProfileCompat.isTransmissionEnabled(videoState);
}
/**
@@ -1231,8 +1232,8 @@
}
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 8641d60..7e0926b 100644
--- a/InCallUI/src/com/android/incallui/VideoUtils.java
+++ b/InCallUI/src/com/android/incallui/VideoUtils.java
@@ -19,6 +19,7 @@
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 @@
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 @@
return false;
}
- return VideoProfile.isBidirectional(call.getVideoState());
+ return VideoProfileCompat.isBidirectional(call.getVideoState());
}
public static boolean isIncomingVideoCall(Call call) {
@@ -71,7 +72,7 @@
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 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 54d8eed..6e81bd7 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 @@
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);
+ }
}