Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 48332d62 authored by Andrew Lee's avatar Andrew Lee
Browse files

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
parent 4d193bdb
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -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
  }
}
+8 −8
Original line number Diff line number Diff line
@@ -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.
     */
+4 −4
Original line number Diff line number Diff line
@@ -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.
     */
+4 −4
Original line number Diff line number Diff line
@@ -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";
+94 −33
Original line number Diff line number Diff line
@@ -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;
        }
    }
}
Loading