diff --git a/api/current.txt b/api/current.txt index 3f67365bbe288..7584ba8363a55 100644 --- a/api/current.txt +++ b/api/current.txt @@ -38877,7 +38877,7 @@ package android.telecom { public static final class Call.RttCall { method public int getRttAudioMode(); - method public java.lang.String read() throws java.io.IOException; + method public java.lang.String read(); method public java.lang.String readImmediately() throws java.io.IOException; method public void setRttMode(int); method public void write(java.lang.String) throws java.io.IOException; diff --git a/api/system-current.txt b/api/system-current.txt index ac38ac5de1a69..99632688e2391 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -42122,7 +42122,7 @@ package android.telecom { public static final class Call.RttCall { method public int getRttAudioMode(); - method public java.lang.String read() throws java.io.IOException; + method public java.lang.String read(); method public java.lang.String readImmediately() throws java.io.IOException; method public void setRttMode(int); method public void write(java.lang.String) throws java.io.IOException; diff --git a/api/test-current.txt b/api/test-current.txt index a946ec990f25d..1258554e7fddc 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -39120,7 +39120,7 @@ package android.telecom { public static final class Call.RttCall { method public int getRttAudioMode(); - method public java.lang.String read() throws java.io.IOException; + method public java.lang.String read(); method public java.lang.String readImmediately() throws java.io.IOException; method public void setRttMode(int); method public void write(java.lang.String) throws java.io.IOException; diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index c1289d3f14012..e13bd61937199 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -1089,12 +1089,17 @@ public final class Call { * @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() throws IOException { - int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE); - if (numRead < 0) { + 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); return null; } - return new String(mReadBuffer, 0, numRead); } /** @@ -1105,7 +1110,11 @@ public final class Call { */ public String readImmediately() throws IOException { if (mReceiveStream.ready()) { - return read(); + int numRead = mReceiveStream.read(mReadBuffer, 0, READ_BUFFER_SIZE); + if (numRead < 0) { + return null; + } + return new String(mReadBuffer, 0, numRead); } else { return null; }