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

Commit e7cd5a90 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by android-build-merger
Browse files

Merge \\"Make CotentResolver#openInputStream handle errors from reliable...

Merge \\"Make CotentResolver#openInputStream handle errors from reliable pipes.\\" into nyc-dev am: ac3fe8ff
am: 499ab43c

Change-Id: Ifc333646610580363acf8432eb25a78aa876fc25
parents 21eecc88 499ab43c
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -864,6 +864,34 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {
                super.close();
            }
        }

        @Override
        public int read() throws IOException {
            final int result = super.read();
            if (result == -1 && mPfd.canDetectErrors()) {
                // Check for errors only on EOF, to minimize overhead.
                mPfd.checkError();
            }
            return result;
        }

        @Override
        public int read(byte[] b) throws IOException {
            final int result = super.read(b);
            if (result == -1 && mPfd.canDetectErrors()) {
                mPfd.checkError();
            }
            return result;
        }

        @Override
        public int read(byte[] b, int off, int len) throws IOException {
            final int result = super.read(b, off, len);
            if (result == -1 && mPfd.canDetectErrors()) {
                mPfd.checkError();
            }
            return result;
        }
    }

    /**