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
This commit is contained in:
@@ -28996,11 +28996,20 @@ package android.telecomm {
|
||||
field public static final int QUALITY_HIGH = 1; // 0x1
|
||||
field public static final int QUALITY_LOW = 3; // 0x3
|
||||
field public static final int QUALITY_MEDIUM = 2; // 0x2
|
||||
field public static final int VIDEO_STATE_AUDIO_ONLY = 0; // 0x0
|
||||
field public static final int VIDEO_STATE_BIDIRECTIONAL = 3; // 0x3
|
||||
field public static final int VIDEO_STATE_PAUSED = 4; // 0x4
|
||||
field public static final int VIDEO_STATE_RX_ENABLED = 2; // 0x2
|
||||
field public static final int VIDEO_STATE_TX_ENABLED = 1; // 0x1
|
||||
}
|
||||
|
||||
public static class VideoCallProfile.VideoState {
|
||||
ctor public VideoCallProfile.VideoState();
|
||||
method public static boolean isAudioOnly(int);
|
||||
method public static boolean isPaused(int);
|
||||
method public static boolean isReceptionEnabled(int);
|
||||
method public static boolean isBidirectional(int);
|
||||
method public static boolean isTransmissionEnabled(int);
|
||||
field public static final int AUDIO_ONLY = 0; // 0x0
|
||||
field public static final int BIDIRECTIONAL = 3; // 0x3
|
||||
field public static final int PAUSED = 4; // 0x4
|
||||
field public static final int RX_ENABLED = 2; // 0x2
|
||||
field public static final int TX_ENABLED = 1; // 0x1
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -23,32 +23,6 @@ import android.os.Parcelable;
|
||||
* Represents attributes of video calls.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,18 +298,18 @@ public class ImsCallProfile implements Parcelable {
|
||||
public static int getVideoStateFromCallType(int callType) {
|
||||
switch (callType) {
|
||||
case CALL_TYPE_VT_NODIR:
|
||||
return VideoCallProfile.VIDEO_STATE_PAUSED |
|
||||
VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
|
||||
return VideoCallProfile.VideoState.PAUSED |
|
||||
VideoCallProfile.VideoState.BIDIRECTIONAL;
|
||||
case CALL_TYPE_VT_TX:
|
||||
return VideoCallProfile.VIDEO_STATE_TX_ENABLED;
|
||||
return VideoCallProfile.VideoState.TX_ENABLED;
|
||||
case CALL_TYPE_VT_RX:
|
||||
return VideoCallProfile.VIDEO_STATE_RX_ENABLED;
|
||||
return VideoCallProfile.VideoState.RX_ENABLED;
|
||||
case CALL_TYPE_VT:
|
||||
return VideoCallProfile.VIDEO_STATE_BIDIRECTIONAL;
|
||||
return VideoCallProfile.VideoState.BIDIRECTIONAL;
|
||||
case CALL_TYPE_VOICE:
|
||||
return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
|
||||
return VideoCallProfile.VideoState.AUDIO_ONLY;
|
||||
default:
|
||||
return VideoCallProfile.VIDEO_STATE_AUDIO_ONLY;
|
||||
return VideoCallProfile.VideoState.AUDIO_ONLY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,9 +321,9 @@ public class ImsCallProfile implements Parcelable {
|
||||
* @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);
|
||||
boolean videoTx = isVideoStateSet(videoState, VideoCallProfile.VideoState.TX_ENABLED);
|
||||
boolean videoRx = isVideoStateSet(videoState, VideoCallProfile.VideoState.RX_ENABLED);
|
||||
boolean isPaused = isVideoStateSet(videoState, VideoCallProfile.VideoState.PAUSED);
|
||||
if (isPaused) {
|
||||
return ImsCallProfile.CALL_TYPE_VT_NODIR;
|
||||
} else if (videoTx && !videoRx) {
|
||||
|
||||
Reference in New Issue
Block a user