Add @TestApi annotations to CS-side RTT APIs for CTS
CTS tests need both the in-call and connection service sides of the APIs
to test Telecom functionality properly, so annotating the hidden-for-now
connection service APIs with TestApi.
Test: part of CTS
Change-Id: I3711729d7e8c8aff2735f4da9fbd04bcca6b4942
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index 27f7172..d79a102 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -981,15 +981,24 @@
* @return A string containing text sent by the remote user, or {@code null} if the
* conversation has been terminated or if there was an error while reading.
*/
- public String read() {
- try {
- int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
- if (numRead < 0) {
- return null;
- }
- return new String(mReadBuffer, 0, numRead);
- } catch (IOException e) {
- Log.w(this, "Exception encountered when reading from InputStreamReader: %s", e);
+ public String read() throws IOException {
+ int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE);
+ if (numRead < 0) {
+ return null;
+ }
+ return new String(mReadBuffer, 0, numRead);
+ }
+
+ /**
+ * Non-blocking version of {@link #read()}. Returns {@code null} if there is nothing to
+ * be read.
+ * @return A string containing text entered by the user, or {@code null} if the user has
+ * not entered any new text yet.
+ */
+ public String readImmediately() throws IOException {
+ if (mReceiveStream.ready()) {
+ return read();
+ } else {
return null;
}
}