From bde0b1e4c8672133e346d964f946d435da8f4d22 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 24 Apr 2015 15:09:58 -0700 Subject: [PATCH] Add videoStateToString on videoProvider Class. - Got tired of looking at numerical integer videoStates, so added a new "videoStateToString" static method, similar to how we have a Connection#capabilitiesToString method. Bug: 20257400 Change-Id: I39fcf413938c90e5993985f0976ad4fcce11505d --- api/current.txt | 1 + api/system-current.txt | 1 + .../java/android/telecom/VideoProfile.java | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/api/current.txt b/api/current.txt index ae21bb95f420e..91a9e47b58d0f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28903,6 +28903,7 @@ package android.telecom { 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); 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 diff --git a/api/system-current.txt b/api/system-current.txt index 582e7e4096762..658a489e0683d 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30766,6 +30766,7 @@ package android.telecom { 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); 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 diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java index 2fd438a29fd08..902fddb22a6c8 100644 --- a/telecomm/java/android/telecom/VideoProfile.java +++ b/telecomm/java/android/telecom/VideoProfile.java @@ -144,6 +144,17 @@ public class VideoProfile implements Parcelable { dest.writeInt(mQuality); } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("[VideoProfile videoState = "); + sb.append(VideoState.videoStateToString(mVideoState)); + sb.append(" videoQuality = "); + sb.append(mQuality); + sb.append("]"); + return sb.toString(); + } + /** * 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. @@ -241,5 +252,30 @@ public class VideoProfile implements Parcelable { 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"); + } + + if (VideoProfile.VideoState.isReceptionEnabled(videoState)) { + sb.append(" Rx"); + } + + if (VideoProfile.VideoState.isPaused(videoState)) { + sb.append(" Pause"); + } + + return sb.toString(); + } } }