summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-07-17 07:50:22 -0700
committerTyler Gunn <tgunn@google.com>2014-07-18 01:30:34 +0000
commitaa07df84f279a87ad6370758c9d792a660f2cebb (patch)
tree2aa10da887653db7be81d0d71f48d9a787336a3f /telephony
parent3ee06efef34b7f619b6b31b58447c64eda9fc0e7 (diff)
downloadframeworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.zip
frameworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.tar.gz
frameworks_base-aa07df84f279a87ad6370758c9d792a660f2cebb.tar.bz2
Wiring video state through from Connection
Bug: 16285417 Bug: 16013178 Change-Id: Ia48959248ca22f4569b0ffd01a1716470aa0a711
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/ims/ImsCallProfile.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/telephony/java/com/android/ims/ImsCallProfile.java b/telephony/java/com/android/ims/ImsCallProfile.java
index 208f467..6896f4d 100644
--- a/telephony/java/com/android/ims/ImsCallProfile.java
+++ b/telephony/java/com/android/ims/ImsCallProfile.java
@@ -19,6 +19,7 @@ package com.android.ims;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
+import android.telecomm.VideoCallProfile;
/**
* Parcelable object to handle IMS call profile.
@@ -286,4 +287,63 @@ public class ImsCallProfile implements Parcelable {
return new ImsCallProfile[size];
}
};
+
+ /**
+ * Converts from the call types defined in {@link com.android.ims.ImsCallProfile} to the
+ * video state values defined in {@link android.telecomm.VideoCallProfile}.
+ *
+ * @param callType The call type.
+ * @return The video state.
+ */
+ public static int getVideoStateFromCallType(int callType) {
+ switch (callType) {
+ case CALL_TYPE_VT_NODIR:
+ return VideoCallProfile.VIDEO_STATE_PAUSED |
+ VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
+ case CALL_TYPE_VT_TX:
+ return VideoCallProfile.VIDEO_STATE_TX_ENABLED;
+ case CALL_TYPE_VT_RX:
+ return VideoCallProfile.VIDEO_STATE_RX_ENABLED;
+ case CALL_TYPE_VT:
+ return VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
+ case CALL_TYPE_VOICE:
+ return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
+ default:
+ return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
+ }
+ }
+
+ /**
+ * Converts from the video state values defined in {@link android.telecomm.VideoCallProfile}
+ * to the call types defined in {@link ImsCallProfile}.
+ *
+ * @param videoState The video state.
+ * @return The call type.
+ */
+ public static int getCallTypeFromVideoState(int videoState) {
+ boolean videoTx = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_TX_ENABLED);
+ boolean videoRx = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_RX_ENABLED);
+ boolean isPaused = isVideoStateSet(videoState, VideoCallProfile.VIDEO_STATE_PAUSED);
+ if (isPaused) {
+ return ImsCallProfile.CALL_TYPE_VT_NODIR;
+ } else if (videoTx && !videoRx) {
+ return ImsCallProfile.CALL_TYPE_VT_TX;
+ } else if (!videoTx && videoRx) {
+ return ImsCallProfile.CALL_TYPE_VT_RX;
+ } else if (videoTx && videoRx) {
+ return ImsCallProfile.CALL_TYPE_VT;
+ }
+ return ImsCallProfile.CALL_TYPE_VOICE;
+ }
+
+ /**
+ * Determines if a video state is set in a video state bit-mask.
+ *
+ * @param videoState The video state bit mask.
+ * @param videoStateToCheck The particular video state to check.
+ * @return True if the video state is set in the bit-mask.
+ */
+ private static boolean isVideoStateSet(int videoState, int videoStateToCheck) {
+ return (videoState & videoStateToCheck) == videoStateToCheck;
+ }
}