summaryrefslogtreecommitdiffstats
path: root/telecomm/java
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-07-28 14:04:20 -0700
committerAndrew Lee <anwlee@google.com>2014-07-29 13:35:59 -0700
commit48332d622b138aeb3a198efe29bb3d4705411f62 (patch)
treec9f4378b192b8cb159e64e34334b3be72ba6e06d /telecomm/java
parent4d193bdbe70d82842ff3cba614a9ed6f32f1449b (diff)
downloadframeworks_base-48332d622b138aeb3a198efe29bb3d4705411f62.zip
frameworks_base-48332d622b138aeb3a198efe29bb3d4705411f62.tar.gz
frameworks_base-48332d622b138aeb3a198efe29bb3d4705411f62.tar.bz2
Convert VideoState into an inner class.
- Add helper functions to make it easier to figure out properties of a particular video state, to make things more convenient. - Update references and documentation. Bug: 16629892 Change-Id: I621532e8cab080afd56e5db739b9edbee6261f74
Diffstat (limited to 'telecomm/java')
-rw-r--r--telecomm/java/android/telecomm/Connection.java16
-rw-r--r--telecomm/java/android/telecomm/ConnectionRequest.java8
-rw-r--r--telecomm/java/android/telecomm/TelecommManager.java8
-rw-r--r--telecomm/java/android/telecomm/VideoCallProfile.java127
4 files changed, 110 insertions, 49 deletions
diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java
index 7123e09..8845821 100644
--- a/telecomm/java/android/telecomm/Connection.java
+++ b/telecomm/java/android/telecomm/Connection.java
@@ -130,10 +130,10 @@ public abstract class Connection {
/**
* Returns the video state of the call.
- * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
*
* @return The video state of the call.
*/
@@ -357,10 +357,10 @@ public abstract class Connection {
/**
* Set the video state for the connection.
- * Valid values: {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED}.
*
* @param videoState The new video state.
*/
diff --git a/telecomm/java/android/telecomm/ConnectionRequest.java b/telecomm/java/android/telecomm/ConnectionRequest.java
index 020b692..1016091 100644
--- a/telecomm/java/android/telecomm/ConnectionRequest.java
+++ b/telecomm/java/android/telecomm/ConnectionRequest.java
@@ -101,10 +101,10 @@ public final class ConnectionRequest implements Parcelable {
/**
* Determines the video state for the connection.
- * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED}.
+ * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link VideoCallProfile.VideoState#RX_ENABLED}.
*
* @return The video state for the connection.
*/
diff --git a/telecomm/java/android/telecomm/TelecommManager.java b/telecomm/java/android/telecomm/TelecommManager.java
index 49f95a6..0f31c52 100644
--- a/telecomm/java/android/telecomm/TelecommManager.java
+++ b/telecomm/java/android/telecomm/TelecommManager.java
@@ -72,10 +72,10 @@ public class TelecommManager {
* Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that
* determines the desired video state for an outgoing call.
* Valid options:
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_RX_ENABLED},
- * {@link android.telecomm.VideoCallProfile#VIDEO_STATE_TX_ENABLED}.
+ * {@link android.telecomm.VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link android.telecomm.VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link android.telecomm.VideoCallProfile.VideoState#RX_ENABLED},
+ * {@link android.telecomm.VideoCallProfile.VideoState#TX_ENABLED}.
*/
public static final String EXTRA_START_CALL_WITH_VIDEO_STATE =
"android.intent.extra.START_CALL_WITH_VIDEO_STATE";
diff --git a/telecomm/java/android/telecomm/VideoCallProfile.java b/telecomm/java/android/telecomm/VideoCallProfile.java
index 5b15e4a..24c6996 100644
--- a/telecomm/java/android/telecomm/VideoCallProfile.java
+++ b/telecomm/java/android/telecomm/VideoCallProfile.java
@@ -24,32 +24,6 @@ import android.os.Parcelable;
*/
public class VideoCallProfile implements Parcelable {
/**
- * Call is currently in an audio-only mode with no video transmission or receipt.
- */
- public static final int VIDEO_STATE_AUDIO_ONLY = 0x0;
-
- /**
- * Video transmission is enabled.
- */
- public static final int VIDEO_STATE_TX_ENABLED = 0x1;
-
- /**
- * Video reception is enabled.
- */
- public static final int VIDEO_STATE_RX_ENABLED = 0x2;
-
- /**
- * Video signal is bi-directional.
- */
- public static final int VIDEO_STATE_BIDIRECTIONAL =
- VIDEO_STATE_TX_ENABLED | VIDEO_STATE_RX_ENABLED;
-
- /**
- * Video is paused.
- */
- public static final int VIDEO_STATE_PAUSED = 0x4;
-
- /**
* "High" video quality.
*/
public static final int QUALITY_HIGH = 1;
@@ -94,13 +68,12 @@ public class VideoCallProfile implements Parcelable {
}
/**
- * The video state of the call. Stored as a bit-field describing whether video transmission and
- * receipt it enabled, as well as whether the video is currently muted.
- * Valid values: {@link VideoCallProfile#VIDEO_STATE_AUDIO_ONLY},
- * {@link VideoCallProfile#VIDEO_STATE_BIDIRECTIONAL},
- * {@link VideoCallProfile#VIDEO_STATE_TX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_RX_ENABLED},
- * {@link VideoCallProfile#VIDEO_STATE_PAUSED}.
+ * The video state of the call.
+ * Valid values: {@link VideoCallProfile.VideoState#AUDIO_ONLY},
+ * {@link VideoCallProfile.VideoState#BIDIRECTIONAL},
+ * {@link VideoCallProfile.VideoState#TX_ENABLED},
+ * {@link VideoCallProfile.VideoState#RX_ENABLED},
+ * {@link VideoCallProfile.VideoState#PAUSED}.
*/
public int getVideoState() {
return mVideoState;
@@ -165,4 +138,92 @@ public class VideoCallProfile implements Parcelable {
dest.writeInt(mVideoState);
dest.writeInt(mQuality);
}
+
+ /**
+ * The video state of the call, stored as a bit-field describing whether video transmission and
+ * receipt it enabled, as well as whether the video is currently muted.
+ */
+ public static class VideoState {
+ /**
+ * Call is currently in an audio-only mode with no video transmission or receipt.
+ */
+ public static final int AUDIO_ONLY = 0x0;
+
+ /**
+ * Video transmission is enabled.
+ */
+ public static final int TX_ENABLED = 0x1;
+
+ /**
+ * Video reception is enabled.
+ */
+ public static final int RX_ENABLED = 0x2;
+
+ /**
+ * Video signal is bi-directional.
+ */
+ public static final int BIDIRECTIONAL = TX_ENABLED | RX_ENABLED;
+
+ /**
+ * Video is paused.
+ */
+ public static final int PAUSED = 0x4;
+
+ /**
+ * Whether the video state is audio only.
+ * @param videoState The video state.
+ * @return Returns true if the video state is audio only.
+ */
+ public static boolean isAudioOnly(int videoState) {
+ return !hasState(videoState, TX_ENABLED) && !hasState(videoState, RX_ENABLED);
+ }
+
+ /**
+ * Whether the video transmission is enabled.
+ * @param videoState The video state.
+ * @return Returns true if the video transmission is enabled.
+ */
+ public static boolean isTransmissionEnabled(int videoState) {
+ return hasState(videoState, TX_ENABLED);
+ }
+
+ /**
+ * Whether the video reception is enabled.
+ * @param videoState The video state.
+ * @return Returns true if the video transmission is enabled.
+ */
+ public static boolean isReceptionEnabled(int videoState) {
+ return hasState(videoState, RX_ENABLED);
+ }
+
+ /**
+ * Whether the video signal is bi-directional.
+ * @param videoState
+ * @return Returns true if the video signal is bi-directional.
+ */
+ public static boolean isBidirectional(int videoState) {
+ return hasState(videoState, BIDIRECTIONAL);
+ }
+
+ /**
+ * Whether the video is paused.
+ * @param videoState The video state.
+ * @return Returns true if the video is paused.
+ */
+ public static boolean isPaused(int videoState) {
+ return hasState(videoState, PAUSED);
+ }
+
+ /**
+ * Determines if a specified state is set in a videoState bit-mask.
+ *
+ * @param videoState The video state bit-mask.
+ * @param state The state to check.
+ * @return {@code True} if the state is set.
+ * {@hide}
+ */
+ private static boolean hasState(int videoState, int state) {
+ return (videoState & state) == state;
+ }
+ }
}