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

Commit 3b3445d5 authored by Sergey Volnov's avatar Sergey Volnov
Browse files

Close a file descriptor that's a copy of the one that the receiver

receives.

That is to give ability to the receiving end to close the stream and by
that cancel the copy operation.

Test: CTS in a parallel commit
Bug: 157141129
Change-Id: I1da1a47d7f8a7a5208644cf6e1266a3a2a724c17
parent daeb3d4b
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -960,10 +960,11 @@ public final class ContentCaptureManagerService extends
            mClientAdapter.write(sourceIn);
            mClientAdapter.write(sourceIn);
            serviceAdapter.start(sinkOut);
            serviceAdapter.start(sinkOut);


            // File descriptor received by the client app will be a copy of the current one. Close
            // File descriptors received by remote apps will be copies of the current one. Close
            // the one that belongs to the system server, so there's only 1 open left for the
            // the ones that belong to the system server, so there's only 1 open left for the
            // current pipe.
            // current pipe. Therefore when remote parties decide to close them - all descriptors
            bestEffortCloseFileDescriptor(sourceIn);
            // pointing to the pipe will be closed.
            bestEffortCloseFileDescriptors(sourceIn, sinkOut);


            mParentService.mDataShareExecutor.execute(() -> {
            mParentService.mDataShareExecutor.execute(() -> {
                try (InputStream fis =
                try (InputStream fis =