Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e46f400 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Merge "Fix readImmediately for CTS" into pi-dev am: ec328eea

am: df1ac170

Change-Id: Ia80975223bf06bf6d8a04403a6ab11274ff22d6c
parents 296a76ca df1ac170
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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;