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
diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java
index 2fd438a..902fddb 100644
--- a/telecomm/java/android/telecom/VideoProfile.java
+++ b/telecomm/java/android/telecom/VideoProfile.java
@@ -144,6 +144,17 @@
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 @@
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();
+ }
}
}