Merge "API Cleanup: Remove VideoState class." into mnc-dev

This commit is contained in:
Tyler Gunn
2015-06-03 17:12:41 +00:00
committed by Android (Google) Code Review
9 changed files with 125 additions and 165 deletions

View File

@@ -30587,6 +30587,13 @@ package android.telecom {
method public int describeContents(); method public int describeContents();
method public int getQuality(); method public int getQuality();
method public int getVideoState(); method public int getVideoState();
method public static boolean isAudioOnly(int);
method public static boolean isBidirectional(int);
method public static boolean isPaused(int);
method public static boolean isReceptionEnabled(int);
method public static boolean isTransmissionEnabled(int);
method public static boolean isVideo(int);
method public static java.lang.String videoStateToString(int);
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR; field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
field public static final int QUALITY_DEFAULT = 4; // 0x4 field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -30609,15 +30616,6 @@ package android.telecom {
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR; field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
} }
public static class VideoProfile.VideoState {
method public static boolean isAudioOnly(int);
method public static boolean isBidirectional(int);
method public static boolean isPaused(int);
method public static boolean isReceptionEnabled(int);
method public static boolean isTransmissionEnabled(int);
method public static java.lang.String videoStateToString(int);
}
} }
package android.telephony { package android.telephony {

View File

@@ -32801,6 +32801,13 @@ package android.telecom {
method public int describeContents(); method public int describeContents();
method public int getQuality(); method public int getQuality();
method public int getVideoState(); method public int getVideoState();
method public static boolean isAudioOnly(int);
method public static boolean isBidirectional(int);
method public static boolean isPaused(int);
method public static boolean isReceptionEnabled(int);
method public static boolean isTransmissionEnabled(int);
method public static boolean isVideo(int);
method public static java.lang.String videoStateToString(int);
method public void writeToParcel(android.os.Parcel, int); method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR; field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
field public static final int QUALITY_DEFAULT = 4; // 0x4 field public static final int QUALITY_DEFAULT = 4; // 0x4
@@ -32823,15 +32830,6 @@ package android.telecom {
field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR; field public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
} }
public static class VideoProfile.VideoState {
method public static boolean isAudioOnly(int);
method public static boolean isBidirectional(int);
method public static boolean isPaused(int);
method public static boolean isReceptionEnabled(int);
method public static boolean isTransmissionEnabled(int);
method public static java.lang.String videoStateToString(int);
}
} }
package android.telephony { package android.telephony {

View File

@@ -206,7 +206,7 @@ public abstract class Conference extends Conferenceable {
* Returns video state of the primary call. * Returns video state of the primary call.
*/ */
public int getVideoState() { public int getVideoState() {
return VideoProfile.VideoState.AUDIO_ONLY; return VideoProfile.STATE_AUDIO_ONLY;
} }
/** /**

View File

@@ -1608,7 +1608,7 @@ public abstract class Connection extends Conferenceable {
* a request to accept. * a request to accept.
*/ */
public void onAnswer() { public void onAnswer() {
onAnswer(VideoProfile.VideoState.AUDIO_ONLY); onAnswer(VideoProfile.STATE_AUDIO_ONLY);
} }
/** /**

View File

@@ -42,7 +42,7 @@ public final class ConnectionRequest implements Parcelable {
PhoneAccountHandle accountHandle, PhoneAccountHandle accountHandle,
Uri handle, Uri handle,
Bundle extras) { Bundle extras) {
this(accountHandle, handle, extras, VideoProfile.VideoState.AUDIO_ONLY); this(accountHandle, handle, extras, VideoProfile.STATE_AUDIO_ONLY);
} }
/** /**

View File

@@ -342,10 +342,10 @@ final class ConnectionServiceAdapter implements DeathRecipient {
/** /**
* Sets the video state associated with a call. * Sets the video state associated with a call.
* *
* Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, * Valid values: {@link VideoProfile#STATE_BIDIRECTIONAL},
* {@link VideoProfile.VideoState#BIDIRECTIONAL}, * {@link VideoProfile#STATE_AUDIO_ONLY},
* {@link VideoProfile.VideoState#TX_ENABLED}, * {@link VideoProfile#STATE_TX_ENABLED},
* {@link VideoProfile.VideoState#RX_ENABLED}. * {@link VideoProfile#STATE_RX_ENABLED}.
* *
* @param callId The unique ID of the call to set the video state for. * @param callId The unique ID of the call to set the video state for.
* @param videoState The video state. * @param videoState The video state.

View File

@@ -605,7 +605,7 @@ public final class RemoteConnection {
/** /**
* Obtains the video state of this {@code RemoteConnection}. * Obtains the video state of this {@code RemoteConnection}.
* *
* @return The video state of the {@code RemoteConnection}. See {@link VideoProfile.VideoState}. * @return The video state of the {@code RemoteConnection}. See {@link VideoProfile}.
*/ */
public int getVideoState() { public int getVideoState() {
return mVideoState; return mVideoState;

View File

@@ -173,7 +173,7 @@ public class VideoProfile implements Parcelable {
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append("[VideoProfile videoState = "); sb.append("[VideoProfile videoState = ");
sb.append(VideoState.videoStateToString(mVideoState)); sb.append(videoStateToString(mVideoState));
sb.append(" videoQuality = "); sb.append(" videoQuality = ");
sb.append(mQuality); sb.append(mQuality);
sb.append("]"); sb.append("]");
@@ -181,142 +181,106 @@ public class VideoProfile implements Parcelable {
} }
/** /**
* The video state of the call, stored as a bit-field describing whether video transmission and * Generates a string representation of a video state.
* receipt it enabled, as well as whether the video is currently muted. *
*/ * @param videoState The video state.
public static class VideoState { * @return String representation of the video state.
/** */
* Call is currently in an audio-only mode with no video transmission or receipt. public static String videoStateToString(int videoState) {
* @deprecated Use {@link VideoProfile#STATE_AUDIO_ONLY} instead StringBuilder sb = new StringBuilder();
* @hide sb.append("Audio");
*/
public static final int AUDIO_ONLY = VideoProfile.STATE_AUDIO_ONLY;
/** if (isAudioOnly(videoState)) {
* Video transmission is enabled. sb.append(" Only");
* @deprecated Use {@link VideoProfile#STATE_TX_ENABLED} instead } else {
* @hide if (isTransmissionEnabled(videoState)) {
*/
public static final int TX_ENABLED = VideoProfile.STATE_TX_ENABLED;
/**
* Video reception is enabled.
* @deprecated Use {@link VideoProfile#STATE_RX_ENABLED} instead
* @hide
*/
public static final int RX_ENABLED = VideoProfile.STATE_RX_ENABLED;
/**
* Video signal is bi-directional.
* @deprecated Use {@link VideoProfile#STATE_BIDIRECTIONAL} instead
* @hide
*/
public static final int BIDIRECTIONAL = VideoProfile.STATE_BIDIRECTIONAL;
/**
* Video is paused.
* @deprecated Use {@link VideoProfile#STATE_PAUSED} instead
* @hide
*/
public static final int PAUSED = VideoProfile.STATE_PAUSED;
/** @hide */
private VideoState() {}
/**
* 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, VideoProfile.STATE_TX_ENABLED)
&& !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
}
/**
* Whether the video state is any of the video type
* @param videoState The video state.
* @hide
* @return Returns true if the video state TX or RX or Bidirectional
*/
public static boolean isVideo(int videoState) {
return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
|| hasState(videoState, VideoProfile.STATE_RX_ENABLED)
|| hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
}
/**
* 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, VideoProfile.STATE_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, VideoProfile.STATE_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, VideoProfile.STATE_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, VideoProfile.STATE_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;
}
/**
* Generates a string representation of a {@link VideoState}.
*
* @param videoState The video state.
* @return String representation of the {@link VideoState}.
*/
public static String videoStateToString(int videoState) {
StringBuilder sb = new StringBuilder();
sb.append("Audio");
if (VideoProfile.VideoState.isTransmissionEnabled(videoState)) {
sb.append(" Tx"); sb.append(" Tx");
} }
if (VideoProfile.VideoState.isReceptionEnabled(videoState)) { if (isReceptionEnabled(videoState)) {
sb.append(" Rx"); sb.append(" Rx");
} }
if (VideoProfile.VideoState.isPaused(videoState)) { if (isPaused(videoState)) {
sb.append(" Pause"); sb.append(" Pause");
} }
return sb.toString();
} }
return sb.toString();
}
/**
* Indicates whether the video state is audio only.
*
* @param videoState The video state.
* @return {@code True} if the video state is audio only, {@code false} otherwise.
*/
public static boolean isAudioOnly(int videoState) {
return !hasState(videoState, VideoProfile.STATE_TX_ENABLED)
&& !hasState(videoState, VideoProfile.STATE_RX_ENABLED);
}
/**
* Indicates whether video transmission or reception is enabled for a video state.
*
* @param videoState The video state.
* @return {@code True} if video transmission or reception is enabled, {@code false} otherwise.
*/
public static boolean isVideo(int videoState) {
return hasState(videoState, VideoProfile.STATE_TX_ENABLED)
|| hasState(videoState, VideoProfile.STATE_RX_ENABLED)
|| hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
}
/**
* Indicates whether the video state has video transmission enabled.
*
* @param videoState The video state.
* @return {@code True} if video transmission is enabled, {@code false} otherwise.
*/
public static boolean isTransmissionEnabled(int videoState) {
return hasState(videoState, VideoProfile.STATE_TX_ENABLED);
}
/**
* Indicates whether the video state has video reception enabled.
*
* @param videoState The video state.
* @return {@code True} if video reception is enabled, {@code false} otherwise.
*/
public static boolean isReceptionEnabled(int videoState) {
return hasState(videoState, VideoProfile.STATE_RX_ENABLED);
}
/**
* 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) {
return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL);
}
/**
* Indicates whether the video state is paused.
*
* @param videoState The video state.
* @return {@code True} if the video is paused, {@code false} otherwise.
*/
public static boolean isPaused(int videoState) {
return hasState(videoState, VideoProfile.STATE_PAUSED);
}
/**
* Indicates 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.
*/
private static boolean hasState(int videoState, int state) {
return (videoState & state) == state;
} }
/** /**

View File

@@ -313,28 +313,28 @@ public class ImsCallProfile implements Parcelable {
* @return The video state. * @return The video state.
*/ */
public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) { public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) {
int videostate = VideoProfile.VideoState.AUDIO_ONLY; int videostate = VideoProfile.STATE_AUDIO_ONLY;
switch (callProfile.mCallType) { switch (callProfile.mCallType) {
case CALL_TYPE_VT_TX: case CALL_TYPE_VT_TX:
videostate = VideoProfile.VideoState.TX_ENABLED; videostate = VideoProfile.STATE_TX_ENABLED;
break; break;
case CALL_TYPE_VT_RX: case CALL_TYPE_VT_RX:
videostate = VideoProfile.VideoState.RX_ENABLED; videostate = VideoProfile.STATE_RX_ENABLED;
break; break;
case CALL_TYPE_VT: case CALL_TYPE_VT:
videostate = VideoProfile.VideoState.BIDIRECTIONAL; videostate = VideoProfile.STATE_BIDIRECTIONAL;
break; break;
case CALL_TYPE_VOICE: case CALL_TYPE_VOICE:
videostate = VideoProfile.VideoState.AUDIO_ONLY; videostate = VideoProfile.STATE_AUDIO_ONLY;
break; break;
default: default:
videostate = VideoProfile.VideoState.AUDIO_ONLY; videostate = VideoProfile.STATE_AUDIO_ONLY;
break; break;
} }
if (callProfile.isVideoPaused() && videostate != VideoProfile.VideoState.AUDIO_ONLY) { if (callProfile.isVideoPaused() && videostate != VideoProfile.STATE_AUDIO_ONLY) {
videostate |= VideoProfile.VideoState.PAUSED; videostate |= VideoProfile.STATE_PAUSED;
} else { } else {
videostate &= ~VideoProfile.VideoState.PAUSED; videostate &= ~VideoProfile.STATE_PAUSED;
} }
return videostate; return videostate;
} }
@@ -347,9 +347,9 @@ public class ImsCallProfile implements Parcelable {
* @return The call type. * @return The call type.
*/ */
public static int getCallTypeFromVideoState(int videoState) { public static int getCallTypeFromVideoState(int videoState) {
boolean videoTx = isVideoStateSet(videoState, VideoProfile.VideoState.TX_ENABLED); boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED);
boolean videoRx = isVideoStateSet(videoState, VideoProfile.VideoState.RX_ENABLED); boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED);
boolean isPaused = isVideoStateSet(videoState, VideoProfile.VideoState.PAUSED); boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED);
if (isPaused) { if (isPaused) {
return ImsCallProfile.CALL_TYPE_VT_NODIR; return ImsCallProfile.CALL_TYPE_VT_NODIR;
} else if (videoTx && !videoRx) { } else if (videoTx && !videoRx) {