summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2018-07-09 22:47:29 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-07-09 22:47:29 +0000
commitec328eea490fa28c175bae94e49c4c40b774f77a (patch)
tree76b6d85aa5f8896b7c7dac846fb0d127319171f5
parentc4cf07a16f27ed795cfea6b0f2e650b63f2b5552 (diff)
parent17eb1bd6e4d0a3062df6787a7564f02abfade50c (diff)
Merge "Fix readImmediately for CTS" into pi-dev
-rw-r--r--telecomm/java/android/telecom/Connection.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 3e97c8f40bf8..468c8fa9e30c 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -854,6 +854,8 @@ public abstract class Connection extends Conferenceable {
private final OutputStreamWriter mPipeToInCall;
private final ParcelFileDescriptor mFdFromInCall;
private final ParcelFileDescriptor mFdToInCall;
+
+ private final FileInputStream mFromInCallFileInputStream;
private char[] mReadBuffer = new char[READ_BUFFER_SIZE];
/**
@@ -862,11 +864,11 @@ public abstract class Connection extends Conferenceable {
public RttTextStream(ParcelFileDescriptor toInCall, ParcelFileDescriptor fromInCall) {
mFdFromInCall = fromInCall;
mFdToInCall = toInCall;
+ mFromInCallFileInputStream = new FileInputStream(fromInCall.getFileDescriptor());
// Wrap the FileInputStream in a Channel so that it's interruptible.
mPipeFromInCall = new InputStreamReader(
- Channels.newInputStream(Channels.newChannel(
- new FileInputStream(fromInCall.getFileDescriptor()))));
+ Channels.newInputStream(Channels.newChannel(mFromInCallFileInputStream)));
mPipeToInCall = new OutputStreamWriter(
new FileOutputStream(toInCall.getFileDescriptor()));
}
@@ -914,7 +916,7 @@ public abstract class Connection extends Conferenceable {
* not entered any new text yet.
*/
public String readImmediately() throws IOException {
- if (mPipeFromInCall.ready()) {
+ if (mFromInCallFileInputStream.available() > 0) {
return read();
} else {
return null;