'ParcelFileDescriptor#closeWithError() only works in one direction

I have this code in a ContentProvider that I hand a ParcelFileDescriptor to a caller in OpenFile(), but when I do ParcelFileDescriptor#closeWithError() it only works in one direction.

    ParcelFileDescriptor readSide = null;
    ParcelFileDescriptor writeSide = null;
    try {
        ParcelFileDescriptor[] pipe = ParcelFileDescriptor.createReliablePipe();
        readSide = pipe[0];
        writeSide = pipe[1];
    } catch (IOException e) {
        Slog.e(TAG, "Exception while creating pipe!", e);
        throw new FileNotFoundException(e.getMessage());
    }

I get in caller's log:

W/ParcelFileDescriptor: Peer didn't provide a comm channel; unable to check for errors

Anyone knows why it doesn't work both read and write direction? I am on Lollipop.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source