Loading telecomm/java/android/telecom/VideoProfile.java +30 −10 Original line number Diff line number Diff line Loading @@ -16,13 +16,23 @@ package android.telecom; import android.annotation.IntDef; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Represents attributes of video calls. */ public class VideoProfile implements Parcelable { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef({QUALITY_UNKNOWN, QUALITY_HIGH, QUALITY_MEDIUM, QUALITY_LOW, QUALITY_DEFAULT}) public @interface VideoQuality {} /** * "Unknown" video quality. * @hide Loading @@ -48,6 +58,14 @@ public class VideoProfile implements Parcelable { */ public static final int QUALITY_DEFAULT = 4; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef( flag = true, value = {STATE_AUDIO_ONLY, STATE_TX_ENABLED, STATE_RX_ENABLED, STATE_BIDIRECTIONAL, STATE_PAUSED}) public @interface VideoState {} /** * Used when answering or dialing a call to indicate that the call does not have a video * component. Loading Loading @@ -107,7 +125,7 @@ public class VideoProfile implements Parcelable { * * @param videoState The video state. */ public VideoProfile(int videoState) { public VideoProfile(@VideoState int videoState) { this(videoState, QUALITY_DEFAULT); } Loading @@ -117,7 +135,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @param quality The video quality. */ public VideoProfile(int videoState, int quality) { public VideoProfile(@VideoState int videoState, @VideoQuality int quality) { mVideoState = videoState; mQuality = quality; } Loading @@ -130,6 +148,7 @@ public class VideoProfile implements Parcelable { * {@link VideoProfile#STATE_RX_ENABLED}, * {@link VideoProfile#STATE_PAUSED}. */ @VideoState public int getVideoState() { return mVideoState; } Loading @@ -139,6 +158,7 @@ public class VideoProfile implements Parcelable { * Valid values: {@link VideoProfile#QUALITY_HIGH}, {@link VideoProfile#QUALITY_MEDIUM}, * {@link VideoProfile#QUALITY_LOW}, {@link VideoProfile#QUALITY_DEFAULT}. */ @VideoQuality public int getQuality() { return mQuality; } Loading Loading @@ -211,7 +231,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return String representation of the video state. */ public static String videoStateToString(int videoState) { public static String videoStateToString(@VideoState int videoState) { StringBuilder sb = new StringBuilder(); sb.append("Audio"); Loading Loading @@ -240,7 +260,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video state is audio only, {@code false} otherwise. */ public static boolean isAudioOnly(int videoState) { public static boolean isAudioOnly(@VideoState int videoState) { return !hasState(videoState, VideoProfile.STATE_TX_ENABLED) && !hasState(videoState, VideoProfile.STATE_RX_ENABLED); } Loading @@ -251,7 +271,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video transmission or reception is enabled, {@code false} otherwise. */ public static boolean isVideo(int videoState) { public static boolean isVideo(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_TX_ENABLED) || hasState(videoState, VideoProfile.STATE_RX_ENABLED) || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); Loading @@ -263,7 +283,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video transmission is enabled, {@code false} otherwise. */ public static boolean isTransmissionEnabled(int videoState) { public static boolean isTransmissionEnabled(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_TX_ENABLED); } Loading @@ -273,7 +293,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video reception is enabled, {@code false} otherwise. */ public static boolean isReceptionEnabled(int videoState) { public static boolean isReceptionEnabled(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_RX_ENABLED); } Loading @@ -283,7 +303,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video is bi-directional, {@code false} otherwise. */ public static boolean isBidirectional(int videoState) { public static boolean isBidirectional(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); } Loading @@ -293,7 +313,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video is paused, {@code false} otherwise. */ public static boolean isPaused(int videoState) { public static boolean isPaused(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_PAUSED); } Loading @@ -304,7 +324,7 @@ public class VideoProfile implements Parcelable { * @param state The state to check. * @return {@code True} if the state is set. */ private static boolean hasState(int videoState, int state) { private static boolean hasState(@VideoState int videoState, @VideoState int state) { return (videoState & state) == state; } Loading Loading
telecomm/java/android/telecom/VideoProfile.java +30 −10 Original line number Diff line number Diff line Loading @@ -16,13 +16,23 @@ package android.telecom; import android.annotation.IntDef; import android.os.Parcel; import android.os.Parcelable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Represents attributes of video calls. */ public class VideoProfile implements Parcelable { /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef({QUALITY_UNKNOWN, QUALITY_HIGH, QUALITY_MEDIUM, QUALITY_LOW, QUALITY_DEFAULT}) public @interface VideoQuality {} /** * "Unknown" video quality. * @hide Loading @@ -48,6 +58,14 @@ public class VideoProfile implements Parcelable { */ public static final int QUALITY_DEFAULT = 4; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef( flag = true, value = {STATE_AUDIO_ONLY, STATE_TX_ENABLED, STATE_RX_ENABLED, STATE_BIDIRECTIONAL, STATE_PAUSED}) public @interface VideoState {} /** * Used when answering or dialing a call to indicate that the call does not have a video * component. Loading Loading @@ -107,7 +125,7 @@ public class VideoProfile implements Parcelable { * * @param videoState The video state. */ public VideoProfile(int videoState) { public VideoProfile(@VideoState int videoState) { this(videoState, QUALITY_DEFAULT); } Loading @@ -117,7 +135,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @param quality The video quality. */ public VideoProfile(int videoState, int quality) { public VideoProfile(@VideoState int videoState, @VideoQuality int quality) { mVideoState = videoState; mQuality = quality; } Loading @@ -130,6 +148,7 @@ public class VideoProfile implements Parcelable { * {@link VideoProfile#STATE_RX_ENABLED}, * {@link VideoProfile#STATE_PAUSED}. */ @VideoState public int getVideoState() { return mVideoState; } Loading @@ -139,6 +158,7 @@ public class VideoProfile implements Parcelable { * Valid values: {@link VideoProfile#QUALITY_HIGH}, {@link VideoProfile#QUALITY_MEDIUM}, * {@link VideoProfile#QUALITY_LOW}, {@link VideoProfile#QUALITY_DEFAULT}. */ @VideoQuality public int getQuality() { return mQuality; } Loading Loading @@ -211,7 +231,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return String representation of the video state. */ public static String videoStateToString(int videoState) { public static String videoStateToString(@VideoState int videoState) { StringBuilder sb = new StringBuilder(); sb.append("Audio"); Loading Loading @@ -240,7 +260,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video state is audio only, {@code false} otherwise. */ public static boolean isAudioOnly(int videoState) { public static boolean isAudioOnly(@VideoState int videoState) { return !hasState(videoState, VideoProfile.STATE_TX_ENABLED) && !hasState(videoState, VideoProfile.STATE_RX_ENABLED); } Loading @@ -251,7 +271,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video transmission or reception is enabled, {@code false} otherwise. */ public static boolean isVideo(int videoState) { public static boolean isVideo(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_TX_ENABLED) || hasState(videoState, VideoProfile.STATE_RX_ENABLED) || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); Loading @@ -263,7 +283,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video transmission is enabled, {@code false} otherwise. */ public static boolean isTransmissionEnabled(int videoState) { public static boolean isTransmissionEnabled(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_TX_ENABLED); } Loading @@ -273,7 +293,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if video reception is enabled, {@code false} otherwise. */ public static boolean isReceptionEnabled(int videoState) { public static boolean isReceptionEnabled(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_RX_ENABLED); } Loading @@ -283,7 +303,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video is bi-directional, {@code false} otherwise. */ public static boolean isBidirectional(int videoState) { public static boolean isBidirectional(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); } Loading @@ -293,7 +313,7 @@ public class VideoProfile implements Parcelable { * @param videoState The video state. * @return {@code True} if the video is paused, {@code false} otherwise. */ public static boolean isPaused(int videoState) { public static boolean isPaused(@VideoState int videoState) { return hasState(videoState, VideoProfile.STATE_PAUSED); } Loading @@ -304,7 +324,7 @@ public class VideoProfile implements Parcelable { * @param state The state to check. * @return {@code True} if the state is set. */ private static boolean hasState(int videoState, int state) { private static boolean hasState(@VideoState int videoState, @VideoState int state) { return (videoState & state) == state; } Loading